Merge "Set x86 TLS limit to 0xfffff, not PAGE_SIZE."

This commit is contained in:
Elliott Hughes 2016-02-10 15:48:52 +00:00 committed by Gerrit Code Review
commit 8fa00a5836
3 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;