{ "id": "61623", "key": "TIMOB-991", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11224", "name": "Release 1.4.0", "archived": true, "released": true, "releaseDate": "2010-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:54:54.000+0000", "created": "2011-04-15T02:40:53.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "ios", "iphone", "mobile" ], "versions": [], "issuelinks": [], "assignee": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:54:54.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

When running any Titanium 0.9+ app in 4.0, the app crashes on\nstart. Jeff and I tracked it down to inside TiJSCore, namely\ncalling vm_map returns a mapped area in 3.x, but returns 4 (Invalid\nparameters) with address 0. TiJSCore next tries to dereference the\n0 address, crashing.

\n

In some situations, building for 4.0 works but then it crashes\non 3.x. We may need to compare the arguments generated in each\ncase, and dynamically try (Or try multiple times) to get the memory\nto stop the crasher.

{html}", "attachment": [ { "id": "17905", "filename": "archive.zip", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:40:56.000+0000", "size": 11950081, "mimeType": "application/zip" } ], "flagged": false, "summary": "Crash on startup in iPhone OS 4.0", "creator": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "124524", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

The plot thickens. Why does this one project have vm_map fail\nand succeed in the same run? (Built in b2)

{html}", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:40:59.000+0000", "updated": "2011-04-15T02:40:59.000+0000" }, { "id": "124525", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Words fail me. When building for 4.0b4 or 3.2, running on a\n3.1.3 device:

\n
\nvoid foo(vm_address_t *unused)\n{\n    vm_address_t resultaddress = 0;\n    vm_address_t *address = &resultaddress;\n    kern_return_t result;\n\n    printf(\"We're calling vm_map(0x%X (0x%X))\\n\",(unsigned int)address,*address);\n    result = vm_map(current_task(),address,BLOCK_SIZE,BLOCK_OFFSET_MASK,VM_FLAGS_ANYWHERE | VM_MAKE_TAG(63),MEMORY_OBJECT_NULL,0,FALSE,VM_PROT_DEFAULT,VM_PROT_DEFAULT,VM_INHERIT_DEFAULT);\n    printf(\"vm_map2 function was 0x%X. Result was 0x%X, Address is 0x%X\\n\",(unsigned int)vm_map,result,*address);\n}\n
\n

foo(NULL); will succeed. {vm_address_t resultaddress = 0;\nfoo(&resultaddress);} will fail.

\n

You read that right. A nonzero value in an unused variable will\ncause an error in a called function. I spent several minutes\nsaying, \"What?!\"

\n

For 3.2 or 4.0b4 on a 4.0b4 device, the unused variable has no\neffect, as what should happen.

\n

This does not explain why there is a failure for 4.0 against the\nold 3.1-era TiJSCore code, but we at least have a workaround, and\nwe can safely build tiJSCore with 3.2 as the base SDK, and it\nshould be backwards and forwards compatible.

{html}", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:40:59.000+0000", "updated": "2011-04-15T02:40:59.000+0000" }, { "id": "124526", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Fix implemented in TiJSCore.

{html}", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:41:00.000+0000", "updated": "2011-04-15T02:41:00.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }