- 12 Feb, 2013 1 commit
-
-
Elliott Hughes authored
This reverts commit 2a1bb4e6 Change-Id: Ia443d0748015c8e9fc3121e40e68258616767b51
-
- 11 Feb, 2013 4 commits
-
-
Elliott Hughes authored
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
-
Elliott Hughes authored
This reverts commit 6260553d (Removing the accidental libm/Android.mk change.) Change-Id: I6cddd9857c31facc05636e8221505b3d2344cb75
-
Elliott Hughes authored
This reverts commit ad59322a somehow my unfinished libm/Android.mk change got into here. Change-Id: I46be626c5269d60fb1ced9862f2ebaa380b4e0af
-
Elliott Hughes authored
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
-
- 08 Feb, 2013 1 commit
-
-
Elliott Hughes authored
Bug: 7959813 Change-Id: I8db4b8912ba649bfe668c6f22aa44690ddd401a2
-
- 07 Feb, 2013 1 commit
-
-
Elliott Hughes authored
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
-
- 22 Jan, 2013 1 commit
-
-
Nick Kralevich authored
Both libc/include/sys/auxv.h and libc/private/bionic_auxv.h use _SYS_AUXV_H_ to see if a header file has already been included. This prevents both of these files from being included at the same time. Fix this name conflict. Change-Id: Ifaec88aa9779d784b95f8e75145117acf3d5cfc5
-
- 19 Jan, 2013 1 commit
-
-
Elliott Hughes authored
We had two copies of the backtrace code, and two copies of the libcorkscrew /proc/pid/maps code. This patch gets us down to one. We also had hacks so we could log in the malloc debugging code. This patch pulls the non-allocating "printf" code out of the dynamic linker so everyone can share. This patch also makes the leak diagnostics easier to read, and makes it possible to paste them directly into the 'stack' tool (by using relative PCs). This patch also fixes the stdio standard stream leak that was causing a leak warning every time tf_daemon ran. Bug: 7291287 Change-Id: I66e4083ac2c5606c8d2737cb45c8ac8a32c7cfe8
-
- 16 Jan, 2013 2 commits
-
-
Nick Kralevich authored
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 e3a49a86. Change-Id: I05c58a896b1fe32cfb5d95d43b096045cda0aa4a
-
Nick Kralevich authored
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
-
- 15 Jan, 2013 1 commit
-
-
Elliott Hughes authored
This reverts commit f4b34b6c. The revert was only meant to apply to the jb-mr1 branch, but accidentally leaked out into AOSP. This revert-revert gets AOSP master and internal master back in sync.
-
- 11 Jan, 2013 1 commit
-
-
Nick Kralevich authored
Add support for getauxval(). This method allows a program an easy way to retrieve information from the kernel auxiliary vector, and will hopefully replace other clumsy ways of accessing this same information. This particular function was also added to glibc in glibc 2.16. See the following URLs for more details. * http://lwn.net/Articles/519085/ * http://www.gnu.org/software/libc/manual/html_node/Auxiliary-Vector.html This change is a prerequisite for bug 7959813. Bug: http://code.google.com/p/android/issues/detail?id=38441 Change-Id: Iba19d899df334bddc6f4899077ece2fc87564ea8
-
- 10 Jan, 2013 1 commit
-
-
Elliott Hughes authored
Change-Id: I377522fcba6fb4b5fd2754ab15b091014bd7c16f
-
- 04 Dec, 2012 1 commit
-
-
Nick Kralevich authored
Avoid duplicating huge chunks of code. Change-Id: Id6145cdfce781c5ffba2abaaa79681d25a7ab28f
-
- 30 Nov, 2012 1 commit
-
-
Nick Kralevich authored
Detect when strchr reads off the end of a buffer. Change-Id: I0e952eedcff5c36d646a9c3bc4e1337b959224f2
-
- 25 Oct, 2012 1 commit
-
-
Elliott Hughes authored
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
-
- 23 Oct, 2012 1 commit
-
-
Elliott Hughes authored
Change-Id: Idb781d37de3b05585271d7d258ecffd5ba87d0b8
-
- 16 Oct, 2012 1 commit
-
-
Elliott Hughes authored
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
-
- 11 Oct, 2012 1 commit
-
-
Elliott Hughes authored
Add unit tests for dlerror(3) in various situations. I think We're at least as good as glibc now. Also factor out the ScopedPthreadMutexLock and use it here too. Bug: http://code.google.com/p/android/issues/detail?id=38398 Change-Id: I040938b4366ab836e3df46d1d8055b92f4ea6ed8
-
- 01 Oct, 2012 1 commit
-
-
Elliott Hughes authored
Also add basic unit tests. Change-Id: I7fc7ef61d47c1e8fdf8b8eff67a635220c3afd56
-
- 24 Sep, 2012 1 commit
-
-
Elliott Hughes authored
This reverts commit 3a936a49. We don't want this in jb-mr1.
-
- 11 Sep, 2012 1 commit
-
-
Elliott Hughes authored
Bug: 7012465 Change-Id: Ib66f061e29199ba134545111dc79f9b50c8f4a21
-
- 07 Sep, 2012 1 commit
-
-
Andrew Hsieh authored
Also chang libc/arch-arm/bionic/crtbegin_so.c to include it as a header. Change-Id: Ib91b0b8caf5c8b936425aa8a4fc1a229b2b27929
-
- 28 Aug, 2012 1 commit
-
-
Ard Biesheuvel authored
To properly support legacy ARM shared libraries, libc.so needs to export the symbols __dso_handle and atexit, even though these are now supplied by the crt startup code. This patch reshuffles the existing CRT_LEGACY_WORKAROUND conditionally compiled code slightly so it works as the original author likely intended. Change-Id: Id6c0e94dc65b7928324a5f0bad7eba6eb2f464b9 Signed-off-by:
Ard Biesheuvel <ard.biesheuvel@gmail.com>
-
- 07 Aug, 2012 1 commit
-
-
Elliott Hughes authored
Also make the errors more readable, since none of us seemed to know what they actually meant. The new style is still as verbose as the old, but that's probably necessary in the absence of chained exceptions in C. Here's what you'd see if you try to boot after removing libsurfaceflinger.so: 32267 32267 E AndroidRuntime: java.lang.UnsatisfiedLinkError: Cannot load library: (linker.c:1629, pid 32259) soinfo_link_image: could not load library "libsystem_server.so" needed by "libandroid_servers.so"; caused by (linker.c:1629, pid 32259) soinfo_link_image: could not load library "libsurfaceflinger.so" needed by "libsystem_server.so"; caused by (linker.c:709, pid 32259) load_library: library "libsurfaceflinger.so" not found This patch also fixes almost all of the compiler warnings. Change-Id: I64bb59aed6d4e039c15ea45be2367f319ef879f8
-
- 02 Aug, 2012 1 commit
-
-
Raghu Gandham authored
Change-Id: I6b5194e5e379b573e3b1203d8015e20fb3edd647 Signed-off-by:
Chris Dearman <chris@mips.com>
-
- 27 Jul, 2012 1 commit
-
-
Elliott Hughes authored
In particular this affects assert(3) and __cxa_pure_virtual, both of which have managed to confuse people this week by apparently aborting without reason. (Because stderr goes nowhere, normally.) Bug: 6852995 Bug: 6840813 Change-Id: I7f5d17d5ddda439e217b7932096702dc013b9142
-
- 24 Jul, 2012 2 commits
-
-
Chris Dearman authored
Change-Id: Ie1ea5aacc561e2d6d40125d2952ed0e9116b7b0d
-
Raghu Gandham authored
Change-Id: I2cb20ce44dd230d222b7fc1ede2e1e3dce6e692b
-
- 11 Jun, 2012 1 commit
-
-
Geremy Condra authored
Change-Id: I3bf4fa8678c33187cb8ce4b75e666ddcd24403ab
-
- 08 Jun, 2012 1 commit
-
-
Geremy Condra authored
I've basically just copied the relevant bits out of liblog and EventLog.cpp. While this will let us do the uid logging we want to address the concerns in 245c07027f78565858dd489eb0d94c3d48743e9d it doesn't give us much else. Change-Id: Icac6ff20bc0a3ade5927f6f76fedffe1ae6f8522
-
- 01 Jun, 2012 1 commit
-
-
Nick Kralevich authored
Rewrite crtbegin.S -> crtbegin.c crtbegin_so.S -> crtbegin_so.c This change allows us to generate PIC code without relying on text relocations. As a consequence of this rewrite, also rewrite __dso_handle.S -> __dso_handle.c __dso_handle_so.S -> __dso_handle_so.c atexit.S -> atexit.c In crtbegin.c _start, place the __PREINIT_ARRAY__, __INIT_ARRAY__, __FINI_ARRAY__, and __CTOR_LIST__ variables onto the stack, instead of passing a pointer to the text section of the binary. This change appears sorta wonky, as I attempted to preserve, as much as possible, the structure of the original assembly. As a result, you have C files including other C files, and other programming uglyness. Result: This change reduces the number of files with text-relocations from 315 to 19 on my Android build. Before: $ scanelf -aR $OUT/system | grep TEXTREL | wc -l 315 After: $ scanelf -aR $OUT/system | grep TEXTREL | wc -l 19 Change-Id: Ib9f98107c0eeabcb606e1ddc7ed7fc4eba01c9c4
-
- 07 May, 2012 1 commit
-
-
Mattias Falk authored
If two or more rapid dns requests for the same server are done from different threads it turns into separate dns reques, if the response of the request isn't found in the cache. This patch avoid multiple request for the same server by letting subsequents request wait until the first request has finished. Change-Id: Ic72ea0e7d3964a4164eddf866feb4357ec4dfe54
-
- 12 Apr, 2012 1 commit
-
-
Evgeniy Stepanov authored
Since e19d702b, 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
-
- 26 Mar, 2012 1 commit
-
-
Jean-Baptiste Queru authored
First commit: Revert "Revert "am be741d47: am 2f460fbe: am 73b5cad9: Merge "bionic: Fix wrong kernel_id in pthread descriptor after fork()""" This reverts commit 06823da2. Second commit: bionic: fix atfork hanlder_mutex deadlock This cherry-picks commit 34e89c23 After applying the kernel_id fix, the system refused to boot up and we got following crash log: I/DEBUG ( 113): pid: 618, tid: 618 >>> org.simalliance.openmobileapi.service:remote <<< I/DEBUG ( 113): signal 16 (SIGSTKFLT), code -6 (?), fault addr -------- I/DEBUG ( 113): eax fffffe00 ebx b77de994 ecx 00000080 edx 00724002 I/DEBUG ( 113): esi 00000000 edi 00004000 I/DEBUG ( 113): xcs 00000073 xds 0000007b xes 0000007b xfs 00000000 xss 0000007b I/DEBUG ( 113): eip b7761351 ebp bfdf3de8 esp bfdf3dc4 flags 00000202 I/DEBUG ( 113): #00 eip: 00015351 /system/lib/libc.so I/DEBUG ( 113): #01 eip: 0000d13c /system/lib/libc.so (pthread_mutex_lock) I/DEBUG ( 113): #02 eip: 00077b48 /system/lib/libc.so (__bionic_atfork_run_prepare) I/DEBUG ( 113): #03 eip: 00052cdb /system/lib/libc.so (fork) I/DEBUG ( 113): #04 eip: 0009ae91 /system/lib/libdvm.so (_Z18dvmOptimizeDexFileillPKcjjb) I/DEBUG ( 113): #05 eip: 000819d6 /system/lib/libdvm.so (_Z14dvmJarFileOpenPKcS0_PP7JarFileb) I/DEBUG ( 113): #06 eip: 000b175e /system/lib/libdvm.so (_ZL40Dalvik_dalvik_system_DexFile_openDexFilePKjP6JValue) I/DEBUG ( 113): #07 eip: 0011fb94 /system/lib/libdvm.so Root cause: The atfork uses the mutex handler_mutex to protect the atfork_head. The parent will call __bionic_atfork_run_prepare() to lock the handler_mutex, and need both the parent and child to unlock their own copy of handler_mutex after fork. At that time, the owner of hanlder_mutex is set as the parent. If we apply the kernel_id fix, then the child's kernel_id will be set as child's tid. The handler_mutex is a recursive lock, and pthread_mutex_unlock(&hander_mutex) will fail because the mutex owner is the parent, while the current tid (__get_thread()->kernel_id) is child, not matched with the mutex owner. At that time, the handler_mutex is left in lock state.If the child wants to fork other process after than, then it will try to lock handler_mutex, and then be deadlocked. Fix: Since the child has its own copy of vm space from the the parent, the child space's handler_mutex should be reset to the initialized state. Change-Id: I3907dd9a153418fb78862f2aa6d0302c375d9e27 Signed-off-by:
Jack Ren <jack.ren@intel.com> Signed-off-by:
Chenyang Du <chenyang.du@intel.com> Signed-off-by:
Bruce Beare <bruce.j.beare@intel.com> Change-Id: Ic8072f366a877443a60fe215f3c00b3df5a259c8
-
- 13 Mar, 2012 1 commit
-
- 12 Mar, 2012 1 commit
-
-
Jack Ren authored
After forking, the kernel_id field in the phtread_internal_t returned by pthread_self() is incorrect --- it's the tid from the parent, not the new tid of the child. The root cause is that: currently the kernel_id is set by _init_thread(), which is called in 2 cases: (1) called by __libc_init_common(). That happens when the execv( ) is called after fork( ). But when the zygote tries to fork the android application, the child application doesn't call execv( ), instread, it tries to call the Java main method directly. (2) called by pthread_create(). That happens when a new thread is created. For the lead thread which is the thread created by fork(), it should call execv() but it doesn't, as described in (1) above. So its kernel_id will inherit the parent's kernel_id. Fixed it in this patch. Change-Id: I63513e82af40ec5fe51fbb69456b1843e4bc0fc7 Signed-off-by:
Chenyang Du <chenyang.du@intel.com> Signed-off-by:
Jack Ren <jack.ren@intel.com> Signed-off-by:
Bruce Beare <bruce.j.beare@intel.com>
-
- 13 Jan, 2012 1 commit
-
-
David 'Digit' Turner authored
This patch is the first in a series that aims at cleaning up the public C library headers (which end up being distributed with the NDK). <resolv.h> and <time.h> contain declarations that should not be public. They are used by other parts of the platform, but NDK applications should not use or rely on them. So copy them to private <bionic_time.h> and <resolv_iface.h> headers and use a guard macro to avoid conflicts when both headers are included at the same time. The idea is that we're going to fix the other platform modules to include these private headers. After this is done, we will remove the duplicate definitions from <resolv.h> and <time.h> Change-Id: I121c11936951c98ca7165e811126ed8a4a3a394d
-
- 16 Nov, 2011 1 commit
-
-
David 'Digit' Turner authored
We're going to modify the __atomic_xxx implementation to provide full memory barriers, to avoid problems for NDK machine code that link to these functions. First step is to remove their usage from our platform code. We now use inlined versions of the same functions for a slight performance boost. + remove obsolete atomics_x86.c (was never compiled) NOTE: This improvement was benchmarked on various devices. Comparing a pthread mutex lock + atomic increment + unlock we get: - ARMv7 emulator, running on a 2.4 GHz Xeon: before: 396 ns after: 288 ns - x86 emulator in KVM mode on same machine: before: 27 ns after: 27 ns - Google Nexus S, in ARMv7 mode (single-core): before: 82 ns after: 76 ns - Motorola Xoom, in ARMv7 mode (multi-core): before: 121 ns after: 120 ns The code has also been rebuilt in ARMv5TE mode for correctness. Change-Id: Ic1dc72b173d59b2e7af901dd70d6a72fb2f64b17
-