Merge changes from topic 'debuggerd_fallback'
* changes:
linker_memory: allow fallback allocator to be turned on and off.
Increase signal stack size on 32-bit to 16kB.
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
index f591c86..6b3e148 100644
--- a/libc/bionic/pthread_create.cpp
+++ b/libc/bionic/pthread_create.cpp
@@ -62,11 +62,13 @@
if (allocation == MAP_FAILED) {
__libc_fatal("failed to allocate TLS");
}
+ prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, allocation, allocation_size, "bionic TLS guard page");
thread->bionic_tls = reinterpret_cast<bionic_tls*>(static_cast<char*>(allocation) + PAGE_SIZE);
if (mprotect(thread->bionic_tls, BIONIC_TLS_SIZE, PROT_READ | PROT_WRITE) != 0) {
__libc_fatal("failed to mprotect TLS");
}
+ prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, thread->bionic_tls, BIONIC_TLS_SIZE, "bionic TLS");
}
void __init_thread_stack_guard(pthread_internal_t* thread) {
diff --git a/libc/bionic/pthread_exit.cpp b/libc/bionic/pthread_exit.cpp
index 3401ed7..9adf405 100644
--- a/libc/bionic/pthread_exit.cpp
+++ b/libc/bionic/pthread_exit.cpp
@@ -92,6 +92,10 @@
thread->alternate_signal_stack = NULL;
}
+ // Unmap the bionic TLS, including guard pages.
+ void* allocation = reinterpret_cast<char*>(thread->bionic_tls) - PAGE_SIZE;
+ munmap(allocation, BIONIC_TLS_SIZE + 2 * PAGE_SIZE);
+
ThreadJoinState old_state = THREAD_NOT_JOINED;
while (old_state == THREAD_NOT_JOINED &&
!atomic_compare_exchange_weak(&thread->join_state, &old_state, THREAD_EXITED_NOT_JOINED)) {
diff --git a/libc/bionic/pthread_internal.cpp b/libc/bionic/pthread_internal.cpp
index 2bc2bfb..5819bc1 100644
--- a/libc/bionic/pthread_internal.cpp
+++ b/libc/bionic/pthread_internal.cpp
@@ -86,10 +86,6 @@
}
static void __pthread_internal_free(pthread_internal_t* thread) {
- // Unmap the TLS, including guard pages.
- void* allocation = reinterpret_cast<char*>(thread->bionic_tls) - PAGE_SIZE;
- munmap(allocation, BIONIC_TLS_SIZE + 2 * PAGE_SIZE);
-
if (thread->mmap_size != 0) {
// Free mapped space, including thread stack and pthread_internal_t.
munmap(thread->attr.stack_base, thread->mmap_size);
diff --git a/libc/bionic/system_properties.cpp b/libc/bionic/system_properties.cpp
index 2bbf2d3..a4faf85 100644
--- a/libc/bionic/system_properties.cpp
+++ b/libc/bionic/system_properties.cpp
@@ -1058,15 +1058,23 @@
return true;
}
- // TODO: Change path to /system/property_contexts after b/27805372
- if (!initialize_properties_from_file("/plat_property_contexts")) {
- return false;
+ // Use property_contexts from /system & /vendor, fall back to those from /
+ if (access("/system/etc/selinux/plat_property_contexts", R_OK) != -1) {
+ if (!initialize_properties_from_file("/system/etc/selinux/plat_property_contexts")) {
+ return false;
+ }
+ if (!initialize_properties_from_file("/vendor/etc/selinux/nonplat_property_contexts")) {
+ return false;
+ }
+ } else {
+ if (!initialize_properties_from_file("/plat_property_contexts")) {
+ return false;
+ }
+ if (!initialize_properties_from_file("/nonplat_property_contexts")) {
+ return false;
+ }
}
- // TODO: Change path to /vendor/property_contexts after b/27805372
- // device-specific property context is optional, so load if it exists.
- initialize_properties_from_file("/nonplat_property_contexts");
-
return true;
}