Commit graph

36195 commits

Author SHA1 Message Date
Colin Cross
ad33d02faa Add bionic NOTICE file to musl sysroot
Add the bionic NOTICE file to cover the headers included in the
musl sysroot.

Bug: 190084016
Test: examine libc_musl_sysroot.zip
Change-Id: I2b5e1b89e997ac370983e5959a83f09cdcc240e8
2022-02-25 18:27:04 -08:00
Treehugger Robot
0de0b574e2 Merge "Remove clang version check around diagnose_as_builtin" am: 4e5f094461
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1997372

Change-Id: I6338577d9c4b7f27a44cd4c9c42e0dd01a1ec8bf
2022-02-24 01:03:29 +00:00
Treehugger Robot
4e5f094461 Merge "Remove clang version check around diagnose_as_builtin" 2022-02-24 00:42:19 +00:00
Treehugger Robot
eea049dda1 Merge "Disable LTO for libBionicStandardTests" am: b01095f077
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1995972

Change-Id: Id5e8038f82af4ceec80b23fcd54a2b085b4eca97
2022-02-23 19:06:07 +00:00
Treehugger Robot
b01095f077 Merge "Disable LTO for libBionicStandardTests" 2022-02-23 18:40:22 +00:00
Pirama Arumuga Nainar
07cdd57d53 Remove clang version check around diagnose_as_builtin
Bug: http://b/197147102

versioner in aosp/1997532 is built with clang-r445002 and understands
the new attribute.

Test: mmma bionic
Change-Id: Ia3e3c3840e6013446d2679587b72011aff8c50eb
2022-02-23 17:51:55 +00:00
Pirama Arumuga Nainar
fef519b637 Disable LTO for libBionicStandardTests
Bug: http://b/218788252

IR verifier too strict for ifunc resolver that accept parameters.  This
is only exposed with Thin LTO.  The error is:

  IFunc resolver has incorrect type
  i32 ()* @_Z5hwcapv

Test: mmma GLOBAL_THINLTO=true bionic
Change-Id: Ifed4041ee8557ba1a5eb7a5a82f54b5ca5c79161
2022-02-22 15:01:27 -08:00
Elliott Hughes
ae1ccadfac Merge "posix_spawn: always clear O_CLOEXEC for dup'ed fds." am: 34da4b5842
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1989308

Change-Id: Ie65d441b5e280297ab1b1eb22d0a21df1275c5b1
2022-02-18 00:44:07 +00:00
Elliott Hughes
34da4b5842 Merge "posix_spawn: always clear O_CLOEXEC for dup'ed fds." 2022-02-18 00:24:12 +00:00
Treehugger Robot
7628c4797d Merge "Explain why we test ifunc variables." am: 5d3c384fa4
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1990811

Change-Id: I2f395eb3ee1f34e5928fb280fd502155879dabfd
2022-02-17 22:56:39 +00:00
Treehugger Robot
5d3c384fa4 Merge "Explain why we test ifunc variables." 2022-02-17 22:04:08 +00:00
Pirama Arumuga Nainar
2b8b74a77f Merge "Cast ifunc resolver's return type" am: afc77a08b4
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1990810

Change-Id: I90524724a73647363c5ad4a76d2af61715894cfc
2022-02-17 21:54:43 +00:00
Zijun Zhao
1e58e27ef3 Merge "Add %m and %#x support for async_safe logging" am: 99ed14b85b
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1965699

Change-Id: Ib8cbf2e4bfac6e110851b9223a713becc4c15f69
2022-02-17 21:54:25 +00:00
Pirama Arumuga Nainar
afc77a08b4 Merge "Cast ifunc resolver's return type" 2022-02-17 21:26:06 +00:00
Elliott Hughes
82c90724e3 Explain why we test ifunc variables.
Bug: http://b/218788252
Test: treehugger
Change-Id: I51825ab61adeaf6f1242df9a22f89cbd0671db48
2022-02-17 11:55:49 -08:00
Pirama Arumuga Nainar
9be2427895 Cast ifunc resolver's return type
Bug: http://b/218788252

Even though a resolver can return any pointer, LLVM IR verifier now
checks that the resolver returns a pointer to the ifunc's function type.

Test: m GLOBAL_THINLTO=true libtest_ifunc_variable_impl.so
Change-Id: I7d87ffcf50bab1d61b01328907e036c51feb6a0f
2022-02-17 11:36:04 -08:00
Zijun Zhao
99ed14b85b Merge "Add %m and %#x support for async_safe logging" 2022-02-17 17:23:32 +00:00
Treehugger Robot
42242d58cc Merge "T is API level 33, not 32." am: df34c97361
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1989309

Change-Id: I1185fae869b9e1aa69c7351e1bc5e015510e7c06
2022-02-17 10:09:51 +00:00
zijunzhao
75c36fe0c2 Add %m and %#x support for async_safe logging
Bugs: None
Test: None
Change-Id: I889015b89b85e222e26f8aa20e35d46a86a0cb7c
2022-02-17 07:23:58 +00:00
Treehugger Robot
df34c97361 Merge "T is API level 33, not 32." 2022-02-17 03:46:19 +00:00
Elliott Hughes
02335c7738 T is API level 33, not 32.
The actual constant was fixed, but the docs weren't.

Test: treehugger
Change-Id: Id76d38cd8b17be02ddece8bbb2695f5d172fee9b
2022-02-16 14:41:09 -08:00
Elliott Hughes
62d49fd8e1 posix_spawn: always clear O_CLOEXEC for dup'ed fds.
dup2(2) is a no-op if the new and old fds are equal, but it's pretty
clear that any useful caller in the posix_spawn(3) context wants us to
clear O_CLOEXEC even if we don't actually "move" the fd.

Bug: https://www.austingroupbugs.net/view.php?id=411
Test: treehugger
Change-Id: I5ce1a1f9216df5afd295cc9e35b84527873e9541
2022-02-16 14:39:07 -08: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
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
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
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
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
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
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
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
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
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