Commit Graph

31176 Commits

Author SHA1 Message Date
Ryan Prichard c2a93792fc android_get_exported_namespace: acquire g_dl_mutex
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
2020-04-20 17:59:43 -07:00
Elliott Hughes 0361a4f867 Merge "tmpfile(3): use O_TMPFILE where available." 2020-04-17 23:29:24 +00:00
Peter Collingbourne 23ec1421b5 Merge "Add PTRACE_PEEKTAG to mte_kernel.h." 2020-04-17 18:16:05 +00:00
Treehugger Robot a06df5faef Merge "arc4random.h: remove some cruft." 2020-04-17 15:32:47 +00:00
Elliott Hughes bb575d93c4 arc4random.h: remove some cruft.
This hasn't been used since the code was rewritten years ago.

Test: builds
Change-Id: I2c4bccb3fffb15115083afbb178519bd133c64de
2020-04-16 23:14:38 +00:00
Elliott Hughes a4c2f33fc7 tmpfile(3): use O_TMPFILE where available.
This also removes the ScopedSignalBlocker, which doesn't seem to have
made any sense since threads were invented.

Test: treehugger
Change-Id: I9a323ab4a0b43f14fd5d1f0df1f80184aef63770
2020-04-16 16:12:03 -07:00
Elliott Hughes 38558bad85 Merge "Fix ifunc_test for hwasan builds." 2020-04-14 22:57:21 +00:00
Elliott Hughes 19b2ce8f38 Fix ifunc_test for hwasan builds.
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
2020-04-13 14:16:17 -07:00
Treehugger Robot 1ddfe48a9c Merge "Set apex_available property" 2020-04-11 04:59:53 +00:00
Tom Cherry 03581d7aa9 Merge changes I6c9c2bf5,I23991692
* changes:
  Tighten pwd/grp iteration tests.
  Cleanup some trivial TODOs.
2020-04-10 23:04:55 +00:00
Ryan Prichard e31b510f92 Merge "Reenable signal-frame-unwind test on x86" 2020-04-10 22:36:19 +00:00
Christopher Ferris 7edce006b1 Merge "Update to v5.6 kernel headers." 2020-04-10 22:02:10 +00:00
Tom Cherry 0816c9050f Tighten pwd/grp iteration tests.
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
2020-04-10 13:00:42 -07:00
Tom Cherry 6f2e810198 Cleanup some trivial TODOs.
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
2020-04-10 11:46:03 -07:00
Christopher Ferris bb9fcb4636 Update to v5.6 kernel headers.
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
2020-04-10 10:53:48 -07:00
Ryan Prichard 4eb02e2ccd Reenable signal-frame-unwind test on x86
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.

3d4b1ffc7e
b66f198bf3

Bug: http://b/132763120
Test: bionic unit tests, on goldfish and cuttlefish
Change-Id: I5e1d819b604a4baf5b9208f0b19471f9abbcfe75
2020-04-09 16:46:53 -07:00
Josh Gao 753994ab5a Merge "libfdtrack: When dump fdsan fd owner, happen NE" 2020-04-09 23:24:55 +00:00
Yuxian Xu 3a5ddd72c3 libfdtrack: When dump fdsan fd owner, happen NE
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
2020-04-09 12:46:58 -07:00
Jiyong Park 2aa19dcb59 Set apex_available property
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
2020-04-08 22:52:06 +09:00
Peter Collingbourne 6e316e6112 Add PTRACE_PEEKTAG to mte_kernel.h.
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
2020-04-07 16:49:36 -07:00
Orion Hodson eee26de4dc Merge "Remove unnecessary jni.h" 2020-04-07 14:01:40 +00:00
Orion Hodson e7042a740e Remove unnecessary jni.h
Discovered after removing implicit jni.h include path.

Bug: 152482542
Test: lunch aosp_x86_64 && m checkbuild
Change-Id: I5fcb33b110c8f5ee9db3c910eaaa3e6018979a45
2020-04-07 09:21:41 +01:00
Ryan Prichard a924442816 Merge "Stop exporting unwinder from arm32 libc.a" 2020-04-03 23:07:04 +00:00
Christopher Ferris bf8a50f597 Merge "Fix possible issue with cfi_basic test." 2020-04-02 17:40:17 +00:00
Christopher Ferris f322483b3f Fix possible issue with cfi_basic test.
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
2020-04-02 05:48:05 +00:00
Ryan Prichard 379e05fd5d Stop exporting unwinder from arm32 libc.a
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
2020-04-01 20:10:25 -07:00
Maciej Żenczykowski a120131779 Merge "icmp6.h - add captive portal and pref64 nd opts" 2020-04-02 02:37:19 +00:00
Maciej Żenczykowski 666b12e25a icmp6.h - add captive portal and pref64 nd opts
Test: builds
Bug: 150648313
Change-Id: I41bcd4d46c0736b613870dba382ebc079e5759d7
2020-04-01 20:54:45 +00:00
Treehugger Robot df93812f65 Merge "Explain why unit tests need bootstrap bionic" 2020-04-01 01:59:09 +00:00
Ryan Prichard 3c5dff4b1d Explain why unit tests need bootstrap bionic
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
2020-03-31 17:34:03 -07:00
Ryan Prichard df3dc8039d Merge changes Ia359d9f2,Ibabbf559,I1b542e47,I4b6f48af,I82e442f0
* changes:
  Fix bootstrap linker library searching
  Remove dangling soinfo* from elf_readers_map_
  Fix DL_WARN_documented_change URL
  remove search_linked_namespaces param
  Refactor linker lookup code a bit
2020-03-31 21:02:18 +00:00
Elliott Hughes dd8c4f84b2 Merge "Add documentation to <dirent.h>." 2020-03-31 15:26:59 +00:00
Treehugger Robot 445c9f95a7 Merge "libc_header is available to any apex but only visible to certain places" 2020-03-31 02:46:22 +00:00
Peter Collingbourne aed48830ac Merge "Switch to debugger_process_info in bionic." 2020-03-30 21:36:41 +00:00
Elliott Hughes 02f9f4cfb6 Add documentation to <dirent.h>.
This was a side-effect of something else I was doing. May as well check
this in now though.

Test: treehugger
Change-Id: Ibe8a3640d309c1980fa6e8ef003d4f255384c9e7
2020-03-30 14:26:35 -07:00
Peter Collingbourne ce8af7ff9e Merge "Move crash_dump into the runtime APEX." 2020-03-30 19:03:41 +00:00
Jiyong Park ad9946c09a libc_header is available to any apex but only visible to certain places
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
2020-03-30 18:36:07 +09:00
Florian Mayer e7221986c8 Merge "dynamic libc: ignore ART profiling signal by default." 2020-03-28 10:15:32 +00:00
Christopher Ferris 9268f77bd7 Merge "Remove bionic-unit-tests-scudo." 2020-03-28 01:48:54 +00:00
Ryan Prichard 40494406b8 Fix bootstrap linker library searching
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
2020-03-27 18:46:28 -07:00
Ryan Prichard 4fa6d9978a Remove dangling soinfo* from elf_readers_map_
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
2020-03-27 18:46:28 -07:00
Ryan Prichard 146620b644 Fix DL_WARN_documented_change URL
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
2020-03-27 18:46:28 -07:00
Ryan Prichard 323d7dfe90 remove search_linked_namespaces param
The search_linked_namespaces parameter to find_library_internal is
always true.

Bug: none
Test: bionic tests
Change-Id: I4b6f48afefca4f52b34ca2c9e0f4335fa895ff34
2020-03-27 18:46:28 -07:00
Ryan Prichard aa2db969dc Refactor linker lookup code a bit
Add a few _Nonnull / _Nullable annotations. Clang may use them to issue
warnings but violating the annotation isn't undefined behavior.

Bug: none
Test: bionic tests
Change-Id: I82e442f06a2c59c69bc0008f0f686785695cdd02
2020-03-27 18:46:28 -07:00
Christopher Ferris ca885cf249 Remove bionic-unit-tests-scudo.
This is not used at all any more since we've switched to scudo.

Test: Builds.
Change-Id: Iff0b7d4a5ea12103a68ad038de2d82bf5f864285
2020-03-27 17:04:30 -07:00
Florian Mayer 96272df35c dynamic libc: ignore ART profiling signal by default.
These solves the issue that targetting non-profilable apps crashed them.
There is still a race condition between starting the app and the SIG_IGN
being installed, but that will be fixed in follow-ups.

This also does not cover programs that statically link libc, but those are
rare.

This might be reverted if we find a more general solution to
b/151835887.

Bug: 151328035
Test: java profile sysui, doesn't crash
Test: atest CtsBionicTestCases

Change-Id: I6b99352ed50afe15a609f7ddb85312c2676ddf11
2020-03-27 19:22:00 +01:00
Treehugger Robot 2ec66b6a6a Merge "[GWP-ASan] Add gwp_asan_unittest to bionic presubmit." 2020-03-26 23:05:38 +00:00
Treehugger Robot e05c449cd8 Merge "Add ffsl(3), ffsll(3)." 2020-03-26 21:14:36 +00:00
Mitch Phillips cbf016504b [GWP-ASan] Add gwp_asan_unittest to bionic presubmit.
bionic libc has a dependency on GWP-ASan. Changes in bionic can also
affect GWP-ASan (e.g. GWP-ASan requires some headers from bionic for
tests). Resultingly, we shouldn't accidentally break GWP-ASan through
changes to bionic by adding this as a presubmit check.

Bug: 152414185
Test: cd bionic && atest
Change-Id: I15dac9da6a7b8dbba453cfabec995d79a0f71924
2020-03-26 13:23:19 -07:00
Elliott Hughes 4a6899ce0c Add ffsl(3), ffsll(3).
POSIX added these GNU extensions for issue 8.

I've made these always inline without the usual "until API level X"
proviso because they're single instructions that the compiler can inline
and there's really no point providing these if they add function call
overhead --- everyone should just use __builtin_ffs() and friends
instead in that case.

Bug: https://austingroupbugs.net/view.php?id=617
Test: treehugger
Change-Id: I33fc4b8648ea25917329e81c1b4c60eb9a66d667
2020-03-26 11:43:05 -07:00