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

KOSAKI Motohiro kosaki.motohiro@gmail.com
Tue Jun 12 17:21:00 GMT 2012


(6/12/12 10:55 AM), Siddhesh Poyarekar wrote:
> On Mon, 11 Jun 2012 18:43:17 -0400, KOSAKI wrote:
>>
>> If my parsing is correct,  following adjustment only works when
>> previous vma is enough near.
>>
>>>                       /* The limit might be too high.  */
>>>                       if ((size_t) iattr->stacksize
>>>                           >  (size_t) iattr->stackaddr - last_to)
>>>                         iattr->stacksize = (size_t) iattr->stackaddr
>>> - last_to;
>>
>> Am I missing something?
>>
>
> No you're right, I missed that point. I'll post a patch once I figure
> out a reproducer, because I'd like to capture it in a test case.

btw, I think non main thread stack size also violate same sentence in posix.
because of, nptl pthread_setstacksize() set "stack size + guard-page size",
but posix require pthread_attr_getstack() should return only read/write pages.

As far as reading following threads,

http://sources.redhat.com/ml/libc-alpha/2008-05/msg00086.html
https://bugzilla.redhat.com/show_bug.cgi?id=435337

pthread_setstacksize() behavior seems intentional. (really?). if so,
pthread_attr_getstack() should care guard page instead, perhaps.


Of course, this is completely unrelated your recent change. surely offtopic.



More information about the Libc-alpha mailing list