Commit graph

38358 commits

Author SHA1 Message Date
Elliott Hughes
42cf312c77 Merge "libm: remove hand-written assembler for arm32 too." am: 4587c15368
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2414405

Change-Id: If8bfbcef80590f94978df88fd9e0d13c6f4c40e5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-06 21:42:58 +00:00
Elliott Hughes
475275b3ec Merge "Fix setfsgid()/setfsuid() for LP32." 2023-02-06 21:22:36 +00:00
Elliott Hughes
4587c15368 Merge "libm: remove hand-written assembler for arm32 too." 2023-02-06 21:09:10 +00:00
Treehugger Robot
0bf4782fd6 Merge "Nullability check for quota module" am: a3357c28f5
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2419523

Change-Id: I2d90f8ed084a4b580a41ce99c245100724ab5c96
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-04 04:36:52 +00:00
Treehugger Robot
a3357c28f5 Merge "Nullability check for quota module" 2023-02-04 04:12:16 +00:00
Treehugger Robot
1f72d0b27d Merge "Nullability check for sysinfo module" am: bb0913ee64
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2419520

Change-Id: I64abadcd4a26fab9b0556fa43a7349310d8357e1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-04 03:09:10 +00:00
Treehugger Robot
bb0913ee64 Merge "Nullability check for sysinfo module" 2023-02-04 02:50:14 +00:00
Elliott Hughes
8dc9f46a3f Fix setfsgid()/setfsuid() for LP32.
These are system calls where the "good" names are camped by
implementations that only work for 16-bit ids, and you need to say "32"
on LP32 to get sensible behavior.

Noticed when disabling CONFIG_UID16 in the kernel.

Bug: http://b/266732373
Test: llvm-objdump -d
Change-Id: Ib1b5822b030c4f86df755b129ec7b435a7f77cd3
2023-02-03 23:10:04 +00:00
zijunzhao
e716b1b3ee Nullability check for klog module
Bugs: b/245972273
Test: adb shell
Change-Id: I43634184ff8785fa8096d7e8034b22da452cfdd4
2023-02-03 21:56:56 +00:00
zijunzhao
4b8a126255 Nullability check for sysinfo module
Bugs: b/245972273
Test: None
Change-Id: Ie351c609136d1873d3969788246d8a4d8b77ac55
2023-02-03 20:05:05 +00:00
zijunzhao
7833a70000 Nullability check for quota module
Bugs: b/245972273
Test: adb shell
Change-Id: Ic300055163c852d1955d0dc419794b25395ce9a3
2023-02-03 20:03:34 +00:00
Mitch Phillips
bff57ef398 Merge "Add the recoverable GWP-ASan feature." am: 3d577a836d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2420009

Change-Id: Ia3062843b5b11052f1a8c66704a149698ad1d8a8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-03 19:09:07 +00:00
Mitch Phillips
f2e83d43eb Merge "[GWP-ASan] Add TURN_ON_FOR_APP_SAMPLED_NON_CRASHING to android_mallopt" am: 64c7d18f29
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2420008

Change-Id: Ife92a3e50f9af39012f159730aea0e047dd34032
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-03 19:09:05 +00:00
Mitch Phillips
3d577a836d Merge "Add the recoverable GWP-ASan feature." 2023-02-03 18:35:08 +00:00
Mitch Phillips
64c7d18f29 Merge "[GWP-ASan] Add TURN_ON_FOR_APP_SAMPLED_NON_CRASHING to android_mallopt" 2023-02-03 18:35:08 +00:00
Elliott Hughes
47aa5b93fe libm: remove hand-written assembler for arm32 too.
The clang builtins for arm32 give us identical code to what we had for
sqrt()/sqrtf(), and significantly better (neon) code for
floor()/floorf() than the integer-only implementations we had.

Test: llvm-objdump
Change-Id: I224bcfcf4739a80e1a7cdd07b0b1fa232fdf2dab
2023-02-03 01:21:12 +00:00
Mitch Phillips
2480f491be [GWP-ASan] Add TURN_ON_FOR_APP_SAMPLED_NON_CRASHING to android_mallopt
This mode allows an android_mallopt(M_INITIALIZE_GWP_ASAN, ...) to turn
on the recoverable, sampled mode. This is the intended mode for
non-system apps that don't specify the gwpAsanMode in Android U.

Bug: 247012630
Test: Patch the zygote to use this option, launch an app with
gwpAsanMode unspecified, trigger a use-after-free, assert the app uses
the recoverable mode.

Change-Id: I701e10f44b2e2694789cc5ec6f0af4bc0c55b9e4
2023-02-02 15:58:35 -08:00
Mitch Phillips
a493fe4153 Add the recoverable GWP-ASan feature.
GWP-ASan's recoverable mode was landed upstream in
https://reviews.llvm.org/D140173.

This mode allows for a use-after-free or a buffer-overflow bug to be
detected by GWP-ASan, a crash report dumped, but then GWP-ASan (through
the preCrashReport() and postCrashReportRecoverableOnly() hooks) will
patch up the memory so that the process can continue, in spite of the
memory safety bug.

This is desirable, as it allows us to consider migrating non-system apps
from opt-in GWP-ASan to opt-out GWP-ASan. The major concern was "if we
make it opt-out, then bad apps will start crashing". If we don't crash,
problem solved :). Obviously, we'll need to do this with an amount of
process sampling to mitigate against the 70KiB memory overhead.

The biggest problem is that the debuggerd signal handler isn't the first
signal handler for apps, it's the sigchain handler inside of libart.
Clearly, the sigchain handler needs to ask us whether the crash is
GWP-ASan's fault, and if so, please patch up the allocator. Because of
linker namespace restrictions, libart can't directly ask the linker
(which is where debuggerd lies), so we provide a proxy function in libc.

Test: Build the platform, run sanitizer-status and various test apps
with recoverable gwp-asan. Assert that it doesn't crash, and we get a
debuggerd report.
Bug: 247012630

Change-Id: I86d5e27a9ca5531c8942e62647fd377c3cd36dfd
2023-02-02 15:35:25 -08:00
Zijun Zhao
c7fcf634a2 Merge "Nullability check for unistd module" am: 720454abc3
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2381752

Change-Id: Id91613d109cad5ed399cfbb25cd53b24f3d66410
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-02 00:00:01 +00:00
Zijun Zhao
720454abc3 Merge "Nullability check for unistd module" 2023-02-01 23:26:59 +00:00
zijunzhao
3d59110f72 Nullability check for unistd module
Bugs: b/245972273
Test: None
Change-Id: I6037b1cd0bf233476a1cc0fbc8308a87de50c550
2023-02-01 20:40:35 +00:00
Elliott Hughes
015602b48e Merge "Use clang's builtins for sqrt()/sqrtf() and lrint() family." am: b9ba77155b
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2414394

Change-Id: I5013fd237332a7b10d9f4f6d571d67af526ee375
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-01 18:54:27 +00:00
Automerger Merge Worker
2b620d7ac6 Merge changes from topic "am-175e2e8057294130a781e5984587871d" am: 37edb9f57b -s ours
am skip reason: Merged-In Ibd983da1c8fd06cffed756cf3b24523f4671d49e with SHA-1 1f3c8d688c is already in history

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

Change-Id: I2b33b7beb76627142d2cb2bd2f77babe07e59eba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-01 18:54:16 +00:00
Treehugger Robot
e2b9eff0e2 [automerger skipped] Merge "Extend bionic-unit-tests timeout." into android13-tests-dev am: 9c1e170668 -s ours am: b9ba5662c7 -s ours
am skip reason: Merged-In Ibd983da1c8fd06cffed756cf3b24523f4671d49e with SHA-1 1f3c8d688c is already in history

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

Change-Id: I36968436a41913c45358284152029eba0e40f4e0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-01 18:54:13 +00:00
Elliott Hughes
b9ba77155b Merge "Use clang's builtins for sqrt()/sqrtf() and lrint() family." 2023-02-01 18:53:20 +00:00
Automerger Merge Worker
37edb9f57b Merge changes from topic "am-175e2e8057294130a781e5984587871d"
* changes:
  [automerger skipped] Merge "Extend bionic-unit-tests timeout." into android13-tests-dev am: 9c1e170668 -s ours
  [automerger skipped] Extend bionic-unit-tests timeout. am: 7a8366fede -s ours
2023-02-01 17:56:17 +00:00
Treehugger Robot
b9ba5662c7 [automerger skipped] Merge "Extend bionic-unit-tests timeout." into android13-tests-dev am: 9c1e170668 -s ours
am skip reason: Merged-In Ibd983da1c8fd06cffed756cf3b24523f4671d49e with SHA-1 1f3c8d688c is already in history

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

Change-Id: I510ffb0ddf181b01fe02d4941459b4191c34ff42
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-01 17:56:07 +00:00
Mitch Phillips
a03d444908 [automerger skipped] Extend bionic-unit-tests timeout. am: 7a8366fede -s ours
am skip reason: Merged-In Ibd983da1c8fd06cffed756cf3b24523f4671d49e with SHA-1 1f3c8d688c is already in history

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

Change-Id: I053bc61afe5a19604d7d436892f351c94c2b89ac
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-01 17:56:05 +00:00
Treehugger Robot
9c1e170668 Merge "Extend bionic-unit-tests timeout." into android13-tests-dev 2023-02-01 17:36:01 +00:00
Mitch Phillips
7a8366fede Extend bionic-unit-tests timeout.
GWP-ASan stress tests can take a while, especially under HWASan.

Bug: 238585984
Test: sleep(100) in one of the tests, and then 'atest bionic-unit-tests'
Merged-In: Ibd983da1c8fd06cffed756cf3b24523f4671d49e
Change-Id: Ibd983da1c8fd06cffed756cf3b24523f4671d49e
(cherry picked from commit 1f3c8d688c)
2023-02-01 12:43:34 +00:00
Treehugger Robot
35f70dbd1f Merge "Add BIONIC_COMPLICATED_NULLNESS as _Null_unspecified" am: b8a7a2ffbc
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2408893

Change-Id: I7048e75f3ee00d30926293a03e2e0848d041c382
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-01 02:11:33 +00:00
Elliott Hughes
2dcc5ce03c Use clang's builtins for sqrt()/sqrtf() and lrint() family.
Bug: https://github.com/google/android-riscv64/issues/12
Test: llvm-objdump
Change-Id: I2b5647ca245b28433faabe633d970ea2fd69c763
2023-02-01 02:05:24 +00:00
Treehugger Robot
b8a7a2ffbc Merge "Add BIONIC_COMPLICATED_NULLNESS as _Null_unspecified" 2023-02-01 01:41:10 +00:00
zijunzhao
93eb87007a Add BIONIC_COMPLICATED_NULLNESS as _Null_unspecified
In some cases, the nullability of the pointer argument is too
complicated. Developers have better check relevant manuals or
code before annotating.

Bugs: b/245972273
Test: None
Change-Id: I3589a5080b267d1766cc8ed99868129ac16e4012
2023-01-31 22:51:30 +00:00
Christopher Ferris
d69e4b0cde Merge "Purge memory." am: c36823f7e8
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2410758

Change-Id: I636c2969177abab580a31b7296fcf3dc3eb96043
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-01-31 22:32:19 +00:00
Christopher Ferris
c2569a97a2 Merge "Verify that allocated memory is always zeroed." am: b70b4e1f62
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2116713

Change-Id: I619d315dcefed273e1ac0828ee5206d574e611e9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-01-31 22:31:12 +00:00
Christopher Ferris
c36823f7e8 Merge "Purge memory." 2023-01-31 22:19:00 +00:00
Christopher Ferris
b70b4e1f62 Merge "Verify that allocated memory is always zeroed." 2023-01-31 21:45:18 +00:00
Treehugger Robot
fae5f24c1f Merge "Nullability check for fcntl module" am: ab3fc60149
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2407912

Change-Id: Ifce83efcff17d57f75045595dd945d64454db0e8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-01-31 02:40:57 +00:00
Treehugger Robot
ab3fc60149 Merge "Nullability check for fcntl module" 2023-01-31 01:56:33 +00:00
Christopher Ferris
aa3e57469c Purge memory.
Some operations wind up allocating then freeing a significant
amount of memory. So after those operations, do a purge so that
the RSS of the process is not artificially inflated.

Bug: 262321164

Test: Ran unit tests.
Test: Verified after this change, the RSS does not go up after running
Test: am dumpheap -n <PID>.
Change-Id: I08477f8ce12c06fd2a068f536a81f4a577d619e2
2023-01-31 01:37:11 +00:00
zijunzhao
4aa1ea04d7 Nullability check for fcntl module
Bugs: b/245972273
Test: None
Change-Id: I48d23c7bc80863cd3a67ab424780308fe6929292
2023-01-30 19:48:44 +00:00
Elliott Hughes
5d4100c7b6 Merge "Add (no-op) ifuncs for SVE optimized routines." am: b0360a94c3
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2401568

Change-Id: I60b23b43635d94a5130933d0399a495ee7c27213
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-01-27 00:40:54 +00:00
Elliott Hughes
b0360a94c3 Merge "Add (no-op) ifuncs for SVE optimized routines." 2023-01-27 00:06:57 +00:00
Christopher Ferris
02b6bbc7b7 Verify that allocated memory is always zeroed.
If this is a low ram device, then do not run these tests. Otherwise,
verify that memory returned from the allocator is zero.

Bug: 171429763
Bug: 264539505
Bug: 265431478

Test: New unit tests pass on scudo.
Test: New unit tests fail on original jemalloc.
Test: New unit tests pass on jemalloc that always zeroes memory.
Test: New unit tests are skipped on low ram device.
Test: Ran unit tests atest CtsBionicTestCases in above scenarios.
Change-Id: Id62ab74f649c0f7c14a951235fe79972926ecec0
2023-01-26 15:19:09 -08:00
Treehugger Robot
e32dc9fb42 Merge "Nullability check for nl_types module" am: ec612d46c5
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2403712

Change-Id: I94606cedec8710e43227ca231ad87e41cba2d415
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-01-26 16:35:06 +00:00
Treehugger Robot
ec612d46c5 Merge "Nullability check for nl_types module" 2023-01-26 16:06:14 +00:00
Vincent Donnefort
e29253ccb8 Merge "linker: Fallback to argv[0] to get the executable info" am: 8606375bbe
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2401294

Change-Id: I540b1c008f55aea96b1e43f11e5ee3c21d9f7eb1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-01-26 11:14:53 +00:00
Vincent Donnefort
8606375bbe Merge "linker: Fallback to argv[0] to get the executable info" 2023-01-26 10:42:24 +00:00
zijunzhao
64b1fe21b7 Nullability check for nl_types module
Bugs: b/245972273
Test: None
Change-Id: Idc05efd6613c99292bd3c095679ac20bb6e8bf8f
2023-01-26 06:48:13 +00:00