This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/2][BZ #12416] Use stack boundaries from /proc/PID/mapsto make stack executable


On Wed, May 16, 2012 at 3:03 AM, Siddhesh Poyarekar <siddhesh@redhat.com> wrote:
> On Tue, 15 May 2012 09:30:33 -0700 (PDT), Roland wrote:
>> Do you mean just below the stack (lower address)? ?If it's actually
>> the dlopen'd module, then that is a file mapping rather than an
>> anonymous mapping like the stack. ?You can distinguish those in
>> /proc/self/maps (the fourth column is 00:00 for anonymous mappings and
>> not that for file mappings). ?So pthread_getattr_np need never be
>> confused by that case.
>
> Yes I meant below, sorry about that.
>
> I interpreted the pthread_getattr_np logic to consider the end of
> previous vma for stack size to mean that we're looking at the potential
> for the stack to grow, subject to rlimit. Whether or not the mapping
> above is anonymous should not matter in that case. If we consider that
> the file mapping happens below the stack, the potential for growth of
> the stack changes to the end of that mapping and if rlimit is high
> enough, it will change the stacksize and stackaddr returned.
>
> I've attached an updated patch with the rest of the changes. If we
> don't want to account for a too high rlimit (that is a pre-requisite
> for this situation to occur) then I can change the check to individual
> verification of stack size and stack address and send an updated patch.
>
> Thanks,
> Siddhesh
>
> ChangeLog:
>
> 2012-05-16 ?Siddhesh Poyarekar ?<siddhesh@redhat.com>
>
> ? ? ? ?* elf/tst-execstack.c: Include stackinfo.h.
> ? ? ? ?(do_test): Adjust test case to ensure that pthread_getattr_np
> ? ? ? ?behaviour remains the same after marking stack executable.
>
> nptl/ChangeLog:
>
> 2012-05-16 ?Siddhesh Poyarekar ?<siddhesh@redhat.com>
>
> ? ? ? ?* nptl/pthread_getattr_np.c (pthread_getattr_np): Use
> ? ? ? ?__libc_stack_end rounded to the end of containing page as the
> ? ? ? ?real stack end.

Sorry for the long delay.

I received a complains against this change from ruby folks. Because of,
ruby interpreter show special error message when stack overflow is
detected. and they assume "stackaddr - stacksize" point to stack edge.

But this patch only changed stackaddr. thus the assuption broke.
Is there any chance to change stacksize too?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]