aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-02-08Merge "[MTE] Relax ELF note."android-t-preview-2android-t-preview-1android-t-beta-3android-s-v2-beta-3android-s-qpr3-beta-1android-t-preview-1android-s-v2-beta-3android-s-qpr3-beta-1Treehugger Robot
2022-02-08[MTE] Relax ELF note.Mitch Phillips
Currently, the ELF note parsing in the loader is not permissive. This patch relaxes the restrictions on the bits of the ELF note that could be extended in the future. This may allow more MTE options in apexes. If we add some extra metadata bit (say, in bit 5) in the future, and then build MTE into every apex, we don't want it to crash on Android 13 devices (we'd much rather it just be a no-op). Remove the (unused anywhere) NT_MEMTAG_DEFAULT and call it NT_MEMTAG_NONE. And finally, make the tests work on bionic-unit-tests-static. We previously didn't deploy the test binaries, so add them as a data dependency. Bug: N/A Test: atest bionic-unit-tests-static Change-Id: I13530faad55c719c6eb848297f8ce378e18afbfc
2022-02-08Merge "Avoid duplicate genrule locations"Treehugger Robot
2022-02-08Merge "[MTE] add sysprop to set mte state globally"Treehugger Robot
2022-02-07Avoid duplicate genrule locationsColin Cross
The bp2build build is failing with: ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:execinfo/include/execinfo.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers' ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:kernel/android/uapi/linux/compiler.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers' ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:b64/include/bionic/b64.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers' ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:kernel/uapi/linux/capability.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers' ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:kernel/android/scsi/scsi/scsi.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers' Rewrite the genrule to avoid referring to the same header twice by using the NOTICE file as a known location in the bionic/libc directory. Bug: 190084016 Bug: 218405924 Test: libc_musl_sysroot.zip has same contents Change-Id: Id1a0484a3ed623bcc03b015d02eef19bbb31c06a
2022-02-08Merge changes from topics "musl_execinfo", "musl_mallinfo", "musl_sysroot"Treehugger Robot
* changes: Disable fortify tests for musl Export kernel uapi, execinfo and b64 headers to musl sysroot Export bionic's resolv base64 functions to musl Export bionic's execinfo functions to musl Enable mallinfo tests for musl Fix bionic benchmarks and header tests for musl
2022-02-08Merge changes Ie92399c9,Ic6f05388Ryan Prichard
* changes: Change default block size alignment to be 4 for memory saving on 32-bit arch Keep allocation of `tail_` outside of LinkedList
2022-02-08Merge "[NFCI] Change Android's NT_TYPE to NT_ANDROID_TYPE."Treehugger Robot
2022-02-07[NFCI] Change Android's NT_TYPE to NT_ANDROID_TYPE.Mitch Phillips
Normally, platform-specific note types in the toolchain are prefixed with the platform name. Because we're exposing the NT_TYPE_MEMTAG and synthesizing the note in the toolchain in an upcoming patch (https://reviews.llvm.org/D118948), it's been requested that we change the name to include the platform prefix. While NT_TYPE_IDENT and NT_TYPE_KUSER aren't known about or synthesized by the toolchain, update those references as well for consistency. Bug: N/A Test: Build Android Change-Id: I7742e4917ae275d59d7984991664ea48028053a1
2022-02-07[MTE] add sysprop to set mte state globallyFlorian Mayer
this can be used to run CTS w/ maximum MTE coverage on normal builds. Change-Id: I527b8549f30fd4bd9511d94ca142ea08b72d1a78
2022-02-03Change default block size alignment to be 4 for memory saving on 32-bit archEric Miao
For a 32-bit userspace, `struct LinkedListEntry` takes 8 bytes for storing the two pointers, a default block allocator size alignment of 16-bytes would waste 50% of memory. By changing the alignment to size of a pointer, it saves >1MB memory postboot on wembley device. Bug: http://b/206889551 Test: bionic-unit-tests Change-Id: Ie92399c9bb3971f631396ee09bbbfd7eb17dc1a7
2022-02-03Disable fortify tests for muslColin Cross
musl doesn't have fortify, and is missing the *_chk symbols to allow the tests to compile. Bug: 190084016 Test: m USE_HOST_MUSL=true host-native Change-Id: I9a1d2dfe19db219cd2c5a6dc39cb5d08ed0e4369
2022-02-03Export kernel uapi, execinfo and b64 headers to musl sysrootColin Cross
The musl sysroot needs kernel uapi headers, export them as a zip file. Also include the execinfo and b64 headers for libexecinfo and libb64 that are embedded in musl libc. Bug: 190084016 Test: m USE_HOST_MUSL=true libc_musl_sysroot Change-Id: Ie862934f6dabd3fc6cbb9f5be01e21549bce51c2
2022-02-03Export bionic's resolv base64 functions to muslColin Cross
Musl doesn't provide the resolv b64_* functions, but adb uses them. Export them from bionic. Bug: 190084016 Test: m USE_HOST_MUSL=true host-native Change-Id: I37837e6179a15754d4cbd89e67649df9dea9d9f1
2022-02-03Export bionic's execinfo functions to muslColin Cross
Musl doesn't provide the execinfo function. Export the from bionic. Bug: 190084016 Test: m USE_HOST_MUSL=true host-native Change-Id: I0361b84b0160d419cd857f5bb1314a58d0a69234
2022-02-04Merge "Fix possible nullptr dereference."Christopher Ferris
2022-02-03Merge "Annotate fortify functions with diagnose_as_builtin"Pirama Arumuga Nainar
2022-02-03Annotate fortify functions with diagnose_as_builtinPirama Arumuga Nainar
Bug: http://b/197147102 Bug: http://b/214080353 With https://reviews.llvm.org/D77491, clang got stricter when issuing diagnostics regarding builtin functions. https://reviews.llvm.org/D112024 adds a diagnose_as_builtin attribute which lets it diagnose builtins even though their signature is slightly different. This patch adds diagnose_as_builtin attribute as needed. Versioner is built with an older clang so it doesn't recognize this attribute. So this is added with a preprocessor check on clang versions. We can remove the version check once versioner gets updated shortly after the compiler update. Test: mmma bionic/tests with clang-r445002 Change-Id: I3d0d63ecdbea0cffe97eb5110e2d9f2a7595a38e
2022-02-03Enable mallinfo tests for muslColin Cross
We've added mallinfo and mallinfo2 to musl, enable the bionic tests for it. Also modify the comparison test to explicitly cast the mallinfo fields to size_t, as they are ints in musl. Bug: 190084016 Test: bionic-unit-tests-glibc --gtest_filter=malloc.* Change-Id: Ib2a1d6cf698de817c314a61fe29fda85edabb9ed
2022-02-02Fix possible nullptr dereference.Christopher Ferris
Test: Unit tests pass. Change-Id: I046c6e1665de4d941362e2f65605609e77731c97
2022-02-02Fix bionic benchmarks and header tests for muslColin Cross
Fix references to symbols that don't exist in musl in the bionic benchmarks, and disable the header tests for musl. Bug: 190084016 Test: m USE_HOST_MUSL=true host-native Change-Id: I6b1964afa4a7b6e6a4812e9f2605fcfc2fae9691
2022-02-01Keep allocation of `tail_` outside of LinkedListEric Miao
This change is to allocate `head_` and `tail_` outside of LinkedList and only keep a readonly pointer there. By doing this, all updates of the list touches memory other than the LinkedList itself, thus preventing copy-on-write pages being allocated in child processes when the list changes. The other approach is to make the LinkedList a singly-linked list, however, that approach would cause a full list traversal to add one item to the list. And preliminary number shows there are ~60K calls to `soinfo::add_secondary_namespace` during Android bootup on a wembley device, where a singly-linked approach could be hurting performance. NOTE: the header is allocated and initialized upon first use instead of being allocated in the constructor, the latter ends up in crash. This is likely caused by static initialization order in the linker, e.g. g_soinfo_list_allocator is a static object, and if this linked list is embedded into some other static objects, there's no guarantee the allocator will be available. Bug: http://b/206889551 Test: bionic-unit-tests Change-Id: Ic6f053881f85f9dc5d249bb7d7443d7a9a7f214f
2022-02-01Merge "Fix HWASan crashes in heapprofd initialization."Florian Mayer
2022-02-01Fix HWASan crashes in heapprofd initialization.Florian Mayer
Test: atest perfetto_integrationtests on HWASan build Bug: 210588740 Change-Id: Iddaa4a7d0dedee541f97bbf0a13958de023bdf59
2022-01-29Merge "Silence -Wnon-power-of-two-alignment for a test"Treehugger Robot
2022-01-28Silence -Wnon-power-of-two-alignment for a testPirama Arumuga Nainar
Bug: http://b/214080353 The wrong alignment to aligned_alloc() is deliberate. Silence the warning around the test. Test: build with clang-r445002 Change-Id: I73bad7775423c908c2bbe1c550e8ce5aeede129d
2022-01-26Merge "Fix recursive deadlock inside bionic_systrace"Daniele Di Proietto
2022-01-25Fix recursive deadlock inside bionic_systraceDaniele Di Proietto
The first time should_trace() returns true, bionic_trace_begin() calls open() on trace_marker. The problem is that open() can call bionic_trace_begin(). We've observed this happening, for example when: * fdtrack is enabled. dlopen("libfdtrack.so") can be used to enable fdtrack on a process. * ThreadA is busy unwinding inside fdtrack and is holding an fdtrack internal mutex. * ThreadB calls bionic_trace_begin() for the first time since the property "debug.atrace.tags.enableflags" contains ATRACE_TAG_BIONIC. * ThreadB calls open("/sys/kernel/tracing/trace_marker"). Since fdtrack is enabled, ThreadB tries to do unwinding as well. * ThreadB, inside fdtrack's unwinding tries to grab the same mutex that ThreadA is holding. * Mutex contention is reported using bionic_systrace, therefore bionic_trace_begin() is called again on ThreadB. * ThreadB tries to grab g_lock in bionin_systrace.cpp, but that's already held by ThreadB itself, earlier on the stack. Therefore ThreadB is stuck. I managed to reproduce the above scenario by manually pausing ThreadA inside unwinding with a debugger and letting ThreadB hitting bionic_trace_begin() for the first time. We could avoid using g_lock while calling open() (either by releasing g_lock and reacquiring it later, or by using atomics), but bionic_trace_begin() would try to call open() again. In my tests, open() does not call bionic_trace_begin() a third time, because fdtrack has reentrancy protection, but there might be another code path inside open that calls bionic_trace_begin again (it could be racy or only happen in certain configurations). This commit fixes the problem by implementing reentrancy protection in bionic_systrace. Sample callstack from ThreadA deadlocked before the fix: ``` * frame #0: 0x0000007436db077c libc.so`syscall at syscall.S:41 frame #1: 0x0000007436db0ba0 libc.so`bionic_trace_begin(char const*) [inlined] __futex(ftx=0x000000743737a548, op=<unavailable>, value=2, timeout=0x0000000000000000, bitset=-1) at bionic_futex.h:45:16 frame #2: 0x0000007436db0b8c libc.so`bionic_trace_begin(char const*) [inlined] __futex_wait_ex(ftx=0x000000743737a548, value=2) at bionic_futex.h:66:10 frame #3: 0x0000007436db0b78 libc.so`bionic_trace_begin(char const*) [inlined] Lock::lock(this=0x000000743737a548) at bionic_lock.h:67:7 frame #4: 0x0000007436db0b74 libc.so`bionic_trace_begin(char const*) [inlined] should_trace() at bionic_systrace.cpp:38:10 frame #5: 0x0000007436db0b74 libc.so`bionic_trace_begin(message="Contending for pthread mutex") at bionic_systrace.cpp:59:8 frame #6: 0x0000007436e193e4 libc.so`NonPI::MutexLockWithTimeout(pthread_mutex_internal_t*, bool, timespec const*) [inlined] NonPI::NormalMutexLock(mutex=0x0000007296cae9f0, shared=0, use_realtime_clock=false, abs_timeout_or_null=0x0000000000000000) at pthread_mutex.cpp:592:17 frame #7: 0x0000007436e193c8 libc.so`NonPI::MutexLockWithTimeout(mutex=0x0000007296cae9f0, use_realtime_clock=false, abs_timeout_or_null=0x0000000000000000) at pthread_mutex.cpp:719:16 frame #8: 0x0000007436e1912c libc.so`::pthread_mutex_lock(mutex_interface=<unavailable>) at pthread_mutex.cpp:839:12 [artificial] frame #9: 0x00000071a4e5b290 libfdtrack.so`std::__1::mutex::lock() [inlined] std::__1::__libcpp_mutex_lock(__m=<unavailable>) at __threading_support:256:10 frame #10: 0x00000071a4e5b28c libfdtrack.so`std::__1::mutex::lock(this=<unavailable>) at mutex.cpp:31:14 frame #11: 0x00000071a4e32634 libfdtrack.so`unwindstack::Elf::Step(unsigned long, unwindstack::Regs*, unwindstack::Memory*, bool*, bool*) [inlined] std::__1::lock_guard<std::__1::mutex>::lock_guard(__m=0x0000007296cae9f0) at __mutex_base:104:27 frame #12: 0x00000071a4e32618 libfdtrack.so`unwindstack::Elf::Step(this=0x0000007296cae9c0, rel_pc=66116, regs=0x0000007266ca0470, process_memory=0x0000007246caa130, finished=0x0000007ff910efb4, is_signal_frame=0x0000007ff910efb0) at Elf.cpp:206:31 frame #13: 0x00000071a4e2b3b0 libfdtrack.so`unwindstack::LocalUnwinder::Unwind(this=0x00000071a4ea1528, frame_info=<unavailable>, max_frames=34) at LocalUnwinder.cpp:102:22 frame #14: 0x00000071a4e2a3ec libfdtrack.so`fd_hook(event=<unavailable>) at fdtrack.cpp:119:18 frame #15: 0x0000007436dbf684 libc.so`::__open_2(pathname=<unavailable>, flags=<unavailable>) at open.cpp:72:10 frame #16: 0x0000007436db0a04 libc.so`bionic_trace_begin(char const*) [inlined] open(pathname=<unavailable>, flags=524289) at fcntl.h:63:12 frame #17: 0x0000007436db09f0 libc.so`bionic_trace_begin(char const*) [inlined] get_trace_marker_fd() at bionic_systrace.cpp:49:25 frame #18: 0x0000007436db09c0 libc.so`bionic_trace_begin(message="pthread_create") at bionic_systrace.cpp:63:25 ``` Bug: 213642769 Change-Id: I10d331859045cb4a8609b007f5c6cf2577ff44df
2022-01-25Merge "Fix MemtagNoteTest and make it runnable on non-MTE devices."Evgenii Stepanov
2022-01-25Merge "Move linker from sampling PGO to AFDO pipeline"Yi Kong
2022-01-24Merge "Disable pointer authentication in app processes."Peter Collingbourne
2022-01-25Move linker from sampling PGO to AFDO pipelineYi Kong
Sampling PGO is being replaced by AFDO. Test: presubmit Change-Id: I23e4dace5f2c2d1f2499daba99a28b2a1bc0f22d
2022-01-21Fix MemtagNoteTest and make it runnable on non-MTE devices.Evgenii Stepanov
Update the path to the helper binary, and run the test on non-MTE hardware with the expectation that the bug is not detected. Test: bionic-unit-tests Bug: none Change-Id: I34eb4dc46d0bacd83824d307398f7891d4806686
2022-01-19Disable pointer authentication in app processes.Peter Collingbourne
Unfortunately we have discovered that some applications in the wild are using PAC instructions incorrectly. To keep those applications working on PAC enabled devices, disable PAC in application processes for now. Bug: 212660282 Change-Id: I3030c47be9d02a27505bd4775c1982a20755758c
2022-01-18Merge "libm: sync with upstream."Elliott Hughes
2022-01-16Merge "Update the status for S and T."Treehugger Robot
2022-01-14Update the status for S and T.Elliott Hughes
Test: treehugger Change-Id: I21c4374d7e55dbbb2294cef5cc7bf50b7fe1b549
2022-01-14Merge "Don't use LLVM when readelf(1) will do."Elliott Hughes
2022-01-13Don't use LLVM when readelf(1) will do.Elliott Hughes
This was probably the least worst choice at the time, but we have toybox readelf now, which is a much lighter-weight dependency (that we already have for some other tests). This is also one less use of the *renderscript* LLVM, which we'll be wanting to finally delete soon. Test: treehugger Change-Id: I0e05b8f139ec6e6a425b575368f3d514b8b1cc64
2022-01-13Merge "Don't use llvm-defaults to build some tests."Treehugger Robot
2022-01-12libm: sync with upstream.Elliott Hughes
There's potential here to maybe lose some/all of builtins.cpp, but I'll look at that separately later. Test: treehugger Change-Id: I2c2bc1d0753affdd214daeb09fa1ac7cd73db347
2022-01-12Merge "Fix copy pasta in guard macro for weak symbols."Treehugger Robot
2022-01-12Don't use llvm-defaults to build some tests.Elliott Hughes
It's not clear this was ever needed, it doesn't seem to make any difference now, and these are the defaults for the obsolete renderscript LLVM anyway, so... yeah. This was noticed because it was causing some of our tests to be built as C++11 rather than [the current default of] C++17. Test: treehugger Change-Id: I7d72b3fd58e9cf9a02048b0298eee845d19307f7
2022-01-11Merge "Update to v5.16 kernel headers."Christopher Ferris
2022-01-10Update to v5.16 kernel headers.Christopher Ferris
Kernel headers coming from: Git: https://android.googlesource.com/kernel/common/ Branch: android-mainline Tag: android-mainline-5.16 Test: Builds and bionic unit tests pass. Change-Id: I2522c4f2a0efb9f8a193e1f2d65868e478217502
2022-01-10Merge "Remove availability definitions for mbs APIs."Treehugger Robot
2022-01-07Fix copy pasta in guard macro for weak symbols.Dan Albert
This was pretty broken. I think anything using this was being given always-available annotations for everything but 32-bit x86? Treehugger should complain loudly if this was actually impacting anything though. I suspect not since the only user of this mode is mainline which doesn't target far back enough to have arch-specific introduction guards. Test: treehugger Bug: None Change-Id: I64e96a89d83e64512e661e88915c48a091198992
2022-01-07Remove availability definitions for mbs APIs.Dan Albert
Definitions for these are provided in libandroid_support for API levels that do not expose this in the stubs. For the rare cases where libandroid_support is not being used this will result in a lower quality diagnostic (undefined reference instead of "not available until API 21"), but other fixes would also have that behavior because the libandroid_support headers are *always* available, even if libandroid_support won't be linked. Test: Reverted xfailed tests for #1108 and reran tests with this Bug: https://github.com/android/ndk/issues/1108 Change-Id: I371f5b9d7caeef8dc7c80f2f6d11280ecba119c9
2021-12-16Merge "c32rtomb/mbrtoc32: remove dead code."Elliott Hughes
2021-12-16Merge "sched.h: add doc comments."Elliott Hughes