summaryrefslogtreecommitdiffstats
path: root/libc/private
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-12-18 13:36:25 -0800
committerElliott Hughes <enh@google.com>2014-12-18 15:01:10 -0800
commit7874f1d7182d80eb72c699eaa9ab8cc4cfec95ab (patch)
tree4348cc097c742280038ff78b454d6cd513cd619e /libc/private
parent9dd5ab46194a3ef7992b0c08d18f2e30551f9331 (diff)
downloadbionic-7874f1d7182d80eb72c699eaa9ab8cc4cfec95ab.zip
bionic-7874f1d7182d80eb72c699eaa9ab8cc4cfec95ab.tar.gz
bionic-7874f1d7182d80eb72c699eaa9ab8cc4cfec95ab.tar.bz2
Split the shared group data from the shared passwd data.
Found by the toybox id(1) which calls both getpwuid(3) and getgrgid(3) before looking at either result. The use of a shared buffer in this code meant that even on a single thread, the data for any of the passwd functions would be clobbered by the data for any of the group functions (or vice versa). This might seem like an insufficient fix, but POSIX explicitly says (for getpwnam) that the result "might be overwritten by a subsequent call to getpwent(), getpwnam(), or getpwuid()" and likewise for other members of that group, plus equivalent text for the group-related functions. Change-Id: I2272f47e91f72e043fdaf7c169fa9f6978ff4370
Diffstat (limited to 'libc/private')
-rw-r--r--libc/private/bionic_tls.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/libc/private/bionic_tls.h b/libc/private/bionic_tls.h
index 4a35166..944f957 100644
--- a/libc/private/bionic_tls.h
+++ b/libc/private/bionic_tls.h
@@ -85,7 +85,8 @@ enum {
* ttyname libc (GLOBAL_INIT_THREAD_LOCAL_BUFFER)
* strerror libc (GLOBAL_INIT_THREAD_LOCAL_BUFFER)
* strsignal libc (GLOBAL_INIT_THREAD_LOCAL_BUFFER)
- * stubs libc (GLOBAL_INIT_THREAD_LOCAL_BUFFER)
+ * passwd libc (GLOBAL_INIT_THREAD_LOCAL_BUFFER)
+ * group libc (GLOBAL_INIT_THREAD_LOCAL_BUFFER)
* _res_key libc
* je_thread_allocated_tsd jemalloc
* je_arenas_tsd jemalloc
@@ -95,7 +96,7 @@ enum {
*
*/
-#define LIBC_TLS_RESERVED_SLOTS 11
+#define LIBC_TLS_RESERVED_SLOTS 12
#if defined(USE_JEMALLOC)
/* jemalloc uses 5 keys for itself. */