There's a weird POSIX special case that we implement but don't test.
Found from looking through the coverage data.
Test: treehugger
Change-Id: I74f5f57c4d8062034a3f6e986f9e57091bfc7f7c
This works around buggy applications that read a few bytes past the
end of their allocation, which would otherwise cause a segfault with
the concurrent Scudo change that aligns large allocations to the right.
Because the implementation of
android_set_application_target_sdk_version() lives in the linker,
we need to introduce a hook so that libc is notified when the target
SDK version changes.
Bug: 181344545
Change-Id: Id4be6645b94fad3f64ae48afd16c0154f1de448f
Disable debuggerd for these expected failures.
Also use the usual naming pattern.
Bug: http://b/180605583
Test: check logs
Change-Id: I0254cb658d8a68e963ef59264106de4775e3fedd
I'm assuming this was useful while debugging, but isn't needed now.
Bug: http://b/180605583
Test: check logs
Change-Id: I9d5bb8db60e7709a9a52e29469f7fd1d5a9cb085
We just want to check that SIGFPE is raised, not try to "debug" this
expected behavior.
Bug: http://b/180605583
Test: check logs
Change-Id: I11571e02c4608570e0d406adeabc36186c5bb107
These were creating tombstones and spewing to the log.
You need TEST_F() rather than TEST(), and the modern style is apparently
to use `using` rather than an empty subclass.
Bug: http://b/180605583
Test: run tests, check logcat
Change-Id: I1e639d34854aeff6f042c24643b769a6bcfab877
The existing attempt at a death test wrapper wasn't functional (because
the tests were TEST rather than TEST_F), and the code in that class
doesn't work anyway. Since I don't understand the intent behind the
failing dup2() calls, I've just removed this and replaced it with
BionicDeathTest which we do need to suppress all the debuggerd work
which caused this bug to be filed.
Bug: http://b/180605583
Test: treehugger
Change-Id: I7717f7ae2620452656cf07db299774dadef55766
The example in the bug was 16ms instead of 10ms. Try 20ms?
Bug: http://b/180581857
Test: treehugger
Change-Id: I58302ad576ab5a031124244edef9df733d796c7e
This is undefined behavior, but glibc and macOS are both lenient, and
someone hit this in the wild, so we may as well be lenient too. (The
only cost is that it's now slightly easier to write code that works on
everything except old versions of Android.)
Bug: https://issuetracker.google.com/180598400
Test: treehugger
Change-Id: Ia217169ea6283cc53f4fbf71e5abfa08356c2049
Auto-generate NOTICE files for all the directories, and for each one
individually rather than mixing libc and libm together.
Test: N/A
Change-Id: I7e251194a8805c4ca78fcc5675c3321bcd5abf0a
This reverts commit 315969a67e.
Reason for revert: r407598b has llvm.org/D90898, which should fix the test.
Change-Id: I466e2122a700ba4df9160b57a5d3c94867472615
This has been in the standard since C99, but we've never supported it
before. It's apparently used by SPIRV-Tools.
I tried implementing this the other way (with fcntl(2)) first, but
eventually realized that that's more complicated and gives worse
results. This implementation assumes that /proc is mounted, but so much
of libc relies on that at this point that I don't think there's any
realistic case where the fcntl(2) implementation would be preferable,
and there are many where it's not.
The fact that no-one's mentioned this until now suggests that it's not a
heavily used feature anyway.
I've also replaced AssertCloseOnExec() with a CloseOnExec()
boolean-valued function instead, because it's really annoying getting
assertion failures that don't point you at the test line in question,
and instead point to some common helper code.
Test: treehugger
Change-Id: Ia2e53bf2664a4f782581042054ecd492830e2aed
This timed out the invocation when trying to run all cc_test, excluding it from unit tests.
Change-Id: I67758d5e49b607b7c10052bc193d885d9123bedf
Test: presubmit
Bug: 179092189
* When clang-tidy is called, its checks
gave different diagnostic messages.
Bug: 178534530
Test: mm with WITH_TIDY=1
Change-Id: I5eec8239d5531f88caefca3c4032f9764deb9e09
Introduces new heap-zero-init API. We've realised that it's better to be
able to individually control MTE and heap zero-init. Having
heap-zero-init not be controllable without affecting MTE affects our
ability to turn off heap-zero-init in zygote-forked applications.
Bug: 135772972
Test: On FVP: atest -s localhost:5555 malloc#zero_init \
Test: malloc#disable_mte heap_tagging_level
Change-Id: I8c6722502733259934c699f4f1269eaf1641a09f
During "step 1" of find_libraries, the linker finds the transitive
closure of dependencies, in BFS order. As it finds each library, it
adds the library to its primary namespace (so that, if some other
library also depends on it, find_loaded_library_by_soname can find the
library in the process of being loaded).
LD_PRELOAD libraries are automatically marked DF_1_GLOBAL, and any
DF_1_GLOBAL library is added to every linker namespace. Previously,
this secondary namespace registration happened after step 1. The result
is that across different namespaces, the order of libraries could vary.
In general, a namespace's primary members will all appear before
secondary members. This is undesirable for libsigchain.so, which we
want to have appear before any other non-preloaded library.
Instead, when an soinfo is added to its primary namespace, immediately
add it to all the other namespaces, too. This ensures that the order of
soinfo objects is the same across namespaces.
Expand the dl.exec_with_ld_config_file_with_ld_preload and
dl.exec_with_ld_config_file tests to cover the new behavior. Mark
lib1.so DF_1_GLOBAL and use a "foo" symbol to mimic the behavior of a
signal API interposed by (e.g.) libsigchain.so and a ASAN preload.
Test: bionic unit tests
Bug: http://b/143219447
Change-Id: I9fd90f6f0d14caf1aca6d414b3e9aab77deca3ff
These are available from mallopt() now, and all callers have been
switched over.
Bug: http://b/135772972
Test: treehugger
Change-Id: I90c7a7573b261c27001a2dfd4589b23861ad613b
This flag is required to filter out shared VMAs when compacting memory
using process_madvise.
Test: atest bionic-unit-tests-static
Bug: 173258203
Change-Id: I01fc0cc614b03128a5a9b0a6c8c5c2d829b701f9
The current libunwind.a LLVM prebuilt lacks the special arm64 signal
frame unwinder (https://reviews.llvm.org/D90898), so disable the signal
frame unwinding tests temporarily. (It's not clear who needs this
functionality on Android -- typically crash dumping should use
libunwindstack instead of _Unwind_Backtrace.)
Bug: http://b/153025717
Test: bionic unit tests
Change-Id: I36644dfe4acbedd937768c3aaaad1010099d602c
These were only available internally via android_mallopt(), but they're
likely to be needed by more code in future, so move them into mallopt().
This change leaves the android_mallopt() options for now, but I plan on
coming back to remove them after I've switched the handful of callers
over to mallopt() instead.
Bug: http://b/135772972
Test: treehugger
Change-Id: Ia154614069a7623c6aca85975a91e6a156f04759