CfiFail calls find_containing_library, which searches the linker's
internal soinfo list, which could be modified by another thread.
Bug: http://b/150372650
Test: bionic-unit-tests
Change-Id: I59024a0a47913caa75702f15ec058b0a360727b5
android_get_exported_namespace searches g_exported_namespaces, which
isn't modified after process initialization, but it does the search
using a new std::string object, and the linker's malloc/free functions
aren't thread-safe. (They're protected by the same lock (g_dl_mutex) as
the rest of the linker's state.)
Bug: http://b/150372650
Test: bionic-unit-tests
Change-Id: Iafd12e5ab36ae61f0642aad59939f528d31bda16
Switch the __x86.get_pc_thunk.{bx,cx} functions from .gnu.linkonce to
comdat section groups. lld doesn't implement .gnu.linkonce and will
instead discard the input sections. Currently, it might produce a
faulty binary that has no get_pc_thunk function in it, which would
crash.
Normally, these functions are generated by GCC and are present in many
object files compiled with PIC. Clang doesn't use them, and instead
initializes the PIC base register with a "call 1f; 1: pop %ebx" pair.
Bug: http://b/154376560
Bug: https://bugs.llvm.org/show_bug.cgi?id=45594
Test: bionic-unit-tests
Change-Id: I3e4857aecdc281b32232270bff4880433e5b6afa
Some applications may incorrectly assume that a "negative" pointer
indicates error. By setting the top bit in TBI mode, we catch these
cases as well. Although they don't directly indicate incompatibility
with MTE (as MTE uses the 2nd-highest nibble) - this ensures we catch
HWASan errors as well as reserve the bits for future MTE expansion.
Bug: 154272452
Test: Boot flame, device boots successfully.
Change-Id: I94a6821a82ce7ead59e6ca2dd113a5a50ee9e56b
This also removes the ScopedSignalBlocker, which doesn't seem to have
made any sense since threads were invented.
Test: treehugger
Change-Id: I9a323ab4a0b43f14fd5d1f0df1f80184aef63770
This actually breaks *all* the tests, because the bionic-unit-tests
binary crashes while running this ifunc before hwasan is set up.
A longer term fix would be to have the compiler insert a call to
__hwasan_init at the start of any ifunc resolvers.
Bug: 135772972
Test: ran tests on a hwasan build
Change-Id: I424b3035e1f76aa4b98c11346825b9ed140584ba
Previously, these tests would fail if vendors modified
private/android_filesystem_config.h to add their custom AIDs, but we
did not have a good alternative that vendors could use, so we added a
special case to ignore the vendor AID ranges.
We've had a proper solution since P for this range, so it's long past
time to remove this special case.
Test: add system, vendor, odm, product, and system_ext AIDs to
config.fs, ensure that they've taken effect on cuttlefish,
pass these unit tests
Change-Id: I6c9c2bf5e895c25805222da018188b269777171c
1) "fix the system properties design" is written for the old protocol,
so we've already changed the design. There are no other further
planned changes.
2) "don't drag in all the macros, just the types." is not likely to
happen or be particularly impactful.
3) "Find a location suitable for these functions ..." is refering to
legacy code. More likely that this code will be removed before we
find a serious reason to fix this TODO.
4) "(73062966) We still don't have a good way ..." is stale; we fixed
this bug and added the appropriate mechanism.
Test: n/a
Change-Id: I23991692cdeb81ad00844a6a1680900ff384208b
Kernel headers coming from:
Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-5.6
Add a new method for removing structures. This is to deal with the kernel
headers changing some definitions of timeval to __kernel_old_timeval
and itimerval to __kernel_old_itimerval. Remove the __kernel_old_XX
strutures and change the other structures to the previous definitions.
This only works so long as these structures stay the same, if they
diverge, then a different strategy will need to be implemented.
Test: Booted cuttlefish/walleye.
Test: Ran bionic-unit-tests on cuttlefish/walleye.
Change-Id: I0a61f4fa6e4155c602e0414d9b38c2e1637829af
The test was failing due to a kernel vDSO that was linked without
--eh-frame-hdr. The kernel bug is fixed for at least the goldfish and
cuttlefish devices.
3d4b1ffc7eb66f198bf3
Bug: http://b/132763120
Test: bionic unit tests, on goldfish and cuttlefish
Change-Id: I5e1d819b604a4baf5b9208f0b19471f9abbcfe75
When dump fdsan fd owner, happen NE. This because the format specifier
flag '#' is not supported by Bionic out_vformat<BufferOutputStream>.
Bug: 153611483
Test: jmgao@ verified manually
Change-Id: I7191c3b2b621ddcc0397874f8a69391e58232ac8
The marked library(ies) were available to the APEXes via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.
Bug: 150999716
Test: m
Change-Id: I6ea7fee2a135298085d3965d3578d9ecd53ee405
This constant is used by the experimental ptrace API for reading
tags in other processes.
Also expose the platform headers to libunwindstack.
Bug: 135772972
Change-Id: I2daecdaa4c8b557b42222f65fc6b68d13da84ad4
It's possible for malloc to return a pointer that is not going to
crash with __cfi_slowpath. It's possible to modify the cfi code
to avoid this problem, but I'm not convinced that this will be any
better at catching problems. So I'm just modifying the test so that
it will eventually allocate a pointer that does not overlap.
This previous version of the test failed on jemalloc svelte config,
but there is nothing that would not result in a failure on scudo
leading to a failure every once in a while.
Bug: 142556796
Bug: 140079007
Test: Ran bionic unit tests with jemalloc and scudo.
Change-Id: Iff45bd950d2eb33ff56dc700a2d739b5b578e090
The unwinder is still exported from libc.so.
Previously, the object files from libunwind_llvm.a were repackaged into
arm32's libc.a. For a static library output, whole_static_libs did not
repackage the symbols from libgcc_stripped, which is a
toolchain_library, so only the arm32 libc.a exported an unwinder.
Bug: http://b/153028957
Test: bionic-unit-tests / bionic-unit-tests-static
Change-Id: I3048179032d8bc08e1cbad7cd7e2b1fd2e213f7f
The question of why the unit tests need the bootstrap bionic came up
while I was working on http://b/152572170.
Test: none
Change-Id: I08651200e2193c6ea4d3a734b59f022d69e5f154
This was a side-effect of something else I was doing. May as well check
this in now though.
Test: treehugger
Change-Id: Ibe8a3640d309c1980fa6e8ef003d4f255384c9e7
The header library is used by some libraries, such as libunwind_llvm,
which are automatically added as dependencies when stl is set to
libc++_static. Since such dependencies are not specificy to any APEX,
let's mark the header library be available (can be directly or
indirectly be part of an APEX) to any APEX. At the same time, limit the
visibility of the header library so that its uses are strictly limited
to the certain places that we acknowledge. (the places would be reduced
further when we will be successful in dropping the dependency to
libc_headers.)
Bug: 152668052
Test: m
Change-Id: I85ee900947df2c9ce076e2f3aa3145645da77d2b
For the bootstrap linker, insert /system/${LIB}/bootstrap in front of
/system/${LIB} in any namespace search path.
Bug: http://b/152572170
Test: bionic unit tests
Change-Id: Ia359d9f2063f4b6fff3f79b51b500ba968a18247
If ElfReader::Read fails, then it is hazardous to leave the invalid
ElfReader in the soinfo*->ElfReader table, because a future soinfo
object could happen to have the same address, then reuse the invalid
ElfReader. I'm not sure whether this can break anything, because the
linker would call ElfReader::Read on the invalid object and overwrite
its previous value.
Test: bionic unit tests
Bug: none
Change-Id: Ibabbf559443441b9caeacc34ca165feaafe5e3a7
The doc_link argument is really a URL fragment within the
android-changes-for-ndk-developers.md document, not a filename at the
root of the bionic repository.
Test: manual
Bug: none
Change-Id: I1b542e47aca132ce43ba1d50d83db1bf3c7b10c6
The search_linked_namespaces parameter to find_library_internal is
always true.
Bug: none
Test: bionic tests
Change-Id: I4b6f48afefca4f52b34ca2c9e0f4335fa895ff34