Commit graph

36217 commits

Author SHA1 Message Date
Evgenii Stepanov
f9fa32acf3 Basic support for MTE stack tagging.
Map all stacks (primary, thread, and sigaltstack) as PROT_MTE when the
binary requests it through the ELF note.

For the reference, the note is produced by the following toolchain changes:
https://reviews.llvm.org/D118948
https://reviews.llvm.org/D119384
https://reviews.llvm.org/D119381

Bug: b/174878242
Test: fvp_mini with ToT LLVM (more tests in a separate change)

Change-Id: I04a4e21c966e7309b47b1f549a2919958d93a872
2022-05-26 16:18:53 -07:00
Zijun Zhao
3d425bb8fb Merge "Add copy_file_range(2) syscall stub to bionic." 2022-05-12 17:20:55 +00:00
zijunzhao
c2e412e086 Add copy_file_range(2) syscall stub to bionic.
Test: treehugger
Bug: https://buganizer.corp.google.com/issues/227784687
Change-Id: I543306cd2234189401bf7c9d80d405eeb6e4d41d
2022-05-12 16:53:41 +00:00
Christopher Ferris
bcd8f15e27 Merge "Add option to force memunreachable check." 2022-05-11 23:28:21 +00:00
Florian Mayer
55d286e98a Merge "Remove unnecessary static variable." 2022-05-11 01:22:19 +00:00
Christopher Ferris
b42e8b4dec Add option to force memunreachable check.
The new option is named check_unreachable_on_signal. It is meant
to duplicate dumpsys meminfo --unreachable <PID> for non-java
processes. When enabled, a user can send a signal to a process
which will trigger the unreachable check on the next allocation
call.

Added new unit tests.

Test: New unit tests pass.
Test: Enabled for the entire system, then dumped on the netd
Test: process and also system_server.
Change-Id: I73561b408a947a11ce21a211b065d59fcc39097b
2022-05-10 17:37:19 -07:00
Treehugger Robot
08bbabcc45 Merge "Improve the "how to add a system call" doc" 2022-05-11 00:20:54 +00:00
Alix Espino
6087a278e0 Merge changes I158862fd,Ieb9de996
* changes:
  Removing clang_cflags to check if they're even necessary
  Moved contents of clang_cflags into cflags
2022-05-10 22:17:26 +00:00
zijunzhao
e5e1e4e55a Improve the "how to add a system call" doc
Test: None
Bug: None
Change-Id: Ie4212956836ae057009e6985812efcbbb7859dea
2022-05-10 22:07:31 +00:00
Florian Mayer
3c0f0969b9 Remove unnecessary static variable.
Change-Id: I1e0049895fc493f5e8b728707a076d5ad022f8c1
2022-05-10 20:57:13 +00:00
Treehugger Robot
c66cb5ba6a Merge "add new Linux close_range() system call to bionic" 2022-05-06 22:25:26 +00:00
Maciej Żenczykowski
b65e105047 add new Linux close_range() system call to bionic
See:
  https://man7.org/linux/man-pages/man2/close_range.2.html

Note: 'man close_range' documents 'flags' as unsigned int,
while glibc unistd.h as just 'int'.  Picking 'int' to match glibc,
though it probably doesn't matter.

BYPASS_INCLUSIVE_LANGUAGE_REASON=man is a cli command
Test: TreeHugger
Bug: 229913920
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1e2d1c8edc2ea28922d60f3ce3e534a784622cd1
2022-05-06 10:33:04 +00:00
Christopher Ferris
de9fe1e2de Merge "Mangle the pointers stored in PointerData." 2022-05-05 19:12:29 +00:00
Christopher Ferris
f78486f40e Mangle the pointers stored in PointerData.
The libmemunreachable library looks through memory to determine
if pointers are leaked. Unfortunately, the malloc debug code
stores the original pointer in data structures, so it looks like
pointers are still in use. The fix is to mangle the pointers
stored in memory so that it doesn't trick the library into thinking
they are live.

Test: All unit/system tests pass.
Test: Ran libmemunreachable and verified leaks show up.
Change-Id: Ic40a0a5ae73857cde936fd76895d88829686a643
2022-05-04 17:07:40 -07:00
Ryan Prichard
0e91012d42 Merge "legacy strtof inline: don't set errno for "inf"" 2022-05-04 22:47:08 +00:00
Elliott Hughes
082b9290d0 Merge "seccomp: allow stat() for ubsan." 2022-05-04 16:35:26 +00:00
Alix
9dff7da04c Removing clang_cflags to check if they're even necessary
Test: Treehugger & ran mma
Bug: 226636335

Change-Id: I158862fd23ad7050bde0916f24e12934b95f7646
2022-05-03 22:52:50 +00:00
Alix
d256925af4 Moved contents of clang_cflags into cflags
Test: Treehugger
Bug: 226636335
Change-Id: Ieb9de996a61418c8343885ae339589f0f48342d5
2022-05-03 22:50:24 +00:00
Treehugger Robot
0f6d493d28 Merge "Properly fix heap_tagging_helper for HWASan." 2022-05-03 05:34:16 +00:00
Florian Mayer
e2d50fe622 Properly fix heap_tagging_helper for HWASan.
Test: atest bionic-unit-tests
Change-Id: Ia9fbb436676257810d1c379d5d65dd7ccfcf90ac
2022-05-02 18:35:50 +00:00
Elliott Hughes
a0745cea5f seccomp: allow stat() for ubsan.
We've had complaints about ubsan issues for years, but never got to the
bottom of them, or saw them ourselves in testing. For some reason (still
not understood) we've started to see this ourselves in T and downstream
branches. So for now, let's just punch that extra hole.

Longer term, ubsan should stop needing any of this, so once
https://reviews.llvm.org/D124212 is in an LTS NDK, we should be able to
get rid of this _and_ the existing sanitizer-related holes.

Bug: https://github.com/android/ndk/issues/1298
Bug: http://b/229989971
Test: treehugger
Change-Id: Id42cb29c4e943c0080c0d34ce4e5d6d1b32da9e8
2022-04-29 15:48:08 -07:00
Maciej Żenczykowski
668c061986 Merge "allowlist new Linux close_range() system call, use it in posix_spawn()" 2022-04-29 07:07:16 +00:00
Ryan Prichard
88134649ee legacy strtof inline: don't set errno for "inf"
Bug: https://github.com/android/ndk/issues/415
Test: libc++'s std/strings/string.conversions/stof.pass.cpp
Change-Id: I2c6bab9e31fb1c916be991f72b04735b5df279c2
2022-04-28 23:17:33 -07:00
Maciej Żenczykowski
c9c0ebde3c allowlist new Linux close_range() system call, use it in posix_spawn()
Linux kernel's close_range() system call (currently) allows:
  close() unshare() fcntl(F_SETFD, FD_CLOEXEC)
to be performed on ranges of fds.

All 3 of these are already allowed by seccomp bpf:
as such this doesn't allow you to do anything you can't already do.

We can't add close_range() properly to bionic because we'd need to
fiddle about with ltp and it's too late to add new T API anyway,
so let's just make the direct syscall() call.

We'll add proper support in U.

See also:
  https://man7.org/linux/man-pages/man2/close_range.2.html

Test: TreeHugger
Bug: 229913920
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I85586d544fc23bed6aee59f00bdb79ee7a8150d1
2022-04-28 23:33:38 +00:00
Automerger Merge Worker
966a778a24 Merge "Merge "Merge "Fix unistd.exec_argv0_null for new kernels." into android12-tests-dev am: b4cee37d7d" into android12L-tests-dev am: eec0b88f15" 2022-04-27 21:44:05 +00:00
Automerger Merge Worker
994ccab13e Merge "Merge "Fix unistd.exec_argv0_null for new kernels." into android12-tests-dev am: b4cee37d7d" into android12L-tests-dev am: eec0b88f15
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2078360

Change-Id: I763aa2e4672e54a4fe3df9517b3935740653237e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 21:44:02 +00:00
Treehugger Robot
069a25fe57 Merge "Improve the "how to add a system call" documentation." 2022-04-27 21:40:34 +00:00
Automerger Merge Worker
eec0b88f15 Merge "Merge "Fix unistd.exec_argv0_null for new kernels." into android12-tests-dev am: b4cee37d7d" into android12L-tests-dev 2022-04-27 21:26:56 +00:00
Treehugger Robot
7f7994cd16 Merge "Fix unistd.exec_argv0_null for new kernels." into android12-tests-dev am: b4cee37d7d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2078360

Change-Id: Ia864567dea05116f0b92edd31f5645edbc82e483
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 21:26:53 +00:00
Treehugger Robot
b4cee37d7d Merge "Fix unistd.exec_argv0_null for new kernels." into android12-tests-dev 2022-04-27 21:07:54 +00:00
Automerger Merge Worker
83e70ab7f3 Merge "Merge "Merge "Merge "Fix unistd.exec_argv0_null for new kernels." into android11-tests-dev am: 9d0912a7b2" into android12-tests-dev am: f14019cf61" into android12L-tests-dev am: dc8f5f7d3a" 2022-04-27 19:51:26 +00:00
Automerger Merge Worker
7294f4a88c Merge "Merge "Merge "Fix unistd.exec_argv0_null for new kernels." into android11-tests-dev am: 9d0912a7b2" into android12-tests-dev am: f14019cf61" into android12L-tests-dev am: dc8f5f7d3a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2078359

Change-Id: I594cefad36406ac8ff97528f11c7100b212637ae
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 19:51:23 +00:00
Automerger Merge Worker
dc8f5f7d3a Merge "Merge "Merge "Fix unistd.exec_argv0_null for new kernels." into android11-tests-dev am: 9d0912a7b2" into android12-tests-dev am: f14019cf61" into android12L-tests-dev 2022-04-27 19:30:39 +00:00
Automerger Merge Worker
f4b7c1ecc2 Merge "Merge "Fix unistd.exec_argv0_null for new kernels." into android11-tests-dev am: 9d0912a7b2" into android12-tests-dev am: f14019cf61
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2078359

Change-Id: I162c86e60a34a50eef6079bcab78172c69c76f00
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 19:30:37 +00:00
Automerger Merge Worker
112a717077 Merge "Merge "Merge "Merge "Merge "Fix unistd.exec_argv0_null for new kernels." into android10-tests-dev am: 16457fd9d0" into android11-tests-dev am: ede618aef2" into android12-tests-dev am: ba0f5b9195" into android12L-tests-dev am: 19dce61545" 2022-04-27 19:22:07 +00:00
Automerger Merge Worker
4f61022f30 Merge "Merge "Merge "Merge "Fix unistd.exec_argv0_null for new kernels." into android10-tests-dev am: 16457fd9d0" into android11-tests-dev am: ede618aef2" into android12-tests-dev am: ba0f5b9195" into android12L-tests-dev am: 19dce61545
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2078358

Change-Id: I0f6ee716bba94d903dae26c11aa6163bcc07e322
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 19:22:05 +00:00
Automerger Merge Worker
3e8dfcebfb Merge "Merge "Merge "Regression test for scudo crash in resizeTaggedChunk." into android12-tests-dev am: d8fa0f64af" into android12L-tests-dev am: 6c73a7ac6f" 2022-04-27 19:21:53 +00:00
Automerger Merge Worker
f93ff759bf Merge "Merge "Regression test for scudo crash in resizeTaggedChunk." into android12-tests-dev am: d8fa0f64af" into android12L-tests-dev am: 6c73a7ac6f
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1901121

Change-Id: I55008be651749df05318012445d36b228c517af0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 19:21:51 +00:00
Automerger Merge Worker
cf1733aceb Merge "Merge "Merge "Skip the malloc_slack test on native bridge." into android12-tests-dev am: 1623704319" into android12L-tests-dev am: 9ca3b55cc1" 2022-04-27 19:21:44 +00:00
Automerger Merge Worker
1a55dd91ee Merge "Merge "Skip the malloc_slack test on native bridge." into android12-tests-dev am: 1623704319" into android12L-tests-dev am: 9ca3b55cc1
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1854022

Change-Id: Ic97a53d86d458f56249e5e3d9b90cf1abeed74a6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 19:21:42 +00:00
Automerger Merge Worker
a7e8b92de6 Merge "Merge "Merge "Merge "Merge "Fix possible issue with cfi_basic test." into android10-tests-dev am: 3144bf7b69" into android11-tests-dev am: 9ef57feced" into android12-tests-dev am: 05f451ff40" into android12L-tests-dev am: 68fd586b3a" 2022-04-27 19:21:35 +00:00
Automerger Merge Worker
89839f9169 Merge "Merge "Merge "Merge "Fix possible issue with cfi_basic test." into android10-tests-dev am: 3144bf7b69" into android11-tests-dev am: 9ef57feced" into android12-tests-dev am: 05f451ff40" into android12L-tests-dev am: 68fd586b3a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1450415

Change-Id: Ic655861445d6bfb675db4c53996f46ed901fac65
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 19:21:34 +00:00
Automerger Merge Worker
99eb475597 Merge changes from topic "am-492299fff56f41ea80d26768bcc5c005"
* changes:
  Merge changes from topic "am-1f04af5ac4724e08a16e070a0669bd45" into android12L-tests-dev am: f84b535bf1
  [automerger skipped] Merge "Remove stack address check in cfi_basic test." into android10-tests-dev am: c9608ab2e2 -s ours am: 83dd5914ae -s ours am: f1f4c02d31 -s ours am: ef543c40bc -s ours
2022-04-27 19:21:22 +00:00
Automerger Merge Worker
c8d78f5840 Merge changes from topic "am-1f04af5ac4724e08a16e070a0669bd45" into android12L-tests-dev am: f84b535bf1
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1371143

Change-Id: Id2cae79161d56e746802540fa1d73b90cba3de1c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 19:21:19 +00:00
Treehugger Robot
8560b4b39f [automerger skipped] Merge "Remove stack address check in cfi_basic test." into android10-tests-dev am: c9608ab2e2 -s ours am: 83dd5914ae -s ours am: f1f4c02d31 -s ours am: ef543c40bc -s ours
am skip reason: skipped by user eugenis

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

Change-Id: I1eb3213dbf6f5e1581f13cc2257c97a952247ca0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 19:21:18 +00:00
Automerger Merge Worker
3286b39941 Merge changes from topic "am-c6b8230339e24a95948ea129db34cb0d"
* changes:
  Merge changes from topic "am-3cb4ee1e5c574467a4389675df3d49f9" into android12L-tests-dev am: 5b935518c3
  [automerger skipped] Merge "Fix linker path for emulated architecture" into android10-tests-dev am: ce45ee1184 -s ours am: 00653f6ae3 -s ours am: ebc90ae254 -s ours am: e1c9dbc5ba -s ours
2022-04-27 19:21:02 +00:00
Automerger Merge Worker
acf63dd04b Merge changes from topic "am-3cb4ee1e5c574467a4389675df3d49f9" into android12L-tests-dev am: 5b935518c3
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1183110

Change-Id: I33b3747e7b6b80ddc842d9290dedfdcc7a188a8c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 19:20:59 +00:00
Treehugger Robot
e36df1a6c0 [automerger skipped] Merge "Fix linker path for emulated architecture" into android10-tests-dev am: ce45ee1184 -s ours am: 00653f6ae3 -s ours am: ebc90ae254 -s ours am: e1c9dbc5ba -s ours
am skip reason: skipped by user levarum

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

Change-Id: Ib30b4c4fd82e0bddb7d3593b4186d138c043a6c0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 19:20:58 +00:00
Automerger Merge Worker
9888c1aae5 Merge changes from topic "am-8820c465c51b44949f4e1a80b5097183"
* changes:
  Merge changes from topic "am-bc40fdbdb974448fae6cea79ea66b3bd" into android12L-tests-dev am: eec4191010
  [automerger skipped] Merge "Fix Bionic dlfcn.dladdr_libc test case for 64bit binary translations" into android10-tests-dev am: 3382f346fc -s ours am: 7fad99971d -s ours am: b013f1698e -s ours am: ed828cfb2e -s ours
2022-04-27 19:20:42 +00:00
Automerger Merge Worker
e5cb9e312f Merge changes from topic "am-bc40fdbdb974448fae6cea79ea66b3bd" into android12L-tests-dev am: eec4191010
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1164119

Change-Id: I1b5be9950586cad96957de88fbecae469184bd70
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 19:20:39 +00:00