bionic/libc
Elliott Hughes 6421823410 Fix pthread_getattr_np for the main thread.
On most architectures the kernel subtracts a random offset to the stack
pointer in create_elf_tables by calling arch_align_stack before writing
the auxval table and so on. On all but x86 this doesn't cause a problem
because the random offset is less than a page, but on x86 it's up to two
pages. This means that our old technique of rounding the stack pointer
doesn't work. (Our old implementation of that technique was wrong too.)

It's also incorrect to assume that the main thread's stack base and size
are constant. Likewise to assume that the main thread has a guard page.
The main thread is not like other threads.

This patch switches to reading /proc/self/maps (and checking RLIMIT_STACK)
whenever we're asked.

Bug: 17111575
Signed-off-by: Fengwei Yin <fengwei.yin@intel.com>

(cherry picked from commit 57b7a6110e)

Change-Id: I87e679ee1c0db8092f2d1221c8e7c1461545c5a4
2014-08-26 12:55:01 -07:00
..
arch-arm Fix pthread_getattr_np for the main thread. 2014-08-26 12:55:01 -07:00
arch-arm64 Fix pthread_getattr_np for the main thread. 2014-08-26 12:55:01 -07:00
arch-common/bionic Fixes for __cxa_finalize 2014-05-05 11:36:57 -07:00
arch-mips Fix pthread_getattr_np for the main thread. 2014-08-26 12:55:01 -07:00
arch-mips64 Fix pthread_getattr_np for the main thread. 2014-08-26 12:55:01 -07:00
arch-x86 Fix pthread_getattr_np for the main thread. 2014-08-26 12:55:01 -07:00
arch-x86_64 Fix pthread_getattr_np for the main thread. 2014-08-26 12:55:01 -07:00
bionic Fix pthread_getattr_np for the main thread. 2014-08-26 12:55:01 -07:00
dns Revert most of "Cleanup: Delete dead code." 2014-08-06 13:38:16 -04:00
include Fix some 32-bit-isms in <stdio.h>. 2014-08-20 12:14:21 -07:00
kernel Add gen syscalls step to instructions. 2014-07-18 16:56:33 -07:00
private Fix pthread_getattr_np for the main thread. 2014-08-26 12:55:01 -07:00
stdio Fix visibility for a bunch more symbols. 2014-07-14 18:59:51 -07:00
tools Make __set_errno hidden in asm. 2014-08-08 15:37:50 -07:00
tzcode Fix the tzdata update tools. 2014-08-06 15:29:10 -07:00
upstream-dlmalloc Put all allocation functions into dispatch table. 2014-06-12 15:08:18 -07:00
upstream-freebsd Fix visibility for a bunch more symbols. 2014-07-14 18:59:51 -07:00
upstream-netbsd Implement twalk(3), add unit tests. 2014-07-24 15:14:06 -07:00
upstream-openbsd Implement twalk(3), add unit tests. 2014-07-24 15:14:06 -07:00
zoneinfo Upgrade bionic to tzdata2014f. 2014-08-06 15:26:13 -07:00
Android.mk Hide C++ stuff in libc. Put it back in libstdc++. 2014-08-18 13:56:07 -07:00
crt.mk Reconfig libc's Android.mk to build for multilib 2014-02-12 13:58:34 -08:00
MODULE_LICENSE_BSD
NOTICE Implement twalk(3), add unit tests. 2014-07-24 15:14:06 -07:00
SYSCALLS.TXT Revert "Replaces vfork() implementation with fork()" 2014-08-06 12:32:22 -07:00