Commit graph

33363 commits

Author SHA1 Message Date
Mitch Phillips
2210b8d542 [Tagged Pointers] Allow probing the current TP level w/ locking.
aosp/1484976 introduced a breaking change where
DisableMemoryMitigations() now indiscriminately turns tagged pointers
off. When android_mallopt(M_DISABLE_MEMORY_MITIGATIONS) is called, the
correct behaviour is:
 - In SYNC/ASYNC MTE mode -> disable all tagged pointers.
 - If all tagged pointers are already disabled -> nop.
 - If we're in TBI mode -> nop (keep the TBI mode as-is).

In order to do that we have to allow probing of the current heap tagging
mode. In order to prevent TOCTOU between GetHeapTaggingLevel() and
SetHeapTaggingLevel(), we expose a global mutex that should be held when
calling these functions.

Bug: 174263432
Test: atest CtsTaggingHostTestCases on Flame
Change-Id: Ia96f7269d542c9041270458806aee36766d2fbbb
2020-11-30 10:49:03 -08:00
Treehugger Robot
50a7621b3f Merge "[GWP-ASan] Remove include." 2020-11-20 04:19:54 +00:00
Mitch Phillips
742a003db6 [GWP-ASan] Remove include.
Unnecessary include, and the file was deleted with upstream changes.

Bug: N/A
Test: cd external/gwp_asan && atest
Change-Id: Id8facff0c5e382aa639ce158b7b5862ce157aa25
2020-11-19 16:01:14 -08:00
Peter Collingbourne
097846e25b Merge "Change the android_mallopt(M_SET_HEAP_TAGGING_LEVEL) API." 2020-11-18 20:57:36 +00:00
Peter Collingbourne
9eb85bf70c Change the android_mallopt(M_SET_HEAP_TAGGING_LEVEL) API.
- Make it apply to every thread, and thus remove the restriction
  that it must be called while the program is single threaded.
- Make it change TCF0 itself (on all threads), instead of requiring
  callers to do it themselves, which can be error prone.

And update all of the call sites.

Change the implementation of
android_mallopt(M_DISABLE_MEMORY_MITIGATIONS) to call
android_mallopt(M_SET_HEAP_TAGGING_LEVEL) internally. This avoids
crashes during startup that were observed when the two mallopts
updated TCF0 unaware of each other.

I wouldn't expect there to be any out-of-tree callers at this point,
but it's worth noting that the new interface is backwards compatible
with the old one because it strictly expands the set of situations in
which the API can be used (i.e. situations where there are multiple
threads running or where TCF0 hadn't been updated beforehand).

Bug: 135772972
Change-Id: I7746707898ff31ef2e0af01c4f55ba90b72bef51
2020-11-18 10:24:29 -08:00
Tej Singh
92b8588f17 Merge "Revert "Soft-enables new MAC address restrictions."" 2020-11-14 01:59:33 +00:00
Tej Singh
259776d8ff Revert "Soft-enables new MAC address restrictions."
Revert "Enforce RTM_GETLINK restrictions on all 3p apps"

Revert "Updates tests for untrusted app MAC address restrictions"

Revert submission 1450615-mac-address-restrictions

Reason for revert: DroidMonitor: Potential culprit for Bug 173243616 - verifying through Forrest before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted

Reverted Changes:
I08c709b2b:Enforce RTM_GETLINK restrictions on all 3p apps
I95d124ae8:Soft-enables new MAC address restrictions.
I5392f8339:Updates tests for untrusted app MAC address restri...
I9d214c5d0:Return anonymized MAC for apps targeting SDK < 30

Change-Id: If09920b24370077d647d60cfda7fc0a110b77851
2020-11-13 22:27:15 +00:00
Bram Bonné
7433096f06 Merge "Soft-enables new MAC address restrictions." 2020-11-12 17:07:11 +00:00
Treehugger Robot
8037f54614 Merge "Add "product_available" to product available modules" 2020-11-11 23:43:57 +00:00
Justin Yun
869a0faf21 Add "product_available" to product available modules
"vendor_available" modules were available to product modules.
However, not all "vendor_available" modules are required to be
available to product modules. Some modules want to be available only
to product modules but not vendor modules.

To cover the requirement, we separate "product_available" from
"vendor_available".
"vendor_available" will not provide product available module.

Bug: 150902910
Test: build
Change-Id: I13b8222e191333c6c2cb7794ef3344fdcc6ebe98
2020-11-11 15:29:47 +09:00
Treehugger Robot
f4afda9773 Merge "Disable failing test __cxa_demangle#cxa_demangle_fuzz_167977068." 2020-11-10 23:37:43 +00:00
Elliott Hughes
8589e0909c Disable failing test __cxa_demangle#cxa_demangle_fuzz_167977068.
Not sure what the problem is yet, and can't guarantee I'll have time to
look this week, so let's disable this for now...

Bug: http://b/172465723
Test: treehugger
Change-Id: I052c2ed876504581cb89e49f1c65c3232d213eb5
2020-11-10 11:31:51 -08:00
Elliott Hughes
6fc751cca8 Merge "linker: add ld.config.txt parse time to systrace." 2020-11-09 21:35:43 +00:00
Elliott Hughes
658b938700 linker: add ld.config.txt parse time to systrace.
Bug: http://b/172640358
Test: treehugger
Change-Id: I9d6b7c1e200d2effb737508d3c282063edefa888
2020-11-06 09:28:16 -08:00
Treehugger Robot
55180dda00 Merge "Improve __cxa_demangle#cxa_demangle_fuzz_167977068 diagnostics." 2020-11-06 17:02:22 +00:00
Elliott Hughes
f266f26cb7 Improve __cxa_demangle#cxa_demangle_fuzz_167977068 diagnostics.
Bug: http://b/172465723
Test: treehugger
Change-Id: I253a164f95705bd0cebe06483011b08187072691
2020-11-05 16:23:39 -08:00
Peter Collingbourne
56f1c406a5 Merge "Clear PAC bits in android_unsafe_frame_pointer_chase()." 2020-11-04 01:32:49 +00:00
Ryan Prichard
e9eae51539 Merge "Put __*_ARRAY__ symbols before prioritized init/fini funcs" 2020-11-03 22:19:57 +00:00
Elliott Hughes
718a5fd73e Merge "Add a couple of demangler tests." 2020-11-03 18:40:34 +00:00
Matthew Maurer
de30635eb6 Put __*_ARRAY__ symbols before prioritized init/fini funcs
A constructor or destructor function with an integral priority is
placed in an .init_array or .fini_array section with the priority
suffixed to the section name:
 - __attribute__((constructor)) ==> .init_array
 - __attribute__((constructor(42))) ==> .init_array.42

The suffixed init/fini sections appear before the unsuffixed sections,
so the prioritized functions appeared before the __{INIT,FINI}_ARRAY__
symbols and were dropped when the symbols were used.

The (static) linker doesn't recognize priority suffixes on
.preinit_array.

This bug affected .init_array and .fini_array for static executables.
For dynamic executables, only .fini_array was affected, because
.init_array is handled by the dynamic loader instead, which uses
DT_INIT_ARRAY[SZ]. For DSOs, neither is affected, because the two
sections are only handled by the dynamic loader.

This patch also fixes a minor inconsistency where dynamic init/preinit
were passed argc/argv/envp, but static were not.

Bug: http://b/170983066
Test: bionic-unit-tests
Change-Id: I0fffa776e5d9bdb6f8af06b4c1af148236742fef
2020-11-02 17:28:41 -08:00
Elliott Hughes
413817f69c Add a couple of demangler tests.
Bug: http://b/152588929
Test: treehugger
Change-Id: I4528e464f969e9167d459f292b179d14381d0f2e
2020-11-02 20:46:19 +00:00
Elliott Hughes
0c2350413e Merge "Docs: link to the unwinder docs." 2020-11-02 20:09:01 +00:00
Elliott Hughes
0427760a54 Docs: link to the unwinder docs.
Since (a) they're not a README.md and (b) they moved git project
recently, it's really hard to find these docs even if you know they
exist, which no-one does.

Test: N/A
Change-Id: Ic12e47ef5eb09e692ac0974b1d33bc5dc83d1028
2020-10-30 16:36:16 -07:00
Peter Collingbourne
a5c4b17e13 Clear PAC bits in android_unsafe_frame_pointer_chase().
Bug: 172057932
Change-Id: Ie0eb4800a6699f2094070e97e5157d4e9c186097
2020-10-30 14:36:37 -07:00
Treehugger Robot
10c2875934 Merge "getgrnam, getgrgid, getpwnam, getpwuid for host" 2020-10-29 23:53:50 +00:00
Yifan Hong
02bee7182e Merge "Make vendor_ramdisk_available." 2020-10-29 17:17:29 +00:00
Jiyong Park
bf383283d9 getgrnam, getgrgid, getpwnam, getpwuid for host
The functions now read /etc/group and /etc/passwd on host machines.
Android-specific IDs are not recognized in the host.

getpwent and getgrent are still not working though. They require a
bigger refactoring to sequentially advance in the database files.

Bug: 171718702
Test: run assemble_cvd in aosp_cf_arm64_phone
Change-Id: Ie8da382a467bbd0bffac7b4b8592cd871db80181
2020-10-29 07:52:54 +09:00
Yifan Hong
b04490d7e5 Make vendor_ramdisk_available.
Test: pass
Bug: 156098440
Change-Id: I8fe2deb8fa3b24c227202be02d8af648629cffeb
2020-10-27 17:06:45 -07:00
Treehugger Robot
c3ecfb623f Merge "system(3) uses /bin/sh when built for host" 2020-10-26 19:28:27 +00:00
Elliott Hughes
40aed73b5f Merge "Add DoNotOptimize and use it in tests." 2020-10-26 16:19:05 +00:00
Jiyong Park
8dd649deac system(3) uses /bin/sh when built for host
/system/bin/sh exists only on Android. When Bionic is built for the
host, use the standard /bin/sh.

Bug: 159685774
Test: run aosp_cf_arm64_phone on rockpi4
Change-Id: Idf4028c134abc128f203fc4d3be591f06b8fe8ff
2020-10-26 22:02:53 +09:00
Colin Cross
c44b1d0676 Merge "Make the connection between implementation and llndk_library explicit" 2020-10-23 18:09:42 +00:00
Treehugger Robot
c5617a4be7 Merge "Make more use of benchmark::DoNotOptimize in benchmarks." 2020-10-23 16:34:13 +00:00
Martin Stjernholm
d88c8eb6b0 Merge "Rename ART release APEX to com.android.art." 2020-10-23 10:03:24 +00:00
Elliott Hughes
e8693e7871 Make more use of benchmark::DoNotOptimize in benchmarks.
A lot of these benchmarks predate DoNotOptimize and rolled their own
hacks.

Bug: http://b/148307629
Test: ran benchmarks before & after and got similar results
Change-Id: If44699d261b687f6253af709edda58f4c90fb285
2020-10-22 13:43:59 -07:00
Elliott Hughes
7cda75f1d3 Add DoNotOptimize and use it in tests.
Bug: http://b/148307629
Test: treehugger
Change-Id: I3b1726ae55116f6553ea38fe163abdde179c21f0
2020-10-22 13:22:35 -07:00
Christopher Ferris
9aa6b15d79 Merge "Update to v5.9 kernel headers." 2020-10-22 00:54:16 +00:00
Martin Stjernholm
81c260d34b Rename ART release APEX to com.android.art.
Test: See https://r.android.com/1457217
Bug: 169639321
Change-Id: I71c75987ebfb1196d63f452945c5d387f2976d86
Merged-In: I71c75987ebfb1196d63f452945c5d387f2976d86
2020-10-21 15:41:02 +01:00
Ryan Prichard
72b1aaf68e Merge "Fix __cxa_atexit run-time regression with many registrations" 2020-10-21 00:44:50 +00:00
Peter Kalauskas
3f09b0ac2e Merge "Update module name referenced in README.md" 2020-10-20 17:17:29 +00:00
Treehugger Robot
38940f17ac Merge "Replace libandroidicu usage in bionic with the new libicu.so available in NDK" 2020-10-20 17:04:01 +00:00
Victor Chang
c0d50d4a37 Replace libandroidicu usage in bionic with the new libicu.so available in NDK
Bug: 160350521
Test: atest CtsBionicTestCases
Change-Id: Id5fa76872ec295674eb1bed3b66e037a04fe6bf8
2020-10-20 15:44:20 +01:00
Ryan Prichard
de523c02bb Fix __cxa_atexit run-time regression with many registrations
When an array element is added or removed, make only the relevant page
writable, rather than the entire array. The entire array is still made
writable during recompaction and expansion.

This change fixes most of a large regression in __cxa_atexit runtime
(blueline, taskset 10, performance governor, 100000 registrations,
times are in seconds)
 - Q: _Exit=0.292380, exit=0.626801
 - R: _Exit=28.435082, exit=95.785110
 - new: _Exit=0.352285, exit=0.713893

Test: bionic unit tests
Test: adb shell taskset 10 \
  /data/benchmarktest64/bionic-spawn-benchmarks/bionic-spawn-benchmarks \
  --benchmark_filter='atexit' \
  --benchmark_display_aggregates_only=true \
  --benchmark_repetitions=10
Bug: http://b/168043760
Change-Id: I88cc15c29c9890b422b7f621f29f98a03ca1f886
2020-10-20 01:10:33 -07:00
Ryan Prichard
b88edc6739 Merge "Add __cxa_atexit benchmark" 2020-10-20 04:03:50 +00:00
Kiyoung Kim
6dc330a714 Merge "Update linkerconfig configuration format" 2020-10-20 00:23:58 +00:00
Christopher Ferris
25c18d45cf Update to v5.9 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-5.9

Test: Boots cuttlefish 64bit, passes 32 bit and 64 bit bionic unit tests.
Change-Id: Ib5503355b238ea75595538e63eb000c867d06ef7
2020-10-19 15:48:58 -07:00
Colin Cross
8393a8bc84 Make the connection between implementation and llndk_library explicit
Instead of assuming a module with the .llndk suffix exists, add an
llndk_stubs property to every cc_library module that has a
corresponding llndk_library.  Also rename the llndk_library to have
an explicit .llndk suffix.

Bug: 170784825
Test: no changes to build.ninja (excluding comments) or Android-${TARGET_PRODUCT}.mk
Change-Id: Ib5453472a09ebc64818ceb69bcbe1184720ce86a
2020-10-19 13:37:49 -07:00
Ryan Prichard
a3d41ee176 Add __cxa_atexit benchmark
The benchmark calls __cxa_atexit 100000 times, then either exits early
without calling the destructors (_Exit) or exits normally, calling them
(exit).

Test: mmma bionic/benchmarks/spawn
Change-Id: I41fe702d6ef11acb7a1dec95bf546b5dc693bd4a
2020-10-16 17:55:54 -07:00
Baligh Uddin
bb34f8ddd3 Merge "Fix visibility rules." am: 8c8d3e7288
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1455917

Change-Id: I25a1ffae570aa9605feeeae92d5656ece072f071
2020-10-16 16:51:16 +00:00
Baligh Uddin
8c8d3e7288 Merge "Fix visibility rules." 2020-10-16 15:49:44 +00:00