Commit graph

31110 commits

Author SHA1 Message Date
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
Automerger Merge Worker
c61f25f47f Merge "[GWP-ASan] Don't intercept calloc." am: 95c772f734
Change-Id: Ifa001a6bcd53cdd9aa7491b2f9951ba387a1fdf0
2020-02-28 21:27:29 +00:00
Automerger Merge Worker
85cf71fa3d Merge "Switch to the arm-optimized-routines string routines on aarch64 where possible." am: ddedd9828b
Change-Id: I262dff78db57ccff995bc7fe8ca3d12206afb246
2020-02-28 21:27:20 +00:00
Treehugger Robot
95c772f734 Merge "[GWP-ASan] Don't intercept calloc." 2020-02-28 21:19:51 +00:00
Peter Collingbourne
ddedd9828b Merge "Switch to the arm-optimized-routines string routines on aarch64 where possible." 2020-02-28 21:15:24 +00:00
Mitch Phillips
5c65e87579 [GWP-ASan] Don't intercept calloc.
See linked bug for more information.

Bug: 150456936
Test: N/A
Change-Id: Ibdd4331d005cf488e24c238e67e46cee13198334
2020-02-28 16:58:23 +00:00
Automerger Merge Worker
d53f4f847d Merge "Update bionic to the v2 MTE patch set." am: 2dd382d9b6
Change-Id: I834d141534b9facc306e9f2f2a05b8c9a644e140
2020-02-28 16:54:25 +00:00
Peter Collingbourne
2dd382d9b6 Merge "Update bionic to the v2 MTE patch set." 2020-02-28 16:43:22 +00:00
Mitch Phillips
449c26a47d [GWP-ASan] [heapprofd] Fix infinite recursion between malloc-racing threads.
When the heapprofd lazy-initialization dispatch table is installed, two
threads can call malloc() at the same time. One will do the
lazy-initialization, the other will fail the atomic_exchange of
gHeapprofdInitHookInstalled and go to system malloc. The system malloc
still contains the lazy-init malloc, and will recurse.

Fix it so the second thread goes directly to the previous dispatch
table, or to the system allocator directly (instead of through libc
malloc()).

Bug: 150085813
Test: atest perfetto_integrationtests
Test: TracedPerfCtsTest.SystemWideDebuggableApp on cuttlefish x86.
Change-Id: Ia85ad619a0d5e3f558136d84c34dbada4e8b845d
2020-02-28 08:33:27 -08:00
Automerger Merge Worker
0b5e9257b3 Merge "Cleans up logging and comments in ifaddrs." am: 188f87a1b6
Change-Id: I111451f607c95e57bc106b6314f2b1c1a29bc6bb
2020-02-28 09:22:41 +00:00
Bram Bonné
188f87a1b6 Merge "Cleans up logging and comments in ifaddrs." 2020-02-28 09:07:20 +00:00
Peter Collingbourne
80af1b0a2c Update bionic to the v2 MTE patch set.
The values of some constants have changed, and the tag mask has changed from
being an exclusion mask to an inclusion mask.

Bug: 135772972
Change-Id: I322fceae7003bee6b391e7187194ed4c0cb28c58
2020-02-28 01:55:20 +00:00
Automerger Merge Worker
1622ac9a76 Merge "Handle the alternate signal stack correctly in android_unsafe_frame_pointer_chase." am: c00691aa9e
Change-Id: I698fa42731d09b15cda7e8100200ef3b2486692f
2020-02-28 01:41:06 +00:00
Peter Collingbourne
c00691aa9e Merge "Handle the alternate signal stack correctly in android_unsafe_frame_pointer_chase." 2020-02-28 01:28:37 +00:00
Automerger Merge Worker
7ebbfd329a Merge "[unit tests] Add '-mbranch-protection=standard' flag to arm64" am: 0dd87c37d4
Change-Id: Ie21ac0f0824be809d3793018ee73d74628d2a504
2020-02-27 22:26:28 +00:00
Treehugger Robot
0dd87c37d4 Merge "[unit tests] Add '-mbranch-protection=standard' flag to arm64" 2020-02-27 22:11:19 +00:00
Peter Collingbourne
b8d1348788 Handle the alternate signal stack correctly in android_unsafe_frame_pointer_chase.
If an alternate signal stack is set and the frame record is in bounds of
that stack, we need to use the top of the alternate signal stack for bounds
checking rather than the normal stack.

Bug: 150215618
Change-Id: I78b760d61b27da44f8e0cfee3fe94a791011fe58
2020-02-27 10:44:15 -08:00
Automerger Merge Worker
c5725110ed Merge "[GWP-ASan] [heapprofd] Nullptr deref in dispatch." am: c4f9c9d171
Change-Id: Iab3a808f494146de5840b4ac67db1122c67c8615
2020-02-27 18:18:29 +00:00
Mitch Phillips
c4f9c9d171 Merge "[GWP-ASan] [heapprofd] Nullptr deref in dispatch." 2020-02-27 18:04:08 +00:00
Bram Bonné
918bd72225 Cleans up logging and comments in ifaddrs.
To prevent unnecessary SELinux denials, the check referred to by the
comment is kept in place. This allows us to keep auditing the
SELinux denial in order to catch apps that intentionally send
RTM_GETLINK messages.

Fix: 141455849
Test: atest bionic-unit-tests-static
Test: atest NetworkInterfaceTest
Change-Id: I41e5ad6f071c820a8246177a0c629b3be788a942
2020-02-27 16:02:30 +01:00
Tamas Petz
d901ec6964 [unit tests] Add '-mbranch-protection=standard' flag to arm64
This change adds standard branch protection to bionic unit tests
for arm64 targets. For more information see
https://developer.arm.com/search#q=branch-protection

Both Armv8.3-A Pointer Authentication (using the A-key) hint-space
instructions and Armv8.5-A Branch Target Identification hint-space
landing pads are added to the generated code.

Test: 1. Tested on flame
      2. Tested on FVP

Change-Id: Ice991c538a9101448dea64c357f3f6bfb93877eb
2020-02-27 12:58:13 +01:00
Jooyung Han
26ddc4dccf Add 29 to stubs.versions of libc/libdl/libm
Stubs of version 29 should be provided to those APEX modules targeting
previous SDK release.

Bug: 145796956
Test: m
Change-Id: I9454fbf81377aba25e75a6fdfc77cbb070eaadde
2020-02-27 09:57:50 +00:00
Mitch Phillips
5f91bf42e3 [GWP-ASan] [heapprofd] Nullptr deref in dispatch.
Heapprofd uses an ephemeral dispatch table to ensure that GWP-ASan can
be called during heapprofd initialization. Previously, we grabbed the
backup dispatch table from the globals, which is wrong if GWP-ASan isn't
installed (as the malloc_dispatch_table is linker-initialised and not
set to a known good value if a malloc hooker isn't used).

Instead, grab the correct ephemeral dispatch table. When GWP-ASan is
installed, use a copy of its table as the dispatch. When nothing is
installed, fall back to using the native allocator dispatch.

Bug: 135634846
Bug: 150085813
Test: atest perfetto_integrationtests
Test: TracedPerfCtsTest.SystemWideDebuggableApp on cuttlefish x86.

Change-Id: I4beaf9192acadbe00adc02de2e0b0aab6f7a2190
2020-02-26 16:50:58 -08:00
Automerger Merge Worker
ebfaa8ba20 Merge "Override SIGSYS during profiling signal handler" am: 6cf75230d9
Change-Id: Ib2475be582e656b08326032fac55a061aa344372
2020-02-26 16:28:19 +00:00