Commit graph

31133 commits

Author SHA1 Message Date
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
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
Treehugger Robot
4b466292d0 Merge "Set apex_available property" 2020-03-26 10:16:03 +00:00
Treehugger Robot
284d93c83c Merge "[GWP-ASan] Allow libc header access from GWP-ASan." 2020-03-26 01:24:36 +00:00
Hans Boehm
a1ab838acc Merge "Increase iteration count for ordering test" 2020-03-26 01:21:19 +00:00
Mitch Phillips
3309b3dbb9 [GWP-ASan] Allow libc header access from GWP-ASan.
GWP-ASan is part of libc, and the tests (in future) will have to access
the internal headers of libc (particularly, the frame pointer unwinder).

Allow GWP-ASan to have access to the header package.

Bug: 152414185
Test: N/A
Change-Id: I09f771a667be867ec0acc90ddd6b52a432098c57
2020-03-25 15:05:48 -07:00
Hans Boehm
376106436c Increase iteration count for ordering test
This should make it less likely that the writer finishes before the
reader even starts. It makes the test run longer, but devices have
gotten faster suince this test was written.

Bug: 152218463
Test: Treehugger
Change-Id: I409e59071991095fb17e067760f2a5f29ede0ba2
2020-03-25 12:50:21 -07:00
Jiyong Park
922a5c7d75 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: Id5691b02c107ed7b844a186f0a5effa3cb0fe52a
2020-03-25 09:22:22 +09:00
Tom Cherry
2c1b058aaa Merge "Remove ANDROID_LOG_RDONLY" 2020-03-24 21:00:57 +00:00
Tom Cherry
1995d74baa Remove ANDROID_LOG_RDONLY
This macro hasn't been meaningful in years.

Test: logging unit tests
Change-Id: I849a466052524c24f1dba585a6423e80198c6b9c
2020-03-23 13:41:06 -07:00
Treehugger Robot
8d1849930f Merge "Rewrite sigwait tests in the style of the sigwaitinfo tests." 2020-03-21 01:36:16 +00:00
Treehugger Robot
0ebbed2347 Merge "Clean up untag_address." 2020-03-21 00:22:38 +00:00
Elliott Hughes
50fca4d2bd Rewrite sigwait tests in the style of the sigwaitinfo tests.
I can't reproduce locally, but treehugger is seeing 6% flake in the
signal.sigwait64_SIGRTMIN test. It's the only test in the file with a
sleep() in it, which always makes me suspicious, and we aren't having
trouble with the (in principle) very similar sigwaitinfo() tests, so
switch over to their style.

Bug: http://b/149934069
Test: treehugger
Change-Id: I2a1193b0cbec50f6548badf7dc7175bb6a49e45f
2020-03-20 16:27:57 -07:00
Peter Collingbourne
2528dab741 Clean up untag_address.
We had two copies of this function, one (not quite correct) in tests/utils.h
and another in bionic/macros.h. Delete the former and have the users include
the latter.

Also, create an overload of the function that takes a uintptr_t, which will
be useful for out-of-process scenarios such as the MTE support in debuggerd.

Bug: 135772972
Change-Id: Ia3c2652c97797663146b3f05fa786afe09f7ea97
2020-03-20 15:35:54 -07:00
Treehugger Robot
2a069b24df Merge "Revert "Statically link libdl.a to linker"" 2020-03-18 16:05:54 +00:00
Jooyung Han
274e21fdb6 Revert "Statically link libdl.a to linker"
This reverts commit 8dba7fefb0.

Reason for revert: This workaround is not necessary with ag/10700799

Merged-In: I2bf469bfe00f3a70e67085abfb3822db6908d522
Change-Id: If351aedfce23d60582f0c5ff965f94356d1900d9
Bug: 150860940
2020-03-18 08:45:25 +00:00
Treehugger Robot
24ffa67caf Merge "Update linkerconfig missing message to warning" 2020-03-17 02:04:06 +00:00
Kiyoung Kim
8bc0353dbc Update linkerconfig missing message to warning
Update message that generated linker configuration is missing to from
into to warning again. Also do not raise this message from host
environment which is expected.

Bug: 146386369
Test: m -j passed
Change-Id: Ia5c2969d77fbc70e0406fbb449920080989a1ea8
2020-03-17 09:52:55 +09:00
Mitch Phillips
d92b03887d Merge "[GWP-ASan] Intercept calloc() again." 2020-03-16 20:18:04 +00:00
Mitch Phillips
32abb0b81e [GWP-ASan] Intercept calloc() again.
Bug: 150456936
Test: N/A

Change-Id: Id273e1811f9919c8bdbdbf0ad850421e7c1cd8da
2020-03-16 20:17:39 +00:00
Christopher Ferris
69046e0842 Merge "Disable branch protection for arm64." 2020-03-13 16:19:19 +00:00
Christopher Ferris
140220bd23 Disable branch protection for arm64.
This causes failures in signal handler tests, because it looks like clang
doesn't understand how to enable the stack protection in a signal handler.
Clang winds up scribbling on the real stack.

Bug: 149934069
Bug: 151372823

Test: Ran all unit tests on bonito/taimen and the signal handler tests pass.
Change-Id: If73f55e7505b6d7f35b340be0b03c798b21e2829
2020-03-13 00:18:42 +00:00
Florian Mayer
c84d295f7c Merge "Add explicit state for heapprofd hooking." 2020-03-12 17:12:17 +00:00
Florian Mayer
fdd5eb1977 Add explicit state for heapprofd hooking.
The double hooking is currently controlled by two separate atomic
booleans. In this state, it is very hard to guard against very subtle
race conditions. Adding an explicit enum to encode the state makes it
easier to reason about the behaviour of the program.

Also introduce a MaybeModifyGlobals to consistently guard accesses to
globals. We would sometimes modify them without swapping the
gGlobalsMutating, introducing a window for race with
HandleHeapprofdSignal.

Test: while true; do atest HeapprofdCtsTest; done
Test: flash blueline and manually test profile
Bug: 150741354
Change-Id: I77102b0bd906b8ec2d6806bd43ba6cbf7191e37c
2020-03-11 10:21:27 -07:00
Jiyong Park
bd6a5570bb Merge "Statically link libdl.a to linker" 2020-03-11 07:55:32 +00:00
Jiyong Park
8dba7fefb0 Statically link libdl.a to linker
When libbase is built for an APEX, it uses dlsym to reflectively access
liblog symbols that are added in R. This is because the APEX where
libbasse is packaged into might be running in pre-R devices where the
symbols don't exist in liblog.so.

This however causes a problem for a static executable in an APEX. Since
it is in an APEX, the dlsym is used. But libdl.so which provides dlsym
is not available to static executable. Currently, the dynamic linker is
the only executable in an APEX that all of its dependencies are
statically linked. Fixing the issue by providing fake dlsym by
statically linking to libdl.a.

Exempt-From-Owner-Approval: cherry-pick rvc-dev

Bug: 149569129
Test: m

Merged-In: I2e9e45d9876c2d6c878e541715389e6d1ef56996
(cherry picked from commit ec829ed4ea)
Change-Id: I2e9e45d9876c2d6c878e541715389e6d1ef56996
2020-03-11 07:53:47 +00:00
Treehugger Robot
ae35f675bb Merge "Delete definitions of __aeabi_unwind_cpp_pr0." 2020-03-10 18:30:30 +00:00
Ryan Prichard
7aa6ba4aec Merge "Rewrite __cxa_atexit / __cxa_finalize" 2020-03-09 21:00:58 +00:00
Treehugger Robot
7d97c36b3f Merge "Add 29 to stubs.versions of libc/libdl/libm" 2020-03-07 08:44:32 +00:00
Ryan Prichard
afa983c8d4 Rewrite __cxa_atexit / __cxa_finalize
Simplify:
 - Use a single memory-mapped region to hold the table of destructors.
   Double its capacity each time it is expanded.
 - Add a recompaction pass at the end of __cxa_finalize that shifts
   entries forward and uses madvise to clean pages.

Bug: http://b/148055738
Test: bionic-unit-tests
Change-Id: Ieb9da2b88640a8a5277d217b43826b5b7e246781
2020-03-06 21:04:32 -08:00
Bill Yi
1a1888f801 Merge "Merge stage-aosp-master to aosp-master - DO NOT MERGE" 2020-03-05 18:27:31 +00:00
Bill Yi
3fc9c80e91 Merge stage-aosp-master to aosp-master - DO NOT MERGE
Change-Id: I402904753a20804e8709e8873e1a8962bb2d8056
2020-03-05 09:50:54 -08:00
Automerger Merge Worker
138897d14a Merge "Fix bugprone-macro-parentheses warnings" am: 608c74aecf
Change-Id: Ie9fee69253e70ad129eadd2d8d78d8beb1498918
2020-03-05 05:40:25 +00:00
Chih-hung Hsieh
608c74aecf Merge "Fix bugprone-macro-parentheses warnings" 2020-03-05 05:18:32 +00:00
Chih-Hung Hsieh
fa658eb094 Fix bugprone-macro-parentheses warnings
Bug: 150783705
Test: WITH_TIDY=1 make
Change-Id: If47b7adaa5f3ba3c518fb0be48f0ffdc81d204b2
2020-03-04 13:22:05 -08:00
Automerger Merge Worker
ada3844361 Merge "Remove return after GTEST_SKIP." am: b274746dd3
Change-Id: I3565a970f6d8accbb446ca52ef31eafe7c931129
2020-03-04 19:18:09 +00:00
Treehugger Robot
b274746dd3 Merge "Remove return after GTEST_SKIP." 2020-03-04 18:29:33 +00:00
Automerger Merge Worker
205790270a Merge "Update the scudo wrapper for bionic changes." am: 93517d1a27
Change-Id: I60f8ee282dbe8bb42ef0e87a00f5f31d1d0e58b3
2020-03-03 19:21:16 +00:00
Christopher Ferris
93517d1a27 Merge "Update the scudo wrapper for bionic changes." 2020-03-03 18:52:00 +00:00
Elliott Hughes
edaf03ea18 Remove return after GTEST_SKIP.
Test: treehugger
Change-Id: I5efc31f82a979fcd8d3051c72ed8e6201b3b0d1b
2020-02-28 18:27:09 -08:00
Automerger Merge Worker
8bd2ab6a26 Merge "[GWP-ASan] [heapprofd] Fix infinite recursion between malloc-racing threads." am: 0d303b42b5
Change-Id: I99b2dcb85dd7798f38319af16eefb7a31ae1bc39
2020-02-28 23:39:27 +00:00
Mitch Phillips
0d303b42b5 Merge "[GWP-ASan] [heapprofd] Fix infinite recursion between malloc-racing threads." 2020-02-28 23:18:14 +00:00
Christopher Ferris
2c447b0586 Update the scudo wrapper for bionic changes.
Bug: 137795072

Test: Built using jemalloc, and verified that the two processes that
Test: use libc_scudo do not crash.
Change-Id: Icf773b656d7e2bcdf41b4979e9b6cd980b02d34d
2020-02-28 14:34:13 -08:00