[PATCH 2/2][BZ #12416] Use stack boundaries from /proc/PID/maps to make stack executable

Carlos O'Donell carlos@systemhalted.org
Wed May 16 15:44:00 GMT 2012


On Mon, May 14, 2012 at 7:46 PM, Roland McGrath <roland@hack.frob.com> wrote:
>> So I propose the following simpler patch instead in the interest of
>> marking as less of the stack as possible as executable. The patch
>> modifies pthread_getattr_np to use the page end containing
>> __libc_stack_end as the end of stack and hence return stack_size and
>> stack_end + stack_size as the size and address of stack respectively.
>
> That sounds reasonable.
>
>> One other thing I realized when I wrote the test case is that
>> __pthread_attr_getstackaddr simply subtracts stacksize from stackaddr
>> and returns it, which is wrong for architectures with _STACK_GROWS_UP.
>> In fact, pthread_getattr_np also probably has a similar problem. I am
>> currently surrounded by x86 boxes, so I'll see if I find myself an ia64
>> box to confirm this. I'll post patches for those problems separately if
>> they're applicable.
>
> The only _STACK_GROWS_UP machine is hppa.

I have a *pile* of patches to nptl/ to fix all of this, but I haven't
had time to push them out for review.

If you find  place that needs _STACK_GROWS_UP please mark it with:

#if _STACK_GROWS_UP
# error Not implemented.
#endif

Then I'll find that and fix it up for hppa.

Cheers,
Carlos.



More information about the Libc-alpha mailing list