Set x86 TLS limit to 0xfffff, not PAGE_SIZE.
Not least because we set limit_in_pages to 1. PAGE_SIZE pages was never anyone's intention. Change-Id: Ide867f44a2fb20d4d5d0cd67ced468e8665a0193
This commit is contained in:
parent
4c3cf4ad4d
commit
01b85d5df3
|
@ -675,7 +675,7 @@ LOCAL_SRC_FILES := \
|
|||
bionic/__stack_chk_fail.cpp \
|
||||
|
||||
LOCAL_SRC_FILES_arm64 := arch-arm64/bionic/__set_tls.c
|
||||
LOCAL_SRC_FILES_x86 := arch-x86/bionic/__set_tls.c
|
||||
LOCAL_SRC_FILES_x86 := arch-x86/bionic/__set_tls.cpp
|
||||
LOCAL_SRC_FILES_x86_64 := arch-x86_64/bionic/__set_tls.c
|
||||
|
||||
LOCAL_CFLAGS := $(libc_common_cflags) -fno-stack-protector
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <asm/ldt.h>
|
||||
|
||||
extern int __set_thread_area(struct user_desc*);
|
||||
extern "C" int __set_thread_area(struct user_desc*);
|
||||
|
||||
__LIBC_HIDDEN__ void __init_user_desc(struct user_desc* result, bool allocate, void* base_addr) {
|
||||
if (allocate) {
|
||||
|
@ -45,9 +45,9 @@ __LIBC_HIDDEN__ void __init_user_desc(struct user_desc* result, bool allocate, v
|
|||
result->entry_number = (gs & 0xffff) >> 3;
|
||||
}
|
||||
|
||||
result->base_addr = (uintptr_t) base_addr;
|
||||
result->base_addr = reinterpret_cast<uintptr_t>(base_addr);
|
||||
|
||||
result->limit = PAGE_SIZE;
|
||||
result->limit = 0xfffff;
|
||||
|
||||
result->seg_32bit = 1;
|
||||
result->contents = MODIFY_LDT_CONTENTS_DATA;
|
||||
|
@ -57,7 +57,7 @@ __LIBC_HIDDEN__ void __init_user_desc(struct user_desc* result, bool allocate, v
|
|||
result->useable = 1;
|
||||
}
|
||||
|
||||
__LIBC_HIDDEN__ int __set_tls(void* ptr) {
|
||||
extern "C" __LIBC_HIDDEN__ int __set_tls(void* ptr) {
|
||||
struct user_desc tls_descriptor;
|
||||
__init_user_desc(&tls_descriptor, true, ptr);
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
// x86 uses segment descriptors rather than a direct pointer to TLS.
|
||||
#if __i386__
|
||||
#include <asm/ldt.h>
|
||||
extern "C" __LIBC_HIDDEN__ void __init_user_desc(struct user_desc*, int, void*);
|
||||
void __init_user_desc(struct user_desc*, bool, void*);
|
||||
#endif
|
||||
|
||||
extern "C" int __isthreaded;
|
||||
|
|
Loading…
Reference in New Issue