Commit graph

36110 commits

Author SHA1 Message Date
Elliott Hughes
3023bd3b52 Merge "CFI uses SIGTRAP on arm/arm64." am: 9b16a91b60 am: a32d98d3d0
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1986466

Change-Id: I59f9e23851d83250c366d0ea2c7e6722802c8de3
2022-02-16 18:30:35 +00:00
Elliott Hughes
a32d98d3d0 Merge "CFI uses SIGTRAP on arm/arm64." am: 9b16a91b60
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1986466

Change-Id: If0fee83402cd9f76ad5ccbdf035f6d625d249472
2022-02-16 18:09:10 +00:00
Elliott Hughes
9b16a91b60 Merge "CFI uses SIGTRAP on arm/arm64." 2022-02-16 17:45:27 +00:00
Elliott Hughes
82e24a579d CFI uses SIGTRAP on arm/arm64.
Not sure how treehugger missed this, but "growler" followed up pretty
quickly, so that's something...

Bug: http://b/219758263
Test: treehugger
Change-Id: I8e4afa31aee975740d10eb2acec51d2f4f1fa414
2022-02-15 14:04:44 -08:00
Elliott Hughes
60d170f001 Merge "Silence the CFI death tests." am: ab74e3260a am: 669a50c82e
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1978572

Change-Id: Ice9bf9a715146532f391239472bb2f684d070b4f
2022-02-14 21:49:47 +00:00
Elliott Hughes
669a50c82e Merge "Silence the CFI death tests." am: ab74e3260a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1978572

Change-Id: If9bfda5930315270b195853e9f0c0fae3c8d7915
2022-02-14 21:36:25 +00:00
Elliott Hughes
ab74e3260a Merge "Silence the CFI death tests." 2022-02-14 21:23:08 +00:00
Ryan Savitski
ab768e6905 Merge "profiling: override dumpability while opening /proc/self/mem,maps" am: d80b20b36e am: 9a4a528cdb
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1973905

Change-Id: I71deff8a521afec4b74fcd2f7708a43b745f5b31
2022-02-14 14:18:52 +00:00
Ryan Savitski
9a4a528cdb Merge "profiling: override dumpability while opening /proc/self/mem,maps" am: d80b20b36e
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1973905

Change-Id: I514622f7eda0d52e3055f18a87019c5ea0732fe3
2022-02-14 14:00:54 +00:00
Ryan Savitski
d80b20b36e Merge "profiling: override dumpability while opening /proc/self/mem,maps" 2022-02-14 13:42:57 +00:00
Elliott Hughes
4411b940b9 Silence the CFI death tests.
We don't want expected crashes showing up in the automated crash
reporting!

Bug: http://b/210932139
Test: treehugger
Change-Id: I6b232f0808cdcd39739f249236177cabc40669b1
2022-02-11 13:16:50 -08:00
Xin Li
7416bc9a60 [automerger skipped] Empty merge of sc-v2-dev-plus-aosp-without-vendor@8084891 am: 05aae9355f -s ours
am skip reason: Merged-In I21c4374d7e55dbbb2294cef5cc7bf50b7fe1b549 with SHA-1 57f17dea20 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/16843137

Change-Id: Ic175686e84cbfe60d224c92903b2916be84bb81d
2022-02-11 20:34:11 +00:00
Ryan Savitski
d4aa14d9dd profiling: override dumpability while opening /proc/self/mem,maps
For the perf profiling signal handler to succeed in opening
/proc/self/mem, the process needs to be marked as dumpable in posix
terms. This patch addresses a scenario since Android S where the process
is considered profileable, but is not dumpable on "user" builds. The
solution is to mark the process as dumpable while opening the procfs
descriptors, restoring the original value afterwards. This is the same
approach as the heapprofd heap profiler, which performs the override
within the loaded client library [1].

The particular scenario being addressed is:
* user build
* app does not explicitly opt into being profiled by shell
* app does not explicitly opt out of all profiling
In this case, the app is considered profileable by the platform (but NOT
shell). Therefore ActivityThread marks the process as profileable [2],
but the zygote keeps the process as undumpable as it considers the
profileability from the shell domain [3]. We could change the logic in
the zygote to leave such processes in the dumpable state, but the
override within the signal handler is considered to be more contained as
the dumpability is only needed temporarily.

This override would also apply for any non-dumpable native services that
are signalled for profiling, which is also desireable for profiling
coverage.

This change does not elide any of the existing profileability
checks by the signal handler's preamble and the profiler itself.

[1]
https://cs.android.com/android/platform/superproject/+/master:external/perfetto/src/profiling/memory/client.cc;l=184;drc=78cd82ba31233ce810618e07d349fd34efdb861d
[2]
https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/app/ActivityThread.java;l=6610;drc=de9cf3392d7872c2bee69b65a614e77bb166b26e
[3]
https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/jni/com_android_internal_os_Zygote.cpp;l=1680;drc=master

Tested: clock app on barbet-user succeeds in opening the procfs
descriptors within the signal handler.
Tested: systemwide profiling on sargo-userdebug works as before.
Bug: 196810669
BYPASS_INCLUSIVE_LANGUAGE_REASON=referencing the name of a cmdline utility
Change-Id: Id621d4312418ff0736c97065e9ee577ff67f40da
2022-02-11 16:31:24 +00:00
Xin Li
05aae9355f Empty merge of sc-v2-dev-plus-aosp-without-vendor@8084891
Bug: 214455710
Merged-In: I21c4374d7e55dbbb2294cef5cc7bf50b7fe1b549
Change-Id: I8cb6f52a8f5f8a10c9490c101a6c39140787c96b
2022-02-11 06:10:31 +00:00
Treehugger Robot
c86d041757 Merge "[MTE] Relax ELF note." am: 24f9dab407 am: 3354e0287a am: 0e02decefc
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1975286

Change-Id: I0495e4de13638ab432b990c329c83babdb3ab6b2
2022-02-09 00:31:54 +00:00
Treehugger Robot
0e02decefc Merge "[MTE] Relax ELF note." am: 24f9dab407 am: 3354e0287a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1975286

Change-Id: I0d948a7eaa8f26ae254777a4fc79bb5a2f098ce5
2022-02-09 00:18:53 +00:00
Treehugger Robot
3354e0287a Merge "[MTE] Relax ELF note." am: 24f9dab407
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1975286

Change-Id: I6389991190299c73b026685f6f189f7d27c3aeeb
2022-02-09 00:00:31 +00:00
Treehugger Robot
24f9dab407 Merge "[MTE] Relax ELF note." 2022-02-08 23:41:17 +00:00
Mitch Phillips
9425b16978 [MTE] Relax ELF note.
Currently, the ELF note parsing in the loader is not permissive. This
patch relaxes the restrictions on the bits of the ELF note that could be
extended in the future.

This may allow more MTE options in apexes. If we add some extra metadata
bit (say, in bit 5) in the future, and then build MTE into every apex,
we don't want it to crash on Android 13 devices (we'd much rather it
just be a no-op).

Remove the (unused anywhere) NT_MEMTAG_DEFAULT and call it
NT_MEMTAG_NONE.

And finally, make the tests work on bionic-unit-tests-static. We
previously didn't deploy the test binaries, so add them as a data
dependency.

Bug: N/A
Test: atest bionic-unit-tests-static
Change-Id: I13530faad55c719c6eb848297f8ce378e18afbfc
2022-02-08 13:17:18 -08:00
Treehugger Robot
91f481cd33 Merge "Avoid duplicate genrule locations" am: c81de9373a am: 998996d7de am: 36d59016eb
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1976306

Change-Id: Id9819e18dbe137dbe3f0bdae929b6b2772c67a14
2022-02-08 20:44:10 +00:00
Treehugger Robot
36d59016eb Merge "Avoid duplicate genrule locations" am: c81de9373a am: 998996d7de
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1976306

Change-Id: I41b3eaf794f04321588b1a1e2696d0da8f019f30
2022-02-08 20:27:36 +00:00
Treehugger Robot
998996d7de Merge "Avoid duplicate genrule locations" am: c81de9373a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1976306

Change-Id: I5dd0710dfaa5b53b0f3227a414e96390e962b654
2022-02-08 20:13:53 +00:00
Treehugger Robot
c81de9373a Merge "Avoid duplicate genrule locations" 2022-02-08 19:36:40 +00:00
Treehugger Robot
1066ef123b Merge "[MTE] add sysprop to set mte state globally" am: 2be3e92943 am: 3e3a2ffa68 am: d914acc3cc
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1959650

Change-Id: Ib494ff5454e2ba5e0e2c7bba63d7b43d554d406e
2022-02-08 19:24:21 +00:00
Treehugger Robot
d914acc3cc Merge "[MTE] add sysprop to set mte state globally" am: 2be3e92943 am: 3e3a2ffa68
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1959650

Change-Id: I5e1b3732c750f33938de95e8e091bff336b5fac5
2022-02-08 19:03:34 +00:00
Treehugger Robot
3e3a2ffa68 Merge "[MTE] add sysprop to set mte state globally" am: 2be3e92943
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1959650

Change-Id: I85c7fd124b033611ee5a8903c87a662bf7462fb4
2022-02-08 18:41:07 +00:00
Treehugger Robot
2be3e92943 Merge "[MTE] add sysprop to set mte state globally" 2022-02-08 16:47:32 +00:00
Colin Cross
aeef9f04d4 Avoid duplicate genrule locations
The bp2build build is failing with:
ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:execinfo/include/execinfo.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers'
ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:kernel/android/uapi/linux/compiler.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers'
ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:b64/include/bionic/b64.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers'
ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:kernel/uapi/linux/capability.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers'
ERROR: /buildbot/src/android/master/out/soong/workspace/bionic/libc/BUILD.bazel:3187:8: Label '//bionic/libc:kernel/android/scsi/scsi/scsi.h' is duplicated in the 'srcs' attribute of rule 'libc_musl_sysroot_bionic_headers'

Rewrite the genrule to avoid referring to the same header twice by
using the NOTICE file as a known location in the bionic/libc directory.

Bug: 190084016
Bug: 218405924
Test: libc_musl_sysroot.zip has same contents
Change-Id: Id1a0484a3ed623bcc03b015d02eef19bbb31c06a
2022-02-07 21:08:41 -08:00
Treehugger Robot
e37c2a5be7 Merge changes from topics "musl_execinfo", "musl_mallinfo", "musl_sysroot" am: b60ce71254 am: e7e7ea069a am: c0ae73a2de
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1971623

Change-Id: Ic1b11a59a7d86f4c9b956e5195240533036afd54
2022-02-08 02:30:16 +00:00
Treehugger Robot
c0ae73a2de Merge changes from topics "musl_execinfo", "musl_mallinfo", "musl_sysroot" am: b60ce71254 am: e7e7ea069a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1971623

Change-Id: Ie7aee81c6ac5b5a5030de87704518d39f16883b6
2022-02-08 02:13:41 +00:00
Treehugger Robot
e7e7ea069a Merge changes from topics "musl_execinfo", "musl_mallinfo", "musl_sysroot" am: b60ce71254
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1971623

Change-Id: I1b8b1bcb4840544c368714155a7473cb1f75a3a4
2022-02-08 01:57:33 +00:00
Treehugger Robot
b60ce71254 Merge changes from topics "musl_execinfo", "musl_mallinfo", "musl_sysroot"
* changes:
  Disable fortify tests for musl
  Export kernel uapi, execinfo and b64 headers to musl sysroot
  Export bionic's resolv base64 functions to musl
  Export bionic's execinfo functions to musl
  Enable mallinfo tests for musl
  Fix bionic benchmarks and header tests for musl
2022-02-08 01:32:59 +00:00
Ryan Prichard
ec0710d414 Merge changes Ie92399c9,Ic6f05388 am: 6f0c44eebc am: ac2b3304df am: f74225444c
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1956680

Change-Id: I7ea26eafe991d4f547b6455dddf7ee6c93de167b
2022-02-08 01:03:00 +00:00
Treehugger Robot
458b35e685 Merge "[NFCI] Change Android's NT_TYPE to NT_ANDROID_TYPE." am: 128475fd8c am: 606ea33a2a am: 0b2a7a44dd
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1975227

Change-Id: I1946b2d4bd4b813c9b10364a4e969891b88b4744
2022-02-08 01:02:29 +00:00
Ryan Prichard
f74225444c Merge changes Ie92399c9,Ic6f05388 am: 6f0c44eebc am: ac2b3304df
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1956680

Change-Id: I8b00b7776456e2b4fbc67dff8c746d2c4c92731b
2022-02-08 00:45:47 +00:00
Treehugger Robot
0b2a7a44dd Merge "[NFCI] Change Android's NT_TYPE to NT_ANDROID_TYPE." am: 128475fd8c am: 606ea33a2a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1975227

Change-Id: I87f431125e31ef05f7b8410c9d5e0ee4dd8f1753
2022-02-08 00:45:00 +00:00
Ryan Prichard
ac2b3304df Merge changes Ie92399c9,Ic6f05388 am: 6f0c44eebc
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1956680

Change-Id: I76eb1679a27ae2cea6927a656114695b777903f7
2022-02-08 00:21:58 +00:00
Treehugger Robot
606ea33a2a Merge "[NFCI] Change Android's NT_TYPE to NT_ANDROID_TYPE." am: 128475fd8c
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1975227

Change-Id: Id29efc7ce3b99e0ec21edcccb942331cd20e2f2d
2022-02-08 00:20:40 +00:00
Ryan Prichard
6f0c44eebc Merge changes Ie92399c9,Ic6f05388
* changes:
  Change default block size alignment to be 4 for memory saving on 32-bit arch
  Keep allocation of `tail_` outside of LinkedList
2022-02-08 00:11:08 +00:00
Treehugger Robot
128475fd8c Merge "[NFCI] Change Android's NT_TYPE to NT_ANDROID_TYPE." 2022-02-08 00:04:46 +00:00
Mitch Phillips
93400371f7 [NFCI] Change Android's NT_TYPE to NT_ANDROID_TYPE.
Normally, platform-specific note types in the toolchain are prefixed
with the platform name. Because we're exposing the NT_TYPE_MEMTAG and
synthesizing the note in the toolchain in an upcoming patch
(https://reviews.llvm.org/D118948), it's been requested that we change
the name to include the platform prefix.

While NT_TYPE_IDENT and NT_TYPE_KUSER aren't known about or synthesized
by the toolchain, update those references as well for consistency.

Bug: N/A
Test: Build Android
Change-Id: I7742e4917ae275d59d7984991664ea48028053a1
2022-02-07 13:49:20 -08:00
Florian Mayer
dde3176a75 [MTE] add sysprop to set mte state globally
this can be used to run CTS w/ maximum MTE coverage on normal builds.

Change-Id: I527b8549f30fd4bd9511d94ca142ea08b72d1a78
2022-02-07 19:28:10 +00:00
Christopher Ferris
033dd1f056 Merge "Fix possible nullptr dereference." am: 442544d7b4 am: e17b538019 am: a373f9819a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1970080

Change-Id: Ib5722dd16dead72ff2865c8d3843a495661ae057
2022-02-04 01:15:33 +00:00
Christopher Ferris
a373f9819a Merge "Fix possible nullptr dereference." am: 442544d7b4 am: e17b538019
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1970080

Change-Id: I366266204cf3bf0361f887bb506e59d849558df1
2022-02-04 01:00:21 +00:00
Eric Miao
08cf949855 Change default block size alignment to be 4 for memory saving on 32-bit arch
For a 32-bit userspace, `struct LinkedListEntry` takes 8 bytes for
storing the two pointers, a default block allocator size alignment of
16-bytes would waste 50% of memory. By changing the alignment to size
of a pointer, it saves >1MB memory postboot on wembley device.

Bug: http://b/206889551
Test: bionic-unit-tests
Change-Id: Ie92399c9bb3971f631396ee09bbbfd7eb17dc1a7
2022-02-03 16:55:37 -08:00
Christopher Ferris
e17b538019 Merge "Fix possible nullptr dereference." am: 442544d7b4
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1970080

Change-Id: I117ea83fb1f8b80580a4199261a3e6c2565b5fd2
2022-02-04 00:38:53 +00:00
Colin Cross
a48237bcdc Disable fortify tests for musl
musl doesn't have fortify, and is missing the *_chk symbols to allow
the tests to compile.

Bug: 190084016
Test: m USE_HOST_MUSL=true host-native
Change-Id: I9a1d2dfe19db219cd2c5a6dc39cb5d08ed0e4369
2022-02-03 16:25:38 -08:00
Colin Cross
9d4a56e490 Export kernel uapi, execinfo and b64 headers to musl sysroot
The musl sysroot needs kernel uapi headers, export them as a zip
file.  Also include the execinfo and b64 headers for libexecinfo
and libb64 that are embedded in musl libc.

Bug: 190084016
Test: m USE_HOST_MUSL=true libc_musl_sysroot
Change-Id: Ie862934f6dabd3fc6cbb9f5be01e21549bce51c2
2022-02-03 16:25:38 -08:00
Colin Cross
9da85fa4a0 Export bionic's resolv base64 functions to musl
Musl doesn't provide the resolv b64_* functions, but adb uses them.
Export them from bionic.

Bug: 190084016
Test: m USE_HOST_MUSL=true host-native
Change-Id: I37837e6179a15754d4cbd89e67649df9dea9d9f1
2022-02-03 16:25:26 -08:00
Colin Cross
2a9843fe63 Export bionic's execinfo functions to musl
Musl doesn't provide the execinfo function.  Export the from bionic.

Bug: 190084016
Test: m USE_HOST_MUSL=true host-native
Change-Id: I0361b84b0160d419cd857f5bb1314a58d0a69234
2022-02-03 16:25:21 -08:00