Re: waitid() corrupts stack
Re: waitid() corrupts stack
- Subject: Re: waitid() corrupts stack
- From: Greg Parker <email@hidden>
- Date: Thu, 15 Apr 2010 19:56:14 -0700
On Apr 15, 2010, at 7:20 PM, Dave Keck wrote:
> On i386 10.6, waitid() corrupts the stack, resulting in a crash (bug #7871139):
>
> The program works when compiled for x86_64. Is waitid() safe to use
> from 64-bit? Perhaps there's a workaround to use it under i386?
The kernel is writing the wrong size value into your siginfo_t variable. It looks like it's writing the 64-bit version of siginfo_t, but your 32-bit process has a smaller siginfo_t type. (siginfo_t has pointer and longint fields that change size.)
If you don't need the siginfo_t's values, you should be able to get away with passing a bigger buffer to waitid(). The 64-bit type is less than twice as big as the 32-bit type, so this should do the trick:
siginfo_t info[2];
waitid(P_PID, pid, info, (WEXITED | WNOWAIT));
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
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