This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/2][BZ #12416] Use stack boundaries from /proc/PID/mapsto make stack executable
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Wed, 25 Apr 2012 10:36:33 +0530
- Subject: Re: [PATCH 2/2][BZ #12416] Use stack boundaries from /proc/PID/mapsto make stack executable
- References: <20120419120021.4780e8c8@spoyarek>
ping?
On Thu, 19 Apr 2012 12:00:21 +0530, Siddhesh wrote:
> Hi,
>
> Using __libc_stack_end as the end of stack to mark an executable stack
> misses pages at the end of stack that are used to store program
> arguments, environment variables and auxiliary elf information. Due to
> this, the stack vma gets split and later requests for stack address
> using pthread_getattr_np() return a different value than before.
>
> This behaviour can be seen using the reproducer in bz#12416.
>
> This patch fixes an inconsistency between the treatment of stack size
> in pthread_getattr_np and _dl_make_stack_executable where the former
> used __libc_stack_end to find the stack vma in /proc/PID/maps and used
> the real stack end while the latter used the __libc_stack_end itself
> as the stack end.
>
> I have modified tst-execstack to test this in make check. Testsuite
> reports no new regressions from this patch.
>
> Regards,
> Siddhesh
>
> 2012-04-19 Siddhesh Poyarekar <siddhesh@redhat.com>
>
> [BZ #12416]
> * elf/tst-execstack.c (get_main_stack_bounds): New function.
> (do_test): Modify test to also verify that main stack bounds
> do not change after execstack-dso.so is dlopen'd.
> * sysdeps/unix/sysv/linux/dl-execstack.c (__strtoul_internal):
> Declare extern.
> (__read_one_line, __get_map_bounds): New functions.
> (_dl_make_stack_executable): Use stack bounds
> from /proc/PID/maps if available.