summaryrefslogtreecommitdiffstats
path: root/libc/bionic
Commit message (Collapse)AuthorAgeFilesLines
* bionic: Add flag to restore legacy mmap behaviorFlemmard2015-10-191-1/+6
| | | | | | | | | | * Pre-lollipop mmap would not care whether offset was signed or unsigned. * Lollipop adds 64-bit support which results in sign extension of offset, causing a negative offset when a positive offset > 2^31 is given. Change-Id: I5d19d898fc131cf848217974915d1b466a474f99
* bionic: Detect userspace memory leakMaunik Shah2015-10-062-2/+151
| | | | | | | | | | | | | When process is consuming memory beyond the limit specified by property, it will print all the allocations of the same process. To enable this feature, do following steps: 1. libc.debug.malloc 40 2. libc.debug.malloc.program <PROCESS_NAME> 3. libc.debug.malloc.maxprocsize <VALUE_IN_BYTES> 4. libc.malloc.minalloclim <VALUE_IN_BYTES> Change-Id: I03a4de9643ec954802b26443ce5685975ea30f89
* Don't abort when failed to write tracing message.Yabin Cui2015-07-231-38/+47
| | | | | | | | Also make the code thread-safe with lock. Bug: 20666100 Change-Id: I0f331a617b75280f36179c187418450230d713ef (cherry picked from commit 166112531558a1d4ea179c29147f27db7045db22)
* Add support for non-zero vaddr in maps.Christopher Ferris2015-07-212-3/+70
| | | | | | | | | | | If a map has a non-zero vaddr then it needs to be added to the computed relative offset. Bug: 22532054 (cherry picked from commit 70b6e1daffd58ebce006d4b504cd0fb9672b6d07) Change-Id: I1e98741d6ff3b5bbb7fc5f88cc85b27ace75ee2e
* Do not hold hash table lock while backtracing.Christopher Ferris2015-07-131-5/+3
| | | | | | | | | | There is a deadlock if holding the hash table lock while trying to do a backtrace. Change the code so that the hash table lock is only held while actually modifying either g_hash_table, or while modifying an entry from g_hash_table. Bug: 22423683 Change-Id: I604ea56f940f22e99da41ea4dcdf97bedaac268d
* Improve personality initializationDmitriy Ivanov2015-06-301-0/+17
| | | | | | | | | | 1. Personality parameter should be unsigned int (not long) 2. Do not reset bits outside of PER_MASK when setting personality value. 3. Set personality for static executables. Bug: http://b/21900686 Change-Id: I4c7e34079cbd59b818ce221eed325c05b9bb2303
* Hide accidentally-exposed __clock_nanosleep.Elliott Hughes2015-06-161-2/+2
| | | | | | Bug: http://b/21858067 Change-Id: Iaa83a5e17cfff796aed4f641d0d14427614d9399 (cherry picked from commit b1304935b64ffcd59cd787cc9ac83a2d14dc587b)
* Statically linked executables should honor AT_SECURE.Elliott Hughes2015-06-103-0/+199
| | | | | | Bug: http://b/19647373 Change-Id: I10e7682d9cec26a523f1a3597ca5326c3ca42ebe (cherry picked from commit 1801db3d3fe17df543e721b9fb355e5c882dc6cc)
* Allow NULL in pthread_mutex_lock/unlock.Christopher Ferris2015-06-091-0/+12
| | | | | | | | | | | The pthread_mutex_lock and pthread_mutex_unlock were allowed to fail silently on L 32 bit devices when passed a NULL. We changed this to a crash on 32 bit devices, but there are still games that make these calls and are not likely to be updated. Therefore, once again allow NULL to be passed in on 32 bit devices. Bug: 19995172 Change-Id: If7e8860075ecd63c0064d80f64e226fad7bd3c26
* Export two dlmalloc functions everywhere.Christopher Ferris2015-06-062-6/+31
| | | | | | | | | | | The functions dlmalloc_inspect_all and dlmalloc_trim get exported on devices that use dlmalloc, so be consistent and export them everywhere. Bug: 21640784 (cherry picked from commit f9554a17765fd91d97d1f74913a626f01e880cee) Change-Id: I1000221423c16c356bb6301e55f726db01c3f209
* Reorder DIR structure due to bad apps.Christopher Ferris2015-06-041-1/+7
| | | | | | | | | It turns out that apportable apps expect that the DIR structure is the same as in L and below. Modify the structure to have the same order, and move the new variable to the end of the structure. Bug: 21037208 Change-Id: Id1258e9dc19423109a2c3a8086d3022965591166
* libc: Add O_PATH support for fgetxattr / fsetxattrNick Kralevich2015-06-022-0/+118
| | | | | | | | | | | | | | | | | | | | | | Support O_PATH file descriptors when handling fgetxattr and fsetxattr. This avoids requiring file read access to pull extended attributes. This is needed to support O_PATH file descriptors when calling SELinux's fgetfilecon() call. In particular, this allows the querying and setting of SELinux file context by using something like the following code: int dirfd = open("/path/to/dir", O_DIRECTORY); int fd = openat(dirfd, "file", O_PATH | O_NOFOLLOW); char *context; fgetfilecon(fd, &context); This change was motivated by a comment in https://android-review.googlesource.com/#/c/152680/1/toys/posix/ls.c (cherrypicked from commit 2825f10b7f61558c264231a536cf3affc0d84204) Change-Id: Ic0cdf9f9dd0e35a63b44a4c4a08400020041eddf
* Cleanup ftruncate negative test.Dan Albert2015-06-011-2/+5
| | | | | | | | | Addresses post-submit comments from I54692ab8105dd09db6af7a2c0894a17bdd118aa0. Bug: http://b/21309901 Change-Id: Ie19ee8cdcc4055a65fe7dfc103156e54eafe8977 (cherry picked from commit 9d476a02e9a14e847669a6683c585028175aa322)
* Fix error handling for negative size in ftruncate.Dan Albert2015-06-011-0/+28
| | | | | | Bug: 21309901 Change-Id: I54692ab8105dd09db6af7a2c0894a17bdd118aa0 (cherry picked from commit c05554ec5c9aff5e0f1e83de9bb62c3569eecca2)
* Hide rt_sigqueueinfo.Yabin Cui2015-05-181-2/+2
| | | | | | Bug: 19358804 Change-Id: I38a53ad64c81d0eefdd1d24599e769fd8a477a56 (cherry picked from commit 40a8f214a5264efe5feaaffd55cea67fb87d097b)
* Merge "Add float support to binary event log." into mnc-devJeff Brown2015-04-291-0/+1
|\
| * Add float support to binary event log.Jeff Brown2015-04-281-0/+1
| | | | | | | | | | Bug: 20664753 Change-Id: I6e43c07daa727c19d87f5192bb719af63dd93654
* | bionic: add __system_property_area_serial()Mark Salyzyn2015-04-281-0/+10
|/ | | | | | | | | | | | | | Adds a new _internal_ function. Provide a global serial number to support more efficient private caching algorithms. This allows to skip re-running the __system_property_find() call on misses until there is a global change in the properties. This call is a read barrier, the property data to be read following this call will be read sequentially and up to date. (Cherry pick from bfd65279a5a9018b01f71773270e462f1b9a7768) Bug: 19544788 Change-Id: I58e6a92baa0f3e8e7b9ec79b10af6d56407dab48
* Merge "add fortified memchr/memrchr implementations"Nick Kralevich2015-04-252-0/+78
|\
| * add fortified memchr/memrchr implementationsDaniel Micay2015-04-172-0/+78
| | | | | | | | Change-Id: I38c473cc0c608b08f971409a95eb8b853cb2ba1c
* | Merge "Fix POSIX timer thread naming."Elliott Hughes2015-04-251-3/+3
|\ \
| * | Fix POSIX timer thread naming.Elliott Hughes2015-04-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Spencer Low points out that we never actually set a name because the constant part of the string was longer than the kernel's maximum, and the kernel rejects long names rather than truncate. Shorten the fixed part of the string while still keeping it meaningful. 9999 POSIX timers should be enough for any process... Bug: https://code.google.com/p/android/issues/detail?id=170089 Change-Id: Ic05f07584c1eac160743519091a540ebbf8d7eb1
* | | Unregister pthread_atfork handlers on dlclose()Dmitriy Ivanov2015-04-241-28/+94
|/ / | | | | | | | | Bug: http://b/20339788 Change-Id: I874c87faa377645fa9e0752f4fc166d81fd9ef7e
* | Merge "Revert "Unregister pthread_atfork handlers on dlclose()""Dimitry Ivanov2015-04-241-94/+28
|\ \
| * | Revert "Unregister pthread_atfork handlers on dlclose()"Dimitry Ivanov2015-04-241-94/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | The visibility control in pthread_atfork.h is incorrect. It breaks 64bit libc.so by hiding pthread_atfork. This reverts commit 6df122f8528f9b9fcf7dfea14ae98b0ef66274e1. Change-Id: I21e4b344d500c6f6de0ccb7420b916c4e233dd34
* | | Merge "Simplify close(2) EINTR handling."Elliott Hughes2015-04-231-0/+56
|\ \ \ | |/ / |/| |
| * | Simplify close(2) EINTR handling.Elliott Hughes2015-04-231-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This doesn't affect code like Chrome that correctly ignores EINTR on close, makes code that tries TEMP_FAILURE_RETRY work (where before it might have closed a different fd and appeared to succeed, or had a bogus EBADF), and makes "goto fail" code work (instead of mistakenly assuming that EINTR means that the close failed). Who loses? Anyone actively trying to detect that they caught a signal while in close(2). I don't think those people exist, and I think they have better alternatives available. Bug: https://code.google.com/p/chromium/issues/detail?id=269623 Bug: http://b/20501816 Change-Id: I11e2f66532fe5d1b0082b2433212e24bdda8219b
* | | Unregister pthread_atfork handlers on dlclose()Dmitriy Ivanov2015-04-221-28/+94
|/ / | | | | | | Change-Id: I326fdf6bb06bed12743f08980b5c69d849c015b8
* | Fix bug in app_id_from_name in stubs.cpp.Yabin Cui2015-04-181-0/+1
| | | | | | | | | | | | | | It seems that a break statement is missing. Bug: 19872411 Change-Id: I9362783ab726d01f6eb27418563e716dd95688dc
* | add fortified readlink/readlinkat implementationsDaniel Micay2015-04-173-0/+88
|/ | | | Change-Id: Ia4b1824d20cad3a072b9162047492dade8576779
* Fix clang build.Elliott Hughes2015-04-161-0/+2
| | | | Change-Id: I70a9ebe806cb4f7e23a7d8e486157ddd70ae3008
* add fortified implementations of pread/pread64Daniel Micay2015-04-162-0/+86
| | | | Change-Id: Iec39c3917e0bc94371bd81541619392f5abe29b9
* Merge "Change on handling of SIGEV_THREAD timers."Yabin Cui2015-04-161-22/+20
|\
| * Change on handling of SIGEV_THREAD timers.Yabin Cui2015-04-151-22/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Don't prevent calling callback when SIGEV_THREAD timers are disarmed by timer_settime. As in POSIX standard: The effect of disarming or resetting a timer with pending expiration notifications is unspecified. And glibc didn't prevent in this situation, so I think it is fine to remove the support. 2. Still prevent calling callback when SIGEV_THREAD timers are deleted by timer_delete. As in POSIX standard: The disposition of pending signals for the deleted timer is unspecified. However, glibc handles this (although that is not perfect). And some of our tests in time_test.cpp depend on this feature as described in b/18039727. so I retain the support. 3. Fix some flaky test in time_test.cpp, and make "time*" test pass on bionic-unit-tests-glibcxx. Bug: 18263854 Change-Id: I8ced184eacdbfcf433fd81b0c69c38824beb8ebc
* | Hide emutls* symbols in libc.soDmitriy Ivanov2015-04-151-1/+1
| | | | | | | | | | | | | | Also make thread_local in test static to avoid ld.bfd warning for arm64. Change-Id: I09a3f2aa9b73a4fafa3f3bbc64ddc2a128ad50ee
* | Merge "Prevent using static-allocated pthread keys before creation."Yabin Cui2015-04-141-6/+18
|\ \ | |/ |/|
| * Prevent using static-allocated pthread keys before creation.Yabin Cui2015-04-141-6/+18
| | | | | | | | | | | | Bug: 19993460 Change-Id: I244dea7f5df3c8384f88aa48d635348fafc9cbaf
* | Provide writer preference option in rwlock.Yabin Cui2015-04-081-149/+308
|/ | | | | | | | | | | | | | | | | | | | | Previous implementation of rwlock contains four atomic variables, which is hard to maintain and change. So I make following changes in this CL: 1. Add pending flags in rwlock.state, so we don't need to synchronize between different atomic variables. Using compare_and_swap operations on rwlock.state is enough for all state change. 2. Add pending_lock to protect readers/writers waiting and wake up operations. As waiting/wakeup is not performance critical, using a lock is easier to maintain. 3. Add writer preference option. 4. Add unit tests for rwlock. Bug: 19109156 Change-Id: Idcaa58d695ea401d64445610b465ac5cff23ec7c
* Fix bug for recursive/errorcheck mutex on 32-bit devices.Yabin Cui2015-04-031-1/+25
| | | | | Bug: 19216648 Change-Id: I3b43b2d18d25b9bde352da1e35f9568133dec7cf
* Merge "Refactor pthread_mutex to support 32-bit owner_tid on 64-bit devices."Yabin Cui2015-04-021-155/+141
|\
| * Refactor pthread_mutex to support 32-bit owner_tid on 64-bit devices.Yabin Cui2015-04-011-155/+141
| | | | | | | | | | Bug: 19216648 Change-Id: I765ecacc9036659c766f5d1f6600e1a65364199b
* | Merge "stubs missing include for string.h"Mark Salyzyn2015-04-011-0/+1
|\ \
| * | stubs missing include for string.hMark Salyzyn2015-03-311-0/+1
| |/ | | | | | | | | | | | | | | | | stubs.cpp gets string.h inherited from private/android_filesystem_config.h it should not rely on this in the future. The intent is to move fs_config function into libcutils and thus deprecate any need for string.h in this include file. Change-Id: I946ec1979ef5bbb34fbcb4a99bf2cd79280bb2a3
* | Make ThreadLocalBuffer a class rather than a macro.Elliott Hughes2015-03-316-49/+42
|/ | | | | Bug: 19995392 Change-Id: I497c512648fbe66257da3fb3bcd5c9911f983705
* Revert "Revert "add guard pages to the internal signal stacks""Yabin Cui2015-03-303-6/+16
| | | | | | | This reverts commit a3125fd1396a09a7fc4872dc4653f342150a3deb. And Fix the prctl() problem that cause system crash. Change-Id: Icc8d12d848cfba881a7984ca2827fd81be41f9fd
* Revert "add guard pages to the internal signal stacks"Elliott Hughes2015-03-313-16/+7
| | | | | | This reverts commit 595752f623ae88f7e4193a6e531a0805f1c6c4dc. Change-Id: Iefa66e9049ca0424e53cd5fc320d161b93556dcb
* add guard pages to the internal signal stacksDaniel Micay2015-03-303-7/+16
| | | | | | | Signal handlers tend to be lean, but can still overflow the (tiny) stack. Change-Id: Ia21c6453d92a9f8d1536ad01ff26a1a84c05f8fb
* Merge "Revert "Cause Fatal error when invalid pthread_id is detected.""Yabin Cui2015-03-261-8/+4
|\
| * Revert "Cause Fatal error when invalid pthread_id is detected."Yabin Cui2015-03-261-8/+4
| | | | | | | | | | | | | | | | Some code like in https://buganizer.corp.google.com/u/0/issues/19942911 need to change first. This reverts commit 03324780aae9ff28c8acf52debf0ea39120e5ab8. Change-Id: I13ff1e5b3d0672bae9cde234ffba32fbbf33d338
* | Merge "Initial implementation of __cxa_thread_atexit_impl"Dmitriy Ivanov2015-03-262-1/+53
|\ \