From: Elliott Hughes Date: Tue, 26 Sep 2017 18:39:36 +0000 (-0700) Subject: Include strerror(errno) in __init_tls abort messages. X-Git-Tag: android-x86-8.1-r1~6^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f2a1b12f2e689c2ef116c955f42c640f5c344487;p=android-x86%2Fbionic.git Include strerror(errno) in __init_tls abort messages. Bug: http://b/66911122 Bug: 64709603 (presubmit balking at the line above) Test: ran tests Change-Id: I068a388f8ea31012e7e07e8bded1c113796a8440 Merged-In: I068a388f8ea31012e7e07e8bded1c113796a8440 --- diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp index 9197aa3fe..ff972c3ec 100644 --- a/libc/bionic/pthread_create.cpp +++ b/libc/bionic/pthread_create.cpp @@ -59,13 +59,13 @@ void __init_tls(pthread_internal_t* thread) { size_t allocation_size = BIONIC_TLS_SIZE + 2 * PAGE_SIZE; void* allocation = mmap(nullptr, allocation_size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (allocation == MAP_FAILED) { - async_safe_fatal("failed to allocate TLS"); + async_safe_fatal("failed to allocate TLS: %s", strerror(errno)); } prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, allocation, allocation_size, "bionic TLS guard page"); thread->bionic_tls = reinterpret_cast(static_cast(allocation) + PAGE_SIZE); if (mprotect(thread->bionic_tls, BIONIC_TLS_SIZE, PROT_READ | PROT_WRITE) != 0) { - async_safe_fatal("failed to mprotect TLS"); + async_safe_fatal("failed to mprotect TLS: %s", strerror(errno)); } prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, thread->bionic_tls, BIONIC_TLS_SIZE, "bionic TLS"); }