summaryrefslogtreecommitdiffstats
path: root/libc/arch-x86_64
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-08-25 17:26:50 -0700
committerElliott Hughes <enh@google.com>2014-08-26 10:36:38 -0700
commit57b7a6110e7e8b446fc23cce4765ff625ee0a105 (patch)
treee2578675ae1435988a645a32182ced476f802ec5 /libc/arch-x86_64
parenta4a8c4feb8cf3cebf8aceace70e699e128095b5c (diff)
downloadbionic-57b7a6110e7e8b446fc23cce4765ff625ee0a105.zip
bionic-57b7a6110e7e8b446fc23cce4765ff625ee0a105.tar.gz
bionic-57b7a6110e7e8b446fc23cce4765ff625ee0a105.tar.bz2
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> Change-Id: I1d4dbffe7bc7bda1d353c3a295dbf68d29f63158
Diffstat (limited to 'libc/arch-x86_64')
-rw-r--r--libc/arch-x86_64/bionic/__get_sp.S34
-rw-r--r--libc/arch-x86_64/x86_64.mk1
2 files changed, 0 insertions, 35 deletions
diff --git a/libc/arch-x86_64/bionic/__get_sp.S b/libc/arch-x86_64/bionic/__get_sp.S
deleted file mode 100644
index 49a2406..0000000
--- a/libc/arch-x86_64/bionic/__get_sp.S
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <private/bionic_asm.h>
-
-ENTRY_PRIVATE(__get_sp)
- mov %rsp, %rax
- ret
-END(__get_sp)
diff --git a/libc/arch-x86_64/x86_64.mk b/libc/arch-x86_64/x86_64.mk
index 7887c51..b001b5e 100644
--- a/libc/arch-x86_64/x86_64.mk
+++ b/libc/arch-x86_64/x86_64.mk
@@ -30,7 +30,6 @@ libc_common_src_files_x86_64 += \
libc_bionic_src_files_x86_64 := \
arch-x86_64/bionic/__bionic_clone.S \
arch-x86_64/bionic/_exit_with_stack_teardown.S \
- arch-x86_64/bionic/__get_sp.S \
arch-x86_64/bionic/__rt_sigreturn.S \
arch-x86_64/bionic/_setjmp.S \
arch-x86_64/bionic/setjmp.S \