bionic/libc/private
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
..
__get_tls.h AArch64: Add initial support for AArch64 2013-12-16 17:00:22 -08:00
bionic_asm.h Unify our assembler macros. 2014-02-20 13:51:26 -08:00
bionic_atomic_arm64.h bionic: rename aarch64 target to arm64 2014-01-23 18:35:39 -08:00
bionic_atomic_arm.h ARM: Change dmb domain for bionic_atomic_barrier() 2013-12-19 11:39:01 -08:00
bionic_atomic_gcc_builtin.h ARM: Change dmb domain for bionic_atomic_barrier() 2013-12-19 11:39:01 -08:00
bionic_atomic_inline.h bionic: rename aarch64 target to arm64 2014-01-23 18:35:39 -08:00
bionic_atomic_mips.h Clean up the pthread-only atomic stuff a little. 2013-12-16 10:18:11 -08:00
bionic_atomic_x86.h Clean up the pthread-only atomic stuff a little. 2013-12-16 10:18:11 -08:00
bionic_auxv.h Switch <elf.h> over to linux uapi under the covers. 2014-02-10 18:22:24 -08:00
bionic_config.h Use a separate config.h for config like defines. 2014-06-16 23:35:53 -07:00
bionic_futex.h Return the actual success result from __futex. 2014-05-29 10:27:55 -07:00
bionic_macros.h Fix BIONIC_ROUND_UP_POWER_OF_2 for 64 bit. 2014-07-15 13:23:06 -07:00
bionic_mbstate.h Adds functionality specified by uchar.h 2014-06-04 08:39:24 -07:00
bionic_prctl.h Label pages mapped by linker_allocator 2014-08-13 18:15:29 -07:00
bionic_pthread.h <pthread.h> fixes and pthread cleanup. 2013-10-31 12:31:16 -07:00
bionic_ssp.h Simplify __stack_chk_fail, and fix it so we get debuggerd stack traces. 2013-02-14 14:37:34 -08:00
bionic_string_utils.h Fix pthread_getattr_np for the main thread. 2014-08-26 12:55:01 -07:00
bionic_time_conversions.h Remove dependencies on obsolete __ARCH_WANT_SYSCALL_DEPRECATED system calls. 2013-10-24 15:48:32 -07:00
bionic_time.h Start hiding "private/bionic_time.h". 2014-07-25 15:24:57 -07:00
bionic_tls.h Move common macros into bionic_macros.h. 2014-06-18 14:23:46 -07:00
ErrnoRestorer.h Bring in google3-style DISALLOW_* macros. 2014-05-09 19:12:08 -07:00
kernel_sigset_t.h Remove dependencies on obsolete __ARCH_WANT_SYSCALL_DEPRECATED system calls. 2013-10-24 15:48:32 -07:00
KernelArgumentBlock.h Bring in google3-style DISALLOW_* macros. 2014-05-09 19:12:08 -07:00
libc_events.h Add stpcpy/stpncpy. 2014-04-07 16:41:53 -07:00
libc_logging.h Expose android_set_abort_message(). 2014-08-19 18:46:45 +00:00
NetdClientDispatch.h Mark sockets on creation (socket()) and accept4(). 2014-05-19 15:19:16 -07:00
ScopedFd.h Load library using file handle. 2014-07-02 13:20:47 -07:00
ScopedPthreadMutexLocker.h Bring in google3-style DISALLOW_* macros. 2014-05-09 19:12:08 -07:00
ScopedReaddir.h Bring in google3-style DISALLOW_* macros. 2014-05-09 19:12:08 -07:00
thread_private.h Use upstream OpenBSD's arc4random. 2014-07-21 19:17:15 -07:00
ThreadLocalBuffer.h Revert "Revert "More pthreads cleanup."" 2013-02-12 15:27:18 -08:00