aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* android_getaddrinfo_proxy: fix memory leak on failure.lineage-17.1Elliott Hughes2020-04-231-1/+1
| | | | | | | | | The shadowing of `ai` meant that the freeaddrinfo() call outside the loop would never see anything but NULL. Bug: https://issuetracker.google.com/143928781 Test: treehugger Change-Id: I1bf137f7933201eb8024603bfd569ff7bbc7f9b7
* bionic: Support wildcards in cached hosts fileTom Marshall2020-01-171-1/+28
| | | | | | | | | | | | | | | | If an exact name is not found in the hosts file and the host name contains at least one dot, search for entries of the form "*.domain", where domain is the portion of the host name after the first dot. If that is not found, repeat using the domain. Example: a.b.c.example.com would search for the following in turn: a.b.c.example.com *.b.c.example.com *.c.example.com *.example.com *.com Change-Id: I4b0bb81699151d5b371850daebf785e35ec9b180
* Optimize tolower(3)/toupper(3) from <ctype.h>.staging/lineage-17.0_merge-android-10.0.0_r9Elliott Hughes2019-12-117-133/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tables in the BSD tolower/toupper are slower for ASCII than just doing the bit twiddling. We can't actually remove the tables on LP32, so move them into the "cruft" we keep around for backwards compatibility (but remove them for LP64 where they were never exposed). I noticed that the new bit-twiddling tolower(3) was performing better on arm64 than toupper(3). The 0xdf constant was requiring an extra MOV, and there isn't a BIC that takes an immediate value. Since we've already done the comparison to check that we're in the right range (where the bit is always set), though, we can EOR 0x20 to get the same result as the missing BIC 0x20 in just one instruction. I've applied that same optimization to towupper(3) too. Before: BM_ctype_tolower_n 3.30 ns 3.30 ns 212353035 BM_ctype_tolower_y 3.31 ns 3.30 ns 211234204 BM_ctype_toupper_n 3.30 ns 3.29 ns 214161246 BM_ctype_toupper_y 3.29 ns 3.28 ns 207643473 BM_wctype_towupper_ascii_n 3.53 ns 3.53 ns 195944444 BM_wctype_towupper_ascii_y 3.48 ns 3.48 ns 199233248 After: BM_ctype_tolower_n 2.93 ns 2.92 ns 242373703 BM_ctype_tolower_y 2.88 ns 2.87 ns 245365309 BM_ctype_toupper_n 2.93 ns 2.93 ns 243049353 BM_ctype_toupper_y 2.89 ns 2.89 ns 245072521 BM_wctype_towupper_ascii_n 3.34 ns 3.33 ns 212951912 BM_wctype_towupper_ascii_y 3.29 ns 3.29 ns 214651254 (Why do both the "y" and "n" variants speed up with the EOR change? Because the compiler transforms the code so that we unconditionally do the bit twiddling and then use CSEL to decide whether or not to actually use the result.) We also save 1028 bytes of data in the LP64 libc.so. Test: ran the bionic benchmarks and tests Change-Id: I7829339f8cb89a58efe539c2a01c51807413aa2d
* ASCII fastpath for towupper and towlower.Balaram Makam2019-12-111-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change elides unnecessary calls to __find_icu_symbol for ASCII chars and improves PUBG mobile game loading time by 7% on hikey620(Cortex-A53): name old time/op new time/op delta PUBG_0.13.0_Launch 41.5s ± 2% 37.7s ± 3% -9.24% (p=0.008 n=5+5) Below are the bionic benchmark results on a Pixel 2 XL for 64-bit, showing a large speedup for ASCII and only a small slowdown for non-ASCII. Before: BM_wctype_towlower_ascii_n 10.5 ns 10.4 ns 61973065 BM_wctype_towlower_ascii_y 10.2 ns 10.2 ns 70158659 BM_wctype_towlower_unicode_n 10.3 ns 10.3 ns 67719478 BM_wctype_towlower_unicode_y 10.6 ns 10.5 ns 67841545 BM_wctype_towupper_ascii_n 10.8 ns 10.8 ns 63456778 BM_wctype_towupper_ascii_y 10.9 ns 10.9 ns 65116910 BM_wctype_towupper_unicode_n 10.7 ns 10.7 ns 67463276 BM_wctype_towupper_unicode_y 10.4 ns 10.4 ns 66467890 After: BM_wctype_towlower_ascii_n 3.35 ns 3.34 ns 205567652 BM_wctype_towlower_ascii_y 3.30 ns 3.29 ns 214108746 BM_wctype_towlower_unicode_n 10.9 ns 10.8 ns 65007743 BM_wctype_towlower_unicode_y 10.6 ns 10.6 ns 63819060 BM_wctype_towupper_ascii_n 3.53 ns 3.53 ns 195944444 BM_wctype_towupper_ascii_y 3.48 ns 3.48 ns 199233248 BM_wctype_towupper_unicode_n 11.1 ns 11.1 ns 62760216 BM_wctype_towupper_unicode_y 11.0 ns 11.0 ns 61608872 Test: bionic unit tests on device Test: bionic benchmarks on device Signed-off-by: Balaram Makam <b.makam@samsung.com> Change-Id: I77ab7efb66d7bcb35d00467663607535e5c1992f
* bionic: Squash of pre-P mutex behavior restorationnx1112019-12-111-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a squash of the following commits: Author: Ethan Chen <intervigil@gmail.com> Date: Tue Sep 25 00:11:05 2018 -0700 Actually restore pre-P mutex behavior Apps built against versions < P may not actually expect the EBUSY return code, and may crash or otherwise misbehave. Check for target SDK versions earlier than P when performing the IsMutexDestroyed check so any invocation of HandleUsingDestroyedMutex is bypassed and pre-P mutex behavior is restored. See 9e989f12d1186231d97dac6d038db7955acebdf3 for the change that introduced this new behavior. Change-Id: I45f8882c9527c63eed1ef5820a5004b8958d58ea Author: nx111 <gd.zhangdz@gmail.com> Date: Wed Oct 3 16:58:19 2018 +0800 bionic: Use legacy pthread_mutex_init() behavior on pre-P API levels * Google's changes to pthread_mutex_init is breaking RIL on certain Samsung devices like klte and hlte * To resolve this, add a check for their new additions to only apply the new behavior for P and higher APIs Change-Id: I41335c5c436fa28a66d044e6634466556dfd7f95 Author: Han Wang <416810799@qq.com> Date: Sat Sep 07 11:36:20 2019 +0200 Edit: Forward-port to Q: s/bionic_get_application_target_sdk_version/android_get_application_target_sdk_version Drop incorrect inline keyword for IsMutexDestroyed() Change-Id: Ia3eed5cfe2e5d40fa8b49aa5b4c565fb9632b8ec
* Implement per-process target SDK version override.Danny Baumann2019-12-112-1/+15
| | | | Change-Id: I65bbdbe96541d8aacdd4de125cdb9c1435129413
* libc: Mark libstdc++ as vendor availableRashed Abdel-Tawab2019-12-111-0/+1
| | | | | | | A lot of blobs still link this even on 8.1, so allow devices to build a vendor copy of it. Change-Id: I2349478ec0507e3a5136fe89f15e7dc4bfc1a03e
* bionic: Sort and cache hosts file data for fast lookupTom Marshall2019-12-114-0/+564
| | | | | | | | | | | | | | | | | | | | The hosts file is normally searched linearly. This is very slow when the file is large. To mitigate this, read the hosts file and sort the entries in an in-memory cache. When an address is requested via gethostbyname or getaddrinfo, binary search the cache. In case where the cache is not available, return a suitable error code and fall back to the existing lookup code. This has been written to behave as much like the existing lookup code as possible. But note bionic and glibc differ in behavior for some corner cases. Choose the most standard compliant behavior for these where possible. Otherwise choose the behavior that seems most reasonable. RM-290 Change-Id: I3b322883cbc48b0d76a0ce9d149b59faaac1dc58 (cherry picked from commit ed4c3a6bd449a4ed70645071a440ae146f194116)
* linker: Add support for dynamic SHIM librariesChristopher R. Palmer2019-12-114-0/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Author: Christopher R. Palmer <crpalmer@gmail.com> Date: Tue Nov 3 16:44:44 2015 -0500 linker: Add support for dynamic "shim" libs Add a new environment variable LD_SHIM_LIBS that is a colon (":") separated list of vertical bar ("|") separated pairs. The pairs are the name for a soinfo reference (executable or shared library) followed by the name of the shim library to load. For example: LD_SHIM_LIBS=rmt_storage|libshim_ioprio.so:/system/lib/libicuuv.so|libshim_icu53.so will instruct the linker to load the dynamic library libshim_ioprio.so whenver rmt_storage is executed [*] and will load libshim_icu53.so whenever any executable or other shared library links against /system/lib/libicuuv.so. There are no restrictions against circular references. In this example, libshim_icu53.so can link against libicuuv.so which provides a simple and convenient means of adding compatibility symbols. [*] Note that the absolute path is not available to the linker and therefore using the name of executables does depend on the invocation and therefore should only be used if absolutely necessary. That is, running /system/bin/rmt_storage would not load any shim libs in this example because it does not match the name of the invocation of the command. If you have trouble determining the sonames being loaded, you can also set the environment variable LD_DEBUG=1 which will cause additional information to be logged to help trace the detection of the shim libs. Change-Id: I0ef80fa466167f7bcb7dac90842bef1c3cf879b6 Author: Christopher R. Palmer <crpalmer@gmail.com> Date: Sun Nov 15 14:26:32 2015 -0500 linker: Fix the fact that shim libs do not properly call constructors Change-Id: I34333e13443a154e675b853fa41442351bc4243a Author: Christopher R. Palmer <crpalmer@gmail.com> Date: Tue Dec 1 07:10:36 2015 -0500 linker: Don't try to walk the g_active_shim_libs when doing dlsym This is a bug in the original shim_lib implementation which was doing the shim lib resolution both when loading the libraries and when doing the dynamic symbol resolution. Change-Id: Ib2df0498cf551b3bbd37d7c351410b9908eb1795 Author: Christopher R. Palmer <crpalmer@gmail.com> Date: Sun Nov 29 08:28:10 2015 -0500 linker: Reset the active shim libs each time we do a dlopen We use the active libs to avoid recursively trying to load the same library: A -> shimlibs add B -> depends on A -> shimlibs add B -> ... However, when we repeatedly dlopen the same library we need to reset the active shim libs to avoid failing to add B the second time we dlopen A. Change-Id: I27580e3d6a53858e8bca025d6c85f981cffbea06 Author: Danny Baumann <dannybaumann@web.de> Date: Fri Dec 11 10:29:16 2015 +0100 Make shim lib load failure non-fatal. Instead, print an appropriate warning message. Aborting symbol resolution on shim lib load failure leads to weird symbol lookup failures, because symbols in libraries referenced after the one loading the shim won't be loaded anymore without a log message stating why that happened. Change-Id: Ic3ad7095ddae7ea1039cb6a18603d5cde8a16143 Author: Christopher R. Palmer <crpalmer@gmail.com> Date: Sat Dec 12 06:10:09 2015 -0500 bionic: Do not allow LD_SHIM_LIBS for setuid executables That's really not safe... Change-Id: If79af951830966fc21812cd0f60a8998a752a941 Author: Christopher R. Palmer <crpalmer@gmail.com> Date: Sun Feb 14 11:38:44 2016 -0500 bionic: linker: Load shim libs *before* the self-linked libs By loading them earlier, this allows us to override a symbol in a library that is being directly linked. I believe this explains why some people have had problems shimming one lib but when the changet he shim to be against a different lib it magically works. It also makes it possible to override some symbols that were nearly impossible to override before this change. For example, it is pretty much impossible to override a symbol in libutils without this change because it's loaded almost everywhere so no matter where you try to place the shimming, it will be too late and the other symbol will have priority. In particularly, this is necessary to be able to correctly shim the VectorImpl symbols for dlx. Change-Id: I461ca416bc288e28035352da00fde5f34f8d9ffa Author: Chirayu Desai <chirayudesai1@gmail.com> Date: Thu Aug 25 19:02:41 2016 +0530 linker: Update find_library call for shimlibs commits 0cdef7e7f3c6837b56a969120d9098463d1df8d8 "Respect caller DT_RUNPATH in dlopen()." and 42d5fcb9f494eb45de3b6bf759f4a18076e84728 "Introducing linker namespaces" added new arguments to find_library, add them here. Change-Id: I8f35a45b00d14f8b2ce01a0a96d2dc7759be04a6 Author: Chippa-a <vusal1372@gmail.com> Date: Sat Aug 27 14:56:30 2016 +0200 linker: Update LD_SHIM_LIBS parser function * Upgrade the code using the same changes as 42d5fcb9f494eb45de3b6bf759f4a18076e84728 bda20e78f0f314dbbf0f0bbcf0740cf2d6a4b85e Change-Id: Ic8be0871945bd9feccd0f94a6770f3cc78a70a0f Author: Danny Baumann <dannybaumann@web.de> Date: Wed Sep 7 16:54:06 2016 +0200 Inject shim libs as if they were DT_NEEDED. The previous separate approach had one flaw: If the shim lib requires another lib that's already loaded, find_library_internal() would return the previously loaded copy, but the later load action would fail as the ELF reader map of the initial loading round was already discarded and thus a new ElfReader instance for the soinfo instance was created, which didn't know about the previous reading/loading state. Change-Id: Ib224dbd35d114197097e3dee14a077cc9130fedb Author: jrior001 <jriordan001@gmail.com> Date: Fri Oct 7 19:36:51 2016 -0400 linker: load shims prior to DT_NEEDED check This allows shims to override existing symbols, not just inject new symbols. Change-Id: Ib9216bcc651d8d38999c593babb94d76dc1dbc95 Author: Adrian DC <radian.dc@gmail.com> Date: Sat, 8 Apr 2017 22:40:01 +0200 * Adapt to latest AOSP Oreo bionic linker changes * Additional header to avoid unused function Change-Id: Ib9216bcc651d8d38999c593babb94d76dc1dbc95 Author: Paul Keith <javelinanddart@gmail.com> Date: Thu Feb 15 21:57:33 2018 +0100 linker: Move shims to TARGET_LD_SHIM_LIBS * To reduce security exposure, let's set this at compile time, and block off all the code unless the board flag is set Change-Id: Ieec5f5d9e0f39a798fd48eae037ecffe9502474c Author: Nich <nctrenco@gmail.com> Date: Fri Jun 8 09:48:17 2018 +0800 linker: Provide soinfo path of the shimmed binary This is a forward port of part of the original change that was missed out since the initial port of the shim logic to O. Change-Id: I1f7ff98472cfef5cb2d2bcb303082784898cd0c6 Author: Nich <nctrenco@gmail.com> Date: Tue Jun 5 13:36:43 2018 +0800 linker: Remove unused find_libraries declaration commit "Inject shim libs as if they were DT_NEEDED." removed references to the forward declaration. Change-Id: I5f1aaa3a96f2af3edef07d4ea4e204b586424631 Author: Nich <nctrenco@gmail.com> Date: Sun Jun 10 00:45:51 2018 +0800 linker: Make shim reference path absolute This way, we can filter out non-existent binaries, and ensure we get its absolute path before matching with get_realpath(). This for one allows the use of symlinks in TARGET_LD_SHIM_LIBS. Change-Id: I823815271b3257965534b6b87d8ea36ffb68bc08 Author: Nich <nctrenco@gmail.com> Date: Fri Jun 15 03:59:05 2018 +0800 linker: Ensure active matching pairs Change-Id: I54c666b4560dbfb40839b0bf9132a7fd8d3ed2dd Author: Nich <nctrenco@gmail.com> Date: Thu Jun 21 01:58:10 2018 +0800 linker: Don't involve shim in for_each_dt_needed for_each_dt_needed may have other usages that shouldn't involve the shim, for example, in the unloading of soinfos. Change-Id: Id38de183d90c3f707767bdca032a5ea2bc82fde8 Author: Jiyong Park <jiyong@google.com> Date: Fri Jan 25 18:18:01 2019 +0900 Call realpath(3) only when the path is accessible for read Suppress the SELinux denial log spam by not calling realpath(3) when the path does not exist or is not accessible for read, and then not auditing access(2) failure. Change-Id: I729ecb8ea0bb581069eb849bae7cd28e6ab636cc Change-Id: Ic3ad7095ddae7ea1039cb6a18603d5cde8a16152
* Add inaddr.h header fileRoopesh Rajashekharaiah Nataraja2019-12-113-2/+38
| | | | Change-Id: Iad92c39fb729538cf51bf9d9037b15515104b453
* Snap for 5715871 from 358c8c95725380eafe9f2aed0a4e2542592e85ff to ↵android-build-team Robot2019-07-101-3/+2
|\ | | | | | | | | | | qt-qpr1-release Change-Id: I67c50098aba9d711bf100e72fa95763ba844a9d3
| * Do not check tcache clear when doing a purge.Christopher Ferris2019-07-091-3/+2
| |\ | | | | | | | | | | | | | | | am: 5cda74e065 Change-Id: I6fdf747408e96c1f99c4544e94a97835c8588d19
| | * Do not check tcache clear when doing a purge.Christopher Ferris2019-07-081-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On systems where the tcache is disabled, the tcache clear option will fail, and not really do a purge. Bug: 137037462 Bug: 136236080 Test: Built taimen as malloc svelte and verified the M_PURGE mallopt Test: call failed before this fix and passes afterwards. Change-Id: Ib30e5f3e083a9c6d046adff30f2aa7eacaf6df10 Merged-In: Ib30e5f3e083a9c6d046adff30f2aa7eacaf6df10 (cherry picked from commit 3d0bafb945bc9e39ddc84a0167e713b8e70dc135)
* | | Snap for 5645193 from d13cb58b3afda031fbe38f6dc8eaca28237c8a3b to ↵android-build-team Robot2019-06-082-0/+11
|\| | | | | | | | | | | | | | | | | qt-qpr1-release Change-Id: I37ff98127f03694e199e8acae723c1f5f1a9e04e
| * | Add bootstrap directory to bootstrap linker's search path.Peter Collingbourne2019-06-062-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A proposed set of changes: https://android-review.googlesource.com/q/topic:"no-dup-hwasans" will cause the HWASAN runtime to be moved from /system/lib64 to /system/lib64/bootstrap. This causes a problem in the case where libc is built with HWASAN but init is not built with HWASAN. In this case, libc.so will have a DT_NEEDED dependency on the HWASAN runtime but init will not. Currently, init and other bootstrap executables arrange to load bootstrap libraries by setting rpath, but rpath only has an effect on libraries directly depended on by the main executable, not libraries indirectly depended on by it. This means that the loading of the HWASAN runtime will fail. Instead of relying on rpath to find the bootstrap libraries, modify the bootstrap linker so that it searches the bootstrap library directory after searching the rpath. Bug: http://b/134503977 Test: Builds Change-Id: I297be32e04ecd316ee12b8e694588e1249e2bb89 Merged-In: I297be32e04ecd316ee12b8e694588e1249e2bb89 (cherry picked from commit ea11be0cc85cb5355ca7ed4ee8736ea52b72e38d)
* | | Snap for 5582435 from dd0d0d10a301991e53f387a0f89f7a4e27c2df07 to ↵android-build-team Robot2019-05-181-0/+8
|\| | | | | | | | | | | | | | | | | qt-qpr1-release Change-Id: Ib531f950c78b81e0b3c52961f3da9ee9836e2622
| * | Temporarily disable unwind through signal test.Christopher Ferris2019-05-171-0/+8
| |\| | | | | | | | | | | | | | | | am: fe0fbcff7f Change-Id: I74af54311bd19b9b4a5258ec45c85436da34d033
| | * Temporarily disable unwind through signal test.Christopher Ferris2019-05-161-0/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | | | On cf_x86_phone-userdebug, both of the unwind through signal tests fail. This has been failing forever, but seems to have suddenly become an issue, so disable while I try to figure out why this is happening. Bug: 132763120 Test: Ran on emulator and verified tests are skipped. Change-Id: Iafc227d972a7783e94c701d73078c9570cea288e Merged-In: Iafc227d972a7783e94c701d73078c9570cea288e (cherry picked from commit d424fafbce4b60f4e5c38981af99c05d07727ed4)
* | Merge "Add removed platform functions used by apps." into qt-devChristopher Ferris2019-05-082-0/+39
|\| | | | | | | | | | | am: 51ad27180b Change-Id: Ia96df84946fe463d7f452f22620bb80d68f91996
| * Merge "Add removed platform functions used by apps." into qt-devChristopher Ferris2019-05-082-0/+39
| |\
| | * Add removed platform functions used by apps.Christopher Ferris2019-05-082-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added get_malloc_leak_info and free_malloc_leak_info for arm 32 bit only so that the kindle app will continue to run. Bug: 132175052 Test: Ran kindle app, read pdf file. Verified libKindleReaderJNI.so Test: is loaded in memory properly. Change-Id: Ib1ea3a37b3729f9bcc2739c5f3a584ea8f66d200
* | | Avoid using malloc debug code after exit.Christopher Ferris2019-05-082-10/+109
|\| | | | | | | | | | | | | | | | | am: 020681fec7 Change-Id: I8e84f2e1f5ce57d9ed6c05637328f5d2d66a0e4c
| * | Avoid using malloc debug code after exit.Christopher Ferris2019-05-082-10/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I wrote a new unit test that would fail on the old version of the code. On a walleye big cpu, this costs about 40ns-50ns (going from ~430ns to ~480ns). I think this is an acceptable performance degradation. Bug: 131867816 Test: New unit tests pass. Change-Id: I4c0f4373fb0694bf29c3824dbb1224a8a17e211e Merged-In: I4c0f4373fb0694bf29c3824dbb1224a8a17e211e (cherry picked from commit d269fcc935b276502b9e47a575d76693fe1b8455)
* | | Match maximum command line size for startup tracing.Florian Mayer2019-05-081-10/+11
|\| | | | | | | | | | | | | | | | | am: 2a67b023bd Change-Id: Ib5ce506478de240dbce534fdc7a12e773ac187a7
| * | Match maximum command line size for startup tracing.Florian Mayer2019-05-081-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix too small buffer for the startup property not accounting for the prefix. Bug: 131893397 This is a cherry-pick of f6d221eeed66c975fb05589a171fe4a05c0d35f7. Change-Id: Iad2398bc09c61b1144430bcbef58e5a832b85b0a Merged-In: Iad2398bc09c61b1144430bcbef58e5a832b85b0a
* | | Merge "Revert fwalk/sfp locking to fix concurrent reads" into qt-devRyan Prichard2019-05-075-7/+38
|\| | | | | | | | | | | | | | | | | am: 2a24f6bd5f Change-Id: I24bcda8a0754bc34a46e7a5e11954a074ee79544
| * | Merge "Revert fwalk/sfp locking to fix concurrent reads" into qt-devRyan Prichard2019-05-075-7/+38
| |\ \
| | * | Revert fwalk/sfp locking to fix concurrent readsRyan Prichard2019-05-065-7/+38
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The locking can fail in a couple of ways: - A concurrent fread from an unbuffered or line-buffered file flushes the output of other line-buffered files, and if _fwalk locks every file, then the fread blocks until other file reads have completed. - __sfp can initialize a file lock while _fwalk is locking/unlocking it. For now, revert to the behavior Bionic had in previous releases. This commit reverts the file locking parts of commit 468efc80da2504f4ae7de8b5e137426d44dda9d7. Bug: http://b/131251441 Bug: http://b/130189834 Test: bionic unit tests Change-Id: I9e20b9cd8ccd14e7962f7308e174f08af72b56c6 (cherry picked from commit c485cdb0249415b8aee5968b2b8854921e152854)
* | | Exclude libgcc_stripped wherever libgcc is excludedYi Kong2019-05-072-0/+3
|\| | | | | | | | | | | | | | | | | am: bffe6f16a8 Change-Id: Ifa811cb1cba283e0c67fa3fa93720b0811a801ac
| * | Exclude libgcc_stripped wherever libgcc is excludedYi Kong2019-05-072-0/+3
| |/ | | | | | | | | | | | | | | | | Test: manual testing Bug: 130267141 Bug: 29275768 Merged-In: If50420c05d36e6f680a36673e7c26ca7deb93b28 Change-Id: I1e74c7b13ce0e0fa0e9c98cf9139f85e36b0645d (cherry picked from commit 7ac2afbde37258b8fc489f24bd1fcbf2cac18e39)
* | Fix malloc_info missing large allocs.Christopher Ferris2019-05-032-8/+62
|\| | | | | | | | | | | am: 125d32cb46 Change-Id: I4c971ef382f835fc0a308487d167c45b7414e119
| * Fix malloc_info missing large allocs.Christopher Ferris2019-05-032-8/+62
| | | | | | | | | | | | | | | | | | | | | | | | Also change the names of some of the functions to make it very obvious that the functions being called are in je code. Write new test to make sure mallinfo and malloc_info match. Bug: 131864803 Test: New unit tests pass (along with all other bionic unit tests). Change-Id: I26eda7e64f57a8c56cc8d70e3ed6a29dcb87f630
* | Make purging clear the current thread cache too.Christopher Ferris2019-05-011-0/+8
|\| | | | | | | | | | | am: 58567dcd78 Change-Id: Ifd5dbf7e92788873827814445388e99ab6503e7b
| * Make purging clear the current thread cache too.Christopher Ferris2019-05-011-0/+8
|/ | | | | | | | | | | Bug: 131362671 Test: Ran bionic unit tests. Test: Wrote a test that did a purge and verified that the tcache->ncached Test: number went from 3 to 0. Also verified that mallinfo reflects the Test: cached entries being flushed. Change-Id: I64e35618fa3b523cf29bdaceedef676abe440dd3 (cherry picked from commit 0f710fd59346312b4e351e9d3c956bc804ff02b2)
* Merge "__cxa_finalize: skip fflush call on dlclose" into qt-devRyan Prichard2019-04-301-1/+4
|\
| * __cxa_finalize: skip fflush call on dlcloseRyan Prichard2019-04-261-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In __cxa_finalize, only call fflush(NULL) when the program is exiting, not when a library is unloaded with dlclose. This change restores behavior from 2015. Flushing output is needed when the program exits, but flushing everything is hazardous at other times because it can block -- fflush(NULL) locks every file, so it also blocks on read operations. Bug: http://b/130655235 Test: manual Change-Id: I2f5ecffa6724bfd98a93d145ab5313c793c01ae6 (cherry picked from commit c5d8c6c6e47a7f5fd0c3db2a48004be1030cf753)
* | Make pthread_get/setschedparam weak for native bridgedimitry2019-04-262-0/+5
| | | | | | | | | | | | | | Bug: http://b/130825973 Test: run affected app on cuttlefish Change-Id: I776f26f5eaebdfdb1256ff621bd05ef5a90b852a (cherry picked from commit c7b81108b48d213ef3eb8f296440ada893e9ac5d)
* | Merge "Implement __gnu_[u]ldivmod_helper methods in libc" into qt-devYi Kong2019-04-242-2/+46
|\ \
| * | Implement __gnu_[u]ldivmod_helper methods in libcYi Kong2019-04-232-2/+46
| |/ | | | | | | | | | | | | | | | | | | | | | | | | These symbols were previously provided by Android's out-dated libgcc, but they're removed/deprecated in upstream libgcc, and also won't be available in libclang_rt.builtins. We need to provide these methods in libc itself for compatiblity. Test: build with these symbols stripped in libgcc Bug: 29275768 Change-Id: Ie1ccdb711872bf3fc317cb908fed67c9a8955e42 Merged-In: I04a05258c6c06b5a22ead41e148b02792ffbc941 (cherry picked from commit b410d0e69ef6f545c7652ee0e4cf7b4dd4d2c38a)
* | Merge "PIMutexUnlock: load owner_tid in non-common case" into qt-devRyan Prichard2019-04-232-0/+20
|\ \
| * | PIMutexUnlock: load owner_tid in non-common caseRyan Prichard2019-04-232-0/+20
| |/ | | | | | | | | | | | | | | | | | | | | | | | | For a recursive or errorcheck PI mutex, the old_owner variable wasn't being initialized. As a result, unlocking a doubly-locked recursive mutex owned by another thread decremented the mutex counter. Instead, the unlock call should fail with EPERM. Bug: http://b/130841532 Test: bionic-unit-tests Test: bionic-unit-tests-glibc --gtest_filter='pthread.pthread_mutex_lock*' Change-Id: I37adb094cb2ce8d51df7b4f48e8d6bc144436418 (cherry picked from commit 4b6c0f5dce5ad8d93e4e707977e09153a5399139)
* | Merge "Only write main library's RELRO by default." into qt-devTreeHugger Robot2019-04-232-2/+28
|\ \
| * | Only write main library's RELRO by default.Torne (Richard Coles)2019-04-232-2/+28
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | ANDROID_DLEXT_WRITE_RELRO was inadvertently writing out the RELRO section of all libraries loaded during a given dlopen() call instead of only the main library; since the other libraries are loaded at unpredictable addresses this additional data is rarely useful. Fix this to only happen when the ANDROID_DLEXT_RESERVED_ADDRESS_RECURSIVE flag is being used. Bug: 128623590 Test: DlExtRelroSharingTest.CheckRelroSizes Change-Id: I05e8651d06ce2de77b8c85fe2b6238f9c09691ad (cherry picked from commit 5d10374947824c60d524e812172ae60f30a51fde)
* / Reland ifuncs for strcmp and strlen.Elliott Hughes2019-04-223-51/+5
|/ | | | | | | | | | | This reverts commit e4788d4c7e842b0ca24363ebc5544a16c9e3b185, which undid this change during the Q betas. Bug: http://b/120989619 (cherry picked from commit 927fe99692b1edc723e74bfc17ed718a84ddc6fd) Change-Id: Ie8fc0fc0965055f312c2c0cc0f64adb7594ffdb4
* Workaround ASan not knowing about reallocarray.Elliott Hughes2019-04-221-1/+1
| | | | | | | | | | | | | Ensure we call realloc@plt rather than (as was previously happening) inlining realloc into reallocarray, which makes the allocation invisible to ASan. Bug: http://b/129989984 Test: objdump (cherry picked from commit 390be50067c03524b420cae83fd97992f26fa754) Change-Id: I0676b70cb9a7d7323252eabfff055c0e806915ef
* Move all leak info functions to android_mallopt.Christopher Ferris2019-04-195-50/+84
| | | | | | | | | | | Bug: 130028357 Test: malloc_hooks unit tests. Test: Enable backtrace for mediaserver, run dumpsys media.player -m Test: Enable backtrace for calendar, run am dumpheap -n <PID> <FILE> Change-Id: I6774e28ccd9b3f2310127a5b39ccd15fe696a787 Merged-In: I6774e28ccd9b3f2310127a5b39ccd15fe696a787 (cherry picked from commit 3aadc5e80a5e2cf6b6760ed90d528709223bb449)
* Merge "Remove gMallocLeakZygoteChild." into qt-devChristopher Ferris2019-04-1711-33/+44
|\
| * Remove gMallocLeakZygoteChild.Christopher Ferris2019-04-1611-33/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove this global variable and change the setting of it to non-zero to a call to android_mallopt. In addition, change the initialize function to use pass a bool* instead of int*. Bug: 130028357 Test: Ran malloc_debug/malloc_hooks/perfetto tests. Change-Id: I20d382bdeaaf38aac6b9dcabea5b3dfab3c945f6 Merged-In: I20d382bdeaaf38aac6b9dcabea5b3dfab3c945f6 (cherry picked from commit 5225b342f0810c027df3d09fbbcef4d324b19b93)
* | clean_header: Run outside of $ANDROID_BUILD_TOPDaniel Mentz2019-04-161-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable the use case where we run clean_header.py from outside of $ANDROID_BUILD_TOP. Previously, this script required the current working directory to be under $ANDROID_BUILD_TOP. Running it from a different directory resulted in the following error message: clean_header.py: error: Not in android tree pointed at by ANDROID_BUILD_TOP (....) (cherry picked from commit d12d6f67bca790696679db46cdc306eba3122e7c) Bug: 128420573 Change-Id: If07b0345401f5dd35b41876a3838209595bf8ab1 Merged-In: I48210ea1a0033228a9aaa4124d28247b07cee6d4
* | clean_header: Fix error handling for no-such-file caseDaniel Mentz2019-04-161-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | The function cleanupFile should always return a single value (as opposed to a tuple or list). In addition, if it encounters an error, it is expected to return a value that evaluates to False. As it stands, however, it returns (None, None) in certain error cases. Change this function to return None, in those cases. We previously saw the following error message, when we tried to run clean_header.py on a non-existent file. Traceback (most recent call last): File "clean_header.py", line 208, in <module> b.updateGitFiles() File "utils.py", line 164, in updateGitFiles self._writeFile(dst) File "utils.py", line 136, in _writeFile f.write(self.new_data[dst]) TypeError: expected a string or other character buffer object (cherry picked from commit 6d6b4cedd16c3b4d6de114c622739fc5d52f4c57) Bug: 128420573 Change-Id: Id1dfab71e7efdee14950520df69f2e35219ee353 Merged-In: I5f717dd1a4388f598f0fd4bfd5e6129017de9095