Commit graph

38399 commits

Author SHA1 Message Date
Elliott Hughes
b8e4e469dc posix_spawn_file_actions_addopen(): crash early rather than late.
We're going to dereference a null pointer if you pass one instead of a
pointer to a path, but at the moment (because of implementation sharing
between the different file actions) we won't do it until the last
minute, in the child itself. Let's crash as soon as you make the mistake
instead, to make debugging a lot easier.

Test: treehugger
Change-Id: I987d2700ba05b9867a936ebe770224259376633f
2023-03-31 20:18:18 +00:00
Christopher Ferris
345f54666a Merge "Move M_PURGE to M_PURGE_ALL." 2023-03-24 19:29:51 +00:00
Treehugger Robot
76210fba9e Merge "Time for SEO in <android/api-level.h>." 2023-03-24 16:10:48 +00:00
Yi Kong
ab3a319746 Merge "Workaround boot loop by turning off stack protector check for noreturn calls" 2023-03-24 13:19:52 +00:00
Treehugger Robot
bc28931eb9 Merge "Skip the MemtagNoteTests when the overriding sysprop is set." 2023-03-23 22:36:51 +00:00
Elliott Hughes
572053a02e Time for SEO in <android/api-level.h>.
So many names/numbers for one release...

Test: treehugger
Change-Id: I00ddb13485c185fc003ea087f1df404bc39fa435
2023-03-23 21:30:15 +00:00
Treehugger Robot
40af03dcaf Merge "Add macro for API level V." 2023-03-23 21:28:49 +00:00
Dan Albert
b3e895c86a Add macro for API level V.
No idea if this will be the actual API level or not, but that's all
the more reason to abstract it away early...

Bug: None
Test: None
Change-Id: I8a17bb42dbb08a6e760427514af8331e7dc9b549
2023-03-23 18:35:16 +00:00
Elliott Hughes
98886bb28d Merge "risc-v: use clang's builtins for more of libm." 2023-03-23 18:09:55 +00:00
Peter Collingbourne
d642c30ee0 Skip the MemtagNoteTests when the overriding sysprop is set.
Bug: 273807460
Change-Id: Ieb33354fd8a705c1b2a661055f69d2ec4b32b5e8
2023-03-22 20:08:42 -07:00
Treehugger Robot
688bddc1e5 Merge "Fix setjmp.bug_152210274 with HWASan/stack MTE enabled." 2023-03-22 23:29:31 +00:00
Peter Collingbourne
85a7f6b391 Merge "Disable stack tagging in CloneStartRoutine." 2023-03-22 21:14:54 +00:00
Elliott Hughes
2289ca2bd3 risc-v: use clang's builtins for more of libm.
This completes the set, and gets riscv64 to parity with arm64.

Test: llvm-objdump -d
Test: bionic-unit-tests-static --gtest_filter='math*'
Bug: https://github.com/google/android-riscv64/issues/11
Change-Id: I4230005abcd8d6025d82f1e8afe5831fad2db04d
2023-03-22 14:11:35 -07:00
Peter Collingbourne
25a7c3fd57 Fix setjmp.bug_152210274 with HWASan/stack MTE enabled.
This test was flaky because there was no synchronization between the end
of the test function scope and the jumper threads, resulting in a racy
use-after-scope when accessing the thread array. Fix it by joining the
threads before leaving the test function scope.

Replace the thread array access, which can race with the store to the
thread array in the main thread, with an access to a pre-initialized
variable, which acts as a kind of enforcement that the threads are done
before leaving the test.

Bug: 227390656
Change-Id: Icfbb0d7cae66c12e5ce31072c34529e3c5fdf563
2023-03-22 13:49:53 -07:00
Christopher Ferris
f1ab9c4de7 Move M_PURGE to M_PURGE_ALL.
Since it doesn't matter if these calls take a little longer than
before, use the more thorough but slightly longer purge mechanism.

Test: Unit tests pass.
Change-Id: Ifab7166a9682a13231746b78717d52673d13be1b
2023-03-22 13:47:27 -07:00
Peter Collingbourne
955f04425e Disable stack tagging in CloneStartRoutine.
We don't support running threads on a tagged stack. Untagging SP may
lead to accesses to the stack via a non-SP register, which will be tag
checked, and the check will fail. And indeed that's exactly what the
__bionic_clone function does in its first instruction. Fix the problem by
disabling HWASan and MTE stack tagging on CloneStartRoutine, and remove
the call to untag_address, as it is unnecessary.

Bug: 273807460
Change-Id: I94cc56c816897531c0113c856b54ec41b4aab874
2023-03-21 22:57:50 -07:00
Elliott Hughes
060cd2438c Merge "riscv64 SCS support." 2023-03-21 22:10:56 +00:00
Christopher Ferris
424cf4378a Merge "Fix mte build breakage." 2023-03-21 21:20:55 +00:00
Florian Mayer
b4f4f4ecea Merge "Add debug logging for memtag level" 2023-03-21 20:37:00 +00:00
Elliott Hughes
690d9a0f52 Merge "Increase the implementation of __memcpy_chk assembly" 2023-03-21 19:18:54 +00:00
Christopher Ferris
35759fa84c Fix mte build breakage.
The strerror_buf is way too large, so instead of using a separate
buffer for just this string, reuse the already existing buffer.
Increase the buffer size to cover the maximum errno string.

Add a unit test to verify that none of the errno values are cut off
in the async_safe_format_buffer function when passing %m.

Bug: 274474681

Test: New unit test passes.
Test: Changing the buffer to a small value and verify that the test fails.
Change-Id: I4cb4652709582a8a6b958e12de5d923ec950e6b6
2023-03-21 18:11:02 +00:00
Florian Mayer
b3f3e86878 Add debug logging for memtag level
Test: adb logcat 'libc:D' | grep memtag
Bug: 272596642
Change-Id: I764a0ea4fd71b547d1c5b82a1537e50016578e0f
2023-03-21 11:10:43 -07:00
caowencheng
9a39eb3469 Increase the implementation of __memcpy_chk assembly
Use __memcpy_chk assembly to replace the implementation of c functions, which can reduce the use of instructions

Test: llvm-objdump

Change-Id: I5d75601626dc997626f6173d53af301183a64004
Signed-off-by: caowencheng <caowencheng@eswincomputing.com>
2023-03-21 02:05:14 +00:00
Mitch Phillips
008dc0d50b Merge "No-op DT_AARCH64_MEMTAG_* entries" 2023-03-20 22:06:40 +00:00
Elliott Hughes
7559e5b051 Merge "Use <bits/timespec.h> from uapi headers too." 2023-03-20 19:46:57 +00:00
Elliott Hughes
875d40559e Use <bits/timespec.h> from uapi headers too.
Bug: https://github.com/android/ndk/issues/1852
Test: treehugger
Change-Id: I554b31d2c4c443d37506e97a36099efbd3ad0e11
2023-03-20 15:07:16 +00:00
Zijun Zhao
8ed5cace7d Merge "Nullability check for link module" 2023-03-17 23:51:54 +00:00
Mitch Phillips
2e25c0f943 No-op DT_AARCH64_MEMTAG_* entries
As of https://reviews.llvm.org/D143769, binaries (with -fsanitize=memtag-*)
have DT_AARCH64_MEMTAG_* dynamic entries, as per the AArch64 MemtagABI.
Android uses an OS-specific ELF note for MTE config, but we should
migrate to the new thing (while preserving backwards compatibility).

Without actually doing the migration right now, just handle these new
entries. Otherwise, you get a whole bunch of logspam about the
unrecognised dynamic entries.

Bug: 274032544
Test: Build android, don't get logspam.
Change-Id: I5c8b59f77a0058e5b93335e269d558a5014f2260
2023-03-17 16:09:39 -07:00
Christopher Ferris
dcd1403818 Merge "Add support for M_PURGE_ALL." 2023-03-17 21:06:20 +00:00
Zijun Zhao
df92729c64 Merge "Nullability check for pwd module" 2023-03-17 20:43:32 +00:00
zijunzhao
5250d79abc Nullability check for pwd module
Bugs: b/245972273
Test: adb shell
Change-Id: I855a4e6401220e2b84f303420e8fca63bcf47e03
2023-03-17 02:53:37 +00:00
zijunzhao
0a515826af Nullability check for link module
Bugs: b/245972273
Test: adb shell
Change-Id: I850deb5422604731d1d1b4ab3ea86aedad52a883
2023-03-17 02:52:15 +00:00
Treehugger Robot
627578bba7 Merge "Nullability check for locale module" 2023-03-16 23:55:50 +00:00
zijunzhao
106aa0074d Nullability check for locale module
Bugs: b/245972273
Test: adb shell
Change-Id: If730065895e0f074318df545906b7e60fcae053d
2023-03-16 21:42:57 +00:00
Treehugger Robot
8270ec9282 Merge "Fix stack use-after-scope in async_safe_log." 2023-03-16 00:43:01 +00:00
Peter Collingbourne
84979776d0 Fix stack use-after-scope in async_safe_log.
The buffer filled in by strerror_r needs to stay in scope while
it is pointed to by str.

Bug: 273807460
Change-Id: I494ca8b8aca2b28ec2f0f3da72d845db99633553
2023-03-15 15:21:58 -07:00
Yi Kong
a0271b1eee Merge "Set optnone attribute for modify_stack_protector_test" 2023-03-15 01:40:56 +00:00
Yi Kong
714a33d32d Set optnone attribute for modify_stack_protector_test
clang-r487747 gets too clever and removes the store, even if it is
declared as volatile. Set optnone to prevent the compiler optimizing out
the store.

Test: atest CtsBionicTestCases
Bug: 271214588
Change-Id: I14a537ecd4657ee3f510ff531313bd9d56f22f47
2023-03-15 01:03:59 +09:00
Christopher Ferris
d86eb8665c Add support for M_PURGE_ALL.
This is a new mallopt option that will force purge absolutely
everything no matter how long it takes to purge.

Wrote a unit test for the new mallopt, and added a test to help
verify that new mallopt parameters do not conflict with each other.

Modified some benchmarks to use this new parameter so that we can
get better RSS data.

Added a new M_PURGE_ALL benchmark.

Bug: 243851006

Test: All unit tests pass.
Test: Ran changed benchmarks.
Change-Id: I1b46a5e6253538108e052d11ee46fd513568adec
2023-03-13 19:55:32 -07:00
Zijun Zhao
ba498cfd95 Merge "Nullability check for getopt module" am: f6f8315747
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2482938

Change-Id: Ic77c35e0a615b19276c92e79c095265cf7274dbc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-13 18:35:56 +00:00
Zijun Zhao
02e9b1e3c0 Merge "Nullability check for mntent module" am: e718f8b912
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2482937

Change-Id: I22f0fbe05f62631d59c8f26468bd3ee28cb351af
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-13 18:35:31 +00:00
Treehugger Robot
99df6dddc9 Merge "Nullability check for signalfd module" am: 0a9fd0e77e
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2482936

Change-Id: I039ff3af8bb3bb8d601a193a76d896b44c1e6fbe
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-13 18:30:11 +00:00
Zijun Zhao
f6f8315747 Merge "Nullability check for getopt module" 2023-03-13 18:04:20 +00:00
zijunzhao
1581f63e6d Nullability check for getopt module
Bugs: b/245972273
Test: adb shell
Change-Id: I01cab7eacee486348fd90bd2a0d34c41873c017a
2023-03-13 18:03:29 +00:00
Zijun Zhao
e718f8b912 Merge "Nullability check for mntent module" 2023-03-13 18:02:39 +00:00
Treehugger Robot
0a9fd0e77e Merge "Nullability check for signalfd module" 2023-03-13 17:38:38 +00:00
Yi Kong
9b4cf9733f Workaround boot loop by turning off stack protector check for noreturn calls
clang-r487747 added stack protector capability to check noreturn calls.
This caused the system to boot loop. Turn off the new capabilities as a
temporary workaround.

Test: build and boot
Change-Id: I62c912619dfdd2384672d504ce5d52330bf2a102
2023-03-12 19:45:55 +09:00
zijunzhao
424cb2cbfd Nullability check for mntent module
Bugs: b/245972273
Test: adb shell
Change-Id: I8cbf1960c162c1def670b016663fbf10c2f8cb93
2023-03-11 01:52:28 +00:00
zijunzhao
98f116b319 Nullability check for signalfd module
Bugs: b/245972273
Test: adb shell
Change-Id: I47efddc9c0e217fcb29b3f4f1e2d30f27b23c05f
2023-03-11 01:51:02 +00:00
Treehugger Robot
d20ab5f9c2 Merge "Nullability check for resolv module" am: 1cccc1a059
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2468121

Change-Id: I7feeefe8a5c418a978a59a9df8da7c7a4e6cf2e6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-03-11 01:33:48 +00:00