mstackrealign, update_prebinding and the misaligned_stack_error crashes
mstackrealign, update_prebinding and the misaligned_stack_error crashes
- Subject: mstackrealign, update_prebinding and the misaligned_stack_error crashes
- From: "Sorin Negoita" <email@hidden>
- Date: Thu, 30 Oct 2008 13:06:47 +0200
Hello,
Our application must integrate some private dynamic library, let's call it A (that may load other private dynamic libraries, let's call them B1, B2, ..., Bn) with the stack alligned for 4 bytes (boundary 2), not the Mac OS X standard (16 bytes). Those private dynamic libraries (A, B1, B2, ..., Bn) use libSystem only, apparently. We use -mstackrealign when building the code that uses the A library and this approach generally works, the exception being dyld's shared cache in 10.5 after some of the system updates or after system restorations from DMG images. In these cases our application crashes, sometimes it miraculously recovers after it is restarted.
"$update_prebinding -root -force" (update_dyld_shared_cache) always solves the problem.
A solution seems to be to set DYLD_BIND_AT_LAUNCH to 1 (DYLD_SHARED_REGION="avoid" doesn't solve the problem).
Using DYLD_BIND_AT_LAUNCH, besides -mstackrealign, seems to be a major performance loss.
Crashed thread stack has the exception code 13 (KERN_NAME_EXISTS) and they look like following:
"
Thread 0 Crashed:
0 dyld 0x8fe18b42 misaligned_stack_error + 0
1 libSystem.B.dylib 0x0053851e strcasecmp + 60
2 <private library aligned to 4 bytes >
"
(strcasecmp or mprotect, not really important)
Questions:
1) a better solution than DYLD_BIND_AT_LAUNCH ?
2) there is a way to detect when option DYLD_BIND_AT_LAUNCH is needed or not ?
3) what is the link between stack (mis)alignment and the dyld's shared cache ? does this cache contains the alignment info besides the offsets info ?
Thanks in advance !
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden