03eebcb6e8762e668a0d3af6bb303cccb88c5b81 |
|
13-Jun-2014 |
Christopher Ferris <cferris@google.com> |
Move common macros into bionic_macros.h. Bug: 15590152 Change-Id: I730636613ef3653f68c5ab1d43b53beaf8e0dc25
|
b30aff405a220495941f1673b0a5e66c4fa8b84c |
|
28-May-2014 |
Elliott Hughes <enh@google.com> |
Revert "Revert "Lose the hand-written futex assembler."" The problem with the original patch was that using syscall(3) means that errno can be set, but pthread_create(3) was abusing the TLS errno slot as a pthread_mutex_t for the thread startup handshake. There was also a mistake in the check for syscall failures --- it should have checked against -1 instead of 0 (not just because that's the default idiom, but also here because futex(2) can legitimately return values > 0). This patch stops abusing the TLS errno slot and adds a pthread_mutex_t to pthread_internal_t instead. (Note that for LP64 sizeof(pthread_mutex_t) > sizeof(uintptr_t), so we could potentially clobber other TLS slots too.) I've also rewritten the LP32 compatibility stubs to directly reuse the code from the .h file. This reverts commit 75c55ff84ebfa686c7ae2cc8ee431c6a33bd46b4. Bug: 15195455 Change-Id: I6ffb13e5cf6a35d8f59f692d94192aae9ab4593d
|
72bbd423579bb971dc06cdd3c06201faf3fe95e6 |
|
08-May-2014 |
Christopher Ferris <cferris@google.com> |
Support for jemalloc to replace dlmalloc. To use jemalloc, add MALLOC_IMPL = jemalloc in a board config file and you get the new version automatically. Update the pthread_create_key tests since jemalloc uses a few keys. Add a new test to verify memalign works as expected. Bug: 981363 Change-Id: I16eb152b291a95bd2499e90492fc6b4bd7053836
|
2f68866f371faa8ef727fc91e59e1e93326a3949 |
|
18-Apr-2014 |
Elliott Hughes <enh@google.com> |
Make uselocale(3) claim its pthread key in an ELF constructor. pthread_once is nice for decoupling, but it makes resource availability less predictable, which is a bad thing. This fixes a test failure if uselocale(3) is called before pthread.pthread_key_create_lots runs. Change-Id: Ie2634f986a50e7965582d4bd6e5aaf48cf0d55c8
|
1887621de8a48eece8a05f2400ddd783b9833147 |
|
12-Dec-2013 |
Elliott Hughes <enh@google.com> |
PTHREAD_KEYS_MAX cleanup. I fixed this bug a while back, but didn't remove it from the list, could have added a better test, and could have written clearer code that didn't require a comment. Change-Id: Iebdf0f9a54537a7d5cbca254a5967b1543061f3d
|
877ec6d90418ff1d6597147d355a2229fdffae7e |
|
16-Nov-2013 |
Elliott Hughes <enh@google.com> |
Fix pthread_join. Let the kernel keep pthread_internal_t::tid updated, including across forks and for the main thread. This then lets us fix pthread_join to only return after the thread has really exited. Also fix the thread attributes of the main thread so we don't unmap the main thread's stack (which is really owned by the dynamic linker and contains things like environment variables), which fixes crashes when joining with an exited main thread and also fixes problems reported publicly with accessing environment variables after the main thread exits (for which I've added a new unit test). In passing I also fixed a bug where if the clone(2) inside pthread_create(3) fails, we'd unmap the child's stack and TLS (which contains the mutex) and then try to unlock the mutex. Boom! It wasn't until after I'd uploaded the fix for this that I came across a new public bug reporting this exact failure. Bug: 8206355 Bug: 11693195 Bug: https://code.google.com/p/android/issues/detail?id=57421 Bug: https://code.google.com/p/android/issues/detail?id=62392 Change-Id: I2af9cf6e8ae510a67256ad93cad891794ed0580b
|
70b24b1cc2a1a4436b1fea3f8b76616fdcb27224 |
|
15-Nov-2013 |
Elliott Hughes <enh@google.com> |
Switch pthread_create over to __bionic_clone. Bug: 8206355 Bug: 11693195 Change-Id: I04aadbc36c87e1b7e33324b9a930a1e441fbfed6
|
2a0b873065edb304fa2d1c54f8de663ea638b8ab |
|
09-Oct-2013 |
Elliott Hughes <enh@google.com> |
Fix __errno for LP64 and clean up __get_tls. If __get_tls has the right type, a lot of confusing casting can disappear. It was probably a mistake that __get_tls was exposed as a function for mips and x86 (but not arm), so let's (a) ensure that the __get_tls function always matches the macro, (b) that we have the function for arm too, and (c) that we don't have the function for any 64-bit architecture. Change-Id: Ie9cb989b66e2006524ad7733eb6e1a65055463be
|
21e71643351c2c296220018a20b1499ba690b8e7 |
|
07-Oct-2013 |
Elliott Hughes <enh@google.com> |
Fix MIPS build. Although 'register' is deprecated, we need to use v1, and there's no way to do that through register constraints on the assembler fragment itself. Change-Id: Ib5b12c4c3652513d10cc61d4a4b11314ece25663
|
baa5874404351b606c29239606db00f8903e8ece |
|
06-Oct-2013 |
synergydev <synergye@codefi.re> |
libc: Remove deprecated register In c++11, register has been deprecated, and libc is now built as gnu++11 From the documentation: A register specifier is a hint to the implementation that the variable so declared will be heavily used. [ Note: The hint can be ignored and in most implementations it will be ignored if the address of the variable is taken. This use is deprecated (see D.2) Change-Id: I459dc3f5f9de63fc09eeda3bc6700f31bdf20f6f
|
1e52a54a47c00af689b7d8d503c4d69e53ae26fc |
|
20-Sep-2013 |
Pavel Chupin <pavel.v.chupin@intel.com> |
x86_64: Fix get_tls and statvfs * bionic_tls.h - Add x86_64 version of get_tls macro; * statvfs.h - 64-bit kernels don't have __statfs64/__fstatfs64, applying workaround; Change-Id: I20d7ddad74c7b7243866373d0142da6627c08280 Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
|
edad1e1558bf5a561ffb33c5bf5ca0553711e1ee |
|
18-Sep-2013 |
Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org> |
Fix mismatch between declaration and forward declaration KernelArgumentBlock is defined as a class in KernelArgumentBlock.h, but forward declarations refer to it as a struct. While this is essentially the same, the mismatch causes a compiler warning in clang (and may cause warnings in future versions of gcc) in code that is supposed to be compiled with -Werror. Change-Id: I4ba49d364c44d0a42c276aff3a8098300dbdcdf0 Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
|
c03e1e74390c1b8a30341399cd85cc869d0842b0 |
|
30-Jul-2013 |
Elliott Hughes <enh@google.com> |
Define PTHREAD_KEYS_MAX and _POSIX_THREAD_KEYS_MAX in a POSIX-compliant way. Also make sysconf use PTHREAD_STACK_MIN rather than redefining its own, different, constant. Bug: 9997352 Change-Id: I9a8e7d2b18e691439abfb45533e82c36eee9e81d
|
838f01fdc7cbb8fa2449d5c799e24d92f25d3881 |
|
25-Jul-2013 |
Elliott Hughes <enh@google.com> |
Bump the number of TLS slots to 128. Bug: 9997352 Change-Id: I7bde7228d803e9d4bb83309c5891d54a07e3b025
|
d4e753fea9345c24dcce89531dff9019bef14eb3 |
|
16-Jul-2013 |
Elliott Hughes <enh@google.com> |
Clean up __builtin_expect usage. Also remove some dead code; our malloc debugging doesn't use this any more. Change-Id: Id69cf182371f5f37d40b5bbd08f2744ade286e66
|
a33dc57c7c2b181cf7e76d843f8b031dbb6d4fa8 |
|
18-Jun-2013 |
Elliott Hughes <enh@google.com> |
Always use v1 for MIPS TLS access. Change-Id: Ic2850b90185cfbc5b0eff804c8b74a1c553c0852
|
b6e340080a86e14273b3b3a4bad694e4d9b3c8c2 |
|
15-Jun-2013 |
Mathias Agopian <mathias@google.com> |
don't hardcode register r0/v1 when reading the TLS this leads to much improved code when calling __get_tls() Change-Id: I21d870fb33c33a921ca55c4e100772e0f7a8d1e4
|
ce532721aaf61d4b6a171903c851ac82adf08aa8 |
|
16-Mar-2013 |
Elliott Hughes <enh@google.com> |
Hide various symbols that shouldn't be exposed. A mangled symbol in libc.so is a symbol that shouldn't be exported by libc.so. Change-Id: Id92d1e1968b3d11d111a5d9ef692adb1ac7694a1
|
40eabe24e4e3ae8ebe437f1f4e43cf39cbba2e9e |
|
15-Feb-2013 |
Elliott Hughes <enh@google.com> |
Fix the pthread_setname_np test. Fix the pthread_setname_np test to take into account that emulator kernels are so old that they don't support setting the name of other threads. The CLONE_DETACHED thread is obsolete since 2.5 kernels. Rename kernel_id to tid. Fix the signature of __pthread_clone. Clean up the clone and pthread_setname_np implementations slightly. Change-Id: I16c2ff8845b67530544bbda9aa6618058603066d
|
91a9925998f2b878f0245ce03aab22cc412a4d8b |
|
13-Feb-2013 |
Elliott Hughes <enh@google.com> |
Everyone has a TLS register. Change-Id: Id7cdf67087aa7d5074c9c59b7e595bc391d9f146
|
3e898476c7230b60a0f76968e64ff25f475b48c0 |
|
12-Feb-2013 |
Elliott Hughes <enh@google.com> |
Revert "Revert "More pthreads cleanup."" This reverts commit 6f94de3ca49e4ea147b1c59e5818fa175846518f (Doesn't try to increase the number of TLS slots; that leads to an inability to boot. Adds more tests.) Change-Id: Ia7d25ba3995219ed6e686463dbba80c95cc831ca
|
6f94de3ca49e4ea147b1c59e5818fa175846518f |
|
12-Feb-2013 |
Elliott Hughes <enh@google.com> |
Revert "More pthreads cleanup." This reverts commit 2a1bb4e64677b9abbc17173c79768ed494565047 Change-Id: Ia443d0748015c8e9fc3121e40e68258616767b51
|
2a1bb4e64677b9abbc17173c79768ed494565047 |
|
11-Feb-2013 |
Elliott Hughes <enh@google.com> |
More pthreads cleanup. POSIX says pthread_create returns EAGAIN, not ENOMEM. Also pull pthread_attr_t functions into their own file. Also pull pthread_setname_np into its own file. Also remove unnecessary #includes from pthread_key.cpp. Also account for those pthread keys used internally by bionic, so they don't count against the number of keys available to user code. (They do with glibc, but glibc's limit is the much more generous 1024.) Also factor out the common errno-restoring idiom to reduce gotos. Bug: 6702535 Change-Id: I555e66efffcf2c1b5a2873569e91489156efca42
|
44b53ad6818de344e0b499ad8fdbb21fcb0ff2b6 |
|
11-Feb-2013 |
Elliott Hughes <enh@google.com> |
Revert "Revert "Pull the pthread_key_t functions out of pthread.c."" This reverts commit 6260553d48f6fd87ca220270bea8bafdde5726ec (Removing the accidental libm/Android.mk change.) Change-Id: I6cddd9857c31facc05636e8221505b3d2344cb75
|
6260553d48f6fd87ca220270bea8bafdde5726ec |
|
11-Feb-2013 |
Elliott Hughes <enh@google.com> |
Revert "Pull the pthread_key_t functions out of pthread.c." This reverts commit ad59322ae432d11ff36dcf046016af8cfe45fbe4 somehow my unfinished libm/Android.mk change got into here. Change-Id: I46be626c5269d60fb1ced9862f2ebaa380b4e0af
|
ad59322ae432d11ff36dcf046016af8cfe45fbe4 |
|
09-Feb-2013 |
Elliott Hughes <enh@google.com> |
Pull the pthread_key_t functions out of pthread.c. This was originally motivated by noticing that we were setting the wrong bits for the well-known tls entries. That was a harmless bug because none of the well-known tls entries has a destructor, but it's best not to leave land mines lying around. Also add some missing POSIX constants, a new test, and fix pthread_key_create's return value when we hit the limit. Change-Id: Ife26ea2f4b40865308e8410ec803b20bcc3e0ed1
|
d3920b3a996b358e48232f417aa0a1e44a60f155 |
|
08-Feb-2013 |
Elliott Hughes <enh@google.com> |
Switch to using AT_RANDOM for the stack guards. Bug: 7959813 Change-Id: I8db4b8912ba649bfe668c6f22aa44690ddd401a2
|
42b2c6a5eed5e4ef35315b8cd32d1355f12a69b6 |
|
07-Feb-2013 |
Elliott Hughes <enh@google.com> |
Clean up the argc/argv/envp/auxv handling. There's now only one place where we deal with this stuff, it only needs to be parsed once by the dynamic linker (rather than by each recipient), and it's now easier for us to get hold of auxv data early on. Change-Id: I6314224257c736547aac2e2a650e66f2ea53bef5
|
36bd371e26c716cbc18e11801b13eff0352d91b0 |
|
16-Jan-2013 |
Nick Kralevich <nnk@google.com> |
Revert "stack protector: use AT_RANDOM" The AT_RANDOM changes broke setuid / setgid executables such as "ping". When the linker executes a setuid program, it cleans the environment, removing any invalid environment entries, and adding "NULL"s to the end of the environment array for each removed variable. Later on, we try to determine the location of the aux environment variable, and get tripped up by these extra NULLs. Reverting this patch will get setuid executables working again, but getauxval() is still broken for setuid programs because of this bug. This reverts commit e3a49a8661125f24aec8a1453e54b3b78005e21e. Change-Id: I05c58a896b1fe32cfb5d95d43b096045cda0aa4a
|
e3a49a8661125f24aec8a1453e54b3b78005e21e |
|
14-Jan-2013 |
Nick Kralevich <nnk@google.com> |
stack protector: use AT_RANDOM Populate the stack canaries from the kernel supplied AT_RANDOM value, which doesn't involve any system calls. This is slightly faster (6 fewer syscalls) and avoids unnecessarily reading /dev/urandom, which depletes entropy. Bug: 7959813 Change-Id: If2b43100a2a9929666df3de56b6139fed969e0f1
|
ad88a0863110798cef5169dcf917e18b967a7cf6 |
|
25-Oct-2012 |
Elliott Hughes <enh@google.com> |
Per-thread -fstack-protector guards for x86. Based on a pair of patches from Intel: https://android-review.googlesource.com/#/c/43909/ https://android-review.googlesource.com/#/c/44903/ For x86, this patch supports _both_ the global that ARM/MIPS use and the per-thread TLS entry (%gs:20) that GCC uses by default. This lets us support binaries built with any x86 toolchain (right now, the NDK is emitting x86 code that uses the global). I've also extended the original tests to cover ARM/MIPS too, and be a little more thorough for x86. Change-Id: I02f279a80c6b626aecad449771dec91df235ad01
|
5419b9474753d25dff947c7740532f86d130c0be |
|
17-Oct-2012 |
Elliott Hughes <enh@google.com> |
Make dlerror(3) thread-safe. I gave up trying to use the usual thread-local buffer idiom; calls to calloc(3) and free(3) from any of the "dl" functions -- which live in the dynamic linker -- end up resolving to the dynamic linker's stubs. I tried to work around that, but was just making things more complicated. This alternative costs us a well-known TLS slot (instead of the dynamically-allocated TLS slot we'd have used otherwise, so no difference there), plus an extra buffer inside every pthread_internal_t. Bug: 5404023 Change-Id: Ie9614edd05b6d1eeaf7bf9172792d616c6361767
|
1c303981431e3b8542a874370971d50687c6e11a |
|
03-Aug-2012 |
Raghu Gandham <raghu@mips.com> |
[MIPS] Support for TLS register Change-Id: I6b5194e5e379b573e3b1203d8015e20fb3edd647 Signed-off-by: Chris Dearman <chris@mips.com>
|
1a78fbb5c8228e4aea2a516818828b76044310f2 |
|
22-Mar-2012 |
Evgeniy Stepanov <eugenis@google.com> |
Initialize TLS before any application code is run. Since e19d702b8e33, dlsym and friends use recursive mutexes that require the current thread id, which is not available before the libc constructor. This prevents us from using dlsym() in .preinit_array. This change moves TLS initialization from libc constructor to the earliest possible point - immediately after linker itself is relocated. As a result, pthread_internal_t for the initial thread is available from the start. As a bonus, values stored in TLS in .preinit_array are not lost when libc is initialized. Change-Id: Iee5a710ee000173bff63e924adeb4a4c600c1e2d
|
6a51defa034a1c033ed01f7de444c0a4fc615249 |
|
27-Aug-2010 |
David 'Digit' Turner <digit@google.com> |
Fix __get_tls() in static C library to use kernel helpers. This is needed to fix gdbserver's handling of threaded programs, among other things. Change-Id: I823387c602cef9891532da946a01db14be780ab0
|
194d3fa048cf909ca592dd56fa538dc9cd3f5ddb |
|
13-Nov-2009 |
Jean-Baptiste Queru <jbq@google.com> |
eclair snapshot
|
4a05d12cf52a9a40759f11f28543bd75715c8f00 |
|
18-Sep-2009 |
David 'Digit' Turner <digit@google.com> |
Fix TLS access for ARMv6 and beyond. For performance reasons, we don't call the kernel helper. Instead, we directly access the TLS register on ARMv6 and higher. For ARMv5TE, keep using the hard-coded address populated by the kernel on each task switch. NOTE: Since we don't call the kernel helper, this must precisely match your kernel configuration. This is controlled by setting the ARCH_ARM_HAVE_TLS_REGISTER variable to 'true' in your board configuration file.
|
a246a71975c1b4a939421ed20fdd8557f93de46f |
|
04-Aug-2009 |
vinay harugop <vinay.harugop@stericsson.com> |
Linux kernel helpers support is provided to android for its TLS implementation. This fix addresses this by modifying the TLS access functions to use the kernel helper. This Fix is verified on ST Ericsson's U8500 platform and Submitted on behalf of a third-party: Surinder-pal SINGH from STMicroelectronics.
|
ef0bd1857041ffde069cf52138aaf22c1af7130e |
|
17-Jul-2009 |
David 'Digit' Turner <digit@google.com> |
Pass the elfdata pointer in a slot of the temporary TLS area. This is needed to properly initialize the C runtime when libc.so is loaded by the dynamic linker. Move the temporary TLS setup before the first system call, just in case something really horrible happens, we won't crash when trying to write an error code in 'errno' Remove the broken TLS_SLOT_THREAD_ID setup. First, this slot should normally receive the address of a pthread_internal_t, not a kernel thread identifier. Second, it is never used by the linker anyway. Also remove an obsolete comment.
|
1dc9e472e19acfe6dc7f41e429236e7eef7ceda1 |
|
04-Mar-2009 |
The Android Open Source Project <initial-contribution@android.com> |
auto import from //depot/cupcake/@135843
|
1767f908af327fa388b1c66883760ad851267013 |
|
04-Mar-2009 |
The Android Open Source Project <initial-contribution@android.com> |
auto import from //depot/cupcake/@135843
|
e5cc1f386b167b9f7bfdebc7219e89aa9b71e4b2 |
|
16-Jan-2009 |
The Android Open Source Project <initial-contribution@android.com> |
auto import from //branches/cupcake/...@126645
|