Commit graph

11107 commits

Author SHA1 Message Date
Treehugger Robot
a1ff2e6159 Merge "Nullability check for msg module." 2023-04-17 18:09:10 +00:00
zijunzhao
c76899fe5e Nullability check for msg module.
Bugs: b/245972273
Test: adb shell
Change-Id: Iefb2ae298240b91fcf5657aca0e6f8370095f50b
2023-04-15 01:13:26 +00:00
Florian Mayer
ff116eda61 Fix build error on darwin_arm64
Change-Id: Ie5bc9252de8349c3bfb8269919c0a173a9d9cc2d
2023-04-14 17:50:59 -07:00
Florian Mayer
4967017c86 Merge "Introduce hwasan mode for linker" 2023-04-14 23:27:56 +00:00
Treehugger Robot
fb63e485f1 Merge "Nullability check for capability module." 2023-04-14 21:35:58 +00:00
Treehugger Robot
3d59f2838a Merge "Nullability check for ipc module." 2023-04-14 18:29:59 +00:00
Treehugger Robot
ec50cc6f34 Merge "Nullability check for sendfile module." 2023-04-14 15:19:41 +00:00
Treehugger Robot
177b724cb4 Merge "Nullability check for random module." 2023-04-14 14:41:12 +00:00
Florian Mayer
c10d064b5c Introduce hwasan mode for linker
This mode instructs the linker to search for libraries in hwasan
subdirectories of all library search paths. This is set up to contain a
hwasan-enabled copy of libc, which is needed for HWASan programs to
operate. There are two ways this mode can be enabled:

* for native binaries, by using the linker_hwasan64 symlink as its
  interpreter
* for apps: by setting the LD_HWASAN environment variable in wrap.sh

Bug: 276930343
Change-Id: I0f4117a50091616f26947fbe37a28ee573b97ad0
2023-04-14 01:33:30 -07:00
zijunzhao
e14f2f9f20 Nullability check for sendfile module.
Bugs: b/245972273
Test: adb shell
Change-Id: I47d116b1faf7d53ac51589e393a3df96874a4f37
2023-04-14 01:07:12 +00:00
zijunzhao
7f5c789f35 Nullability check for ipc module.
Bugs: b/245972273
Test: adb shell
Change-Id: Idb89b878e415a62399890dcd3b40e54c3e9c9ef6
2023-04-14 01:05:54 +00:00
zijunzhao
181c31653e Nullability check for capability module.
Bugs: b/245972273
Test: adb shell
Change-Id: I9df50d82e7b86576912ed42e93b1e98c6ded6551
2023-04-14 01:04:29 +00:00
zijunzhao
e43d55348f Nullability check for random module.
Bugs: b/245972273
Test: adb shell
Change-Id: Ie7e06bcf4fda1b177c8d8fcb6a813c1b4a50ea26
2023-04-14 01:01:37 +00:00
Treehugger Robot
be39cd5ebb Merge "Nullability check for modules in include/android directory" 2023-04-13 18:37:42 +00:00
Elliott Hughes
4aa40a5f77 Merge "riscv64: switch from x18 to gp for shadow call stack." 2023-04-13 14:33:06 +00:00
Elliott Hughes
989c15197a Merge "setjmp.h: add some historical detail about the _JBLEN values." 2023-04-13 14:05:02 +00:00
zijunzhao
ac6d59cc75 Nullability check for modules in include/android directory
Bugs: b/245972273
Test: adb shell
Change-Id: Ic00d207331d9837a01cf96ec7fe623961e653051
2023-04-12 23:26:46 +00:00
Elliott Hughes
7dd3896fe1 riscv64: switch from x18 to gp for shadow call stack.
We want to give back a useful callee-saved general purpose
register (x18) that was only "chosen" because it was what llvm
allowed for historical reasons. gp is a better choice because it's
effectively unused otherwise anyway.

Unfortunately, that means we need extra space in jmp_buf (which I've
reserved in an earlier change, e7b3b8b467),
so let's rearrange the entries in jmp_buf to match their order in the
register file.

Bug: https://github.com/google/android-riscv64/issues/72
Bug: http://b/277909695
Test: treehugger
Change-Id: Ia629409a894c1a83d2052885702bbdd895c758e1
2023-04-12 14:19:38 -07:00
Elliott Hughes
634186b505 setjmp.h: add some historical detail about the _JBLEN values.
Test: treehugger
Change-Id: Iadc16347be9bb186d9e7ada1e6f44bd2c36b04f2
2023-04-12 12:43:10 -07:00
zijunzhao
d3e0652877 Nullability check for semaphore module
Bugs: b/245972273
Test: adb shell
Change-Id: I52598efabf40a49dc75057dc8acb8228ed039fca
2023-04-12 18:07:11 +00:00
Treehugger Robot
97950cb186 Merge "Rename files/modules that have the same name" 2023-04-12 01:12:14 +00:00
Cole Faust
f5968d82f5 Rename files/modules that have the same name
Bazel doesn't like it when modules produce files with the same name
as the module itself, and gives warnings.

Rename either the module or file in this case so that the file has
an extension and the module doesn't.

Bug: 198619163
Test: m nothing
Change-Id: Ic4592b06f575496ffd54ac75cb4d682118b29d93
2023-04-11 15:20:19 -07:00
Treehugger Robot
4473a937df Merge "Revert "Workaround boot loop by turning off stack protector check for noreturn calls"" 2023-04-11 15:04:46 +00:00
Yi Kong
66c09671fa Revert "Workaround boot loop by turning off stack protector check for noreturn calls"
This reverts commit 9b4cf9733f.

Fixed by https://reviews.llvm.org/D147975.

Change-Id: I2de39359783d739fd7f9da410fd78421638dbd70
2023-04-11 06:56:31 +00:00
Treehugger Robot
ac599ac89e Merge "Exclude crtbrand.o from the NDK sysroot." 2023-04-11 01:00:04 +00:00
Elliott Hughes
66542d6b97 Merge "setjmp.h: increase riscv64 jmp_buf size." 2023-04-07 15:39:34 +00:00
Treehugger Robot
b6ad73993d Merge "Nullability check for pthread module" 2023-04-07 09:26:55 +00:00
zijunzhao
3c9b94811f Nullability check for pthread module
Bugs: b/245972273
Test: adb shell
Change-Id: I35da1d15c63aae0049091538c573305bf4d9f813
2023-04-06 22:39:52 +00:00
Elliott Hughes
e7b3b8b467 setjmp.h: increase riscv64 jmp_buf size.
If we switch from x18 to gp for shadow call stack, we're going to need
another slot in jmp_buf. We'll need this even for hardware shadow call
stacks too.

While I'm here, and because this is likely my last chance, let's just
round this up to 32 for safety. musl and glibc only have the minimum
needed (which I think means they'll need an ABI break to support SCS
unless they just use a callee-saved general purpose register), but since
we can't do ABI breaks after we ship, let's play it safe.

Bug: https://github.com/google/android-riscv64/issues/72
Test: treehugger
Change-Id: I60661fb7a308c900bfd08c9361f51919b798c005
2023-04-06 14:44:50 -07:00
Elliott Hughes
7b5cc4b251 Merge "<spawn.h>: add posix_spawn_file_actions_addchdir_np()/posix_spawn_file_actions_addfchdir_np()." 2023-04-06 17:51:45 +00:00
Elliott Hughes
6296071782 Merge "Add POSIX <utmpx.h>." 2023-04-06 14:57:12 +00:00
Treehugger Robot
3260e71254 Merge "Nullability check for search module" 2023-04-05 22:10:22 +00:00
zijunzhao
fdf9e2e2e5 Nullability check for search module
Bugs: b/245972273
Test: adb shell
Change-Id: I9dffba498f2d46318378c3b5e436962d6c4b9dae
2023-04-05 19:40:21 +00:00
Elliott Hughes
462ca8b314 <spawn.h>: add posix_spawn_file_actions_addchdir_np()/posix_spawn_file_actions_addfchdir_np().
The recent header nullability additions and the corresponding source
cleanup made me notice that we're missing a couple of actions that most
of the other implementations have. They've also been added to the _next_
revision of POSIX, unchanged except for the removal of the `_np` suffix.

They're trivial to implement, the testing is quite simple too, and
if they're going to be in POSIX soon, having them accessible in older
versions of Android via __RENAME() seems useful. (No-one else has shipped
the POSIX names yet.)

Bug: http://b/152414297
Test: treehugger
Change-Id: I0d2a1e47fbd2e826cff9c45038928aa1b6fcce59
2023-04-04 17:28:39 -07:00
Dan Albert
eee46dc744 Exclude crtbrand.o from the NDK sysroot.
Bug: None
Test: None
Change-Id: I8cb860d9c47b9140926531d21f7864b8d7cbcba3
2023-04-04 23:27:52 +00:00
Elliott Hughes
dbf5b2eb55 Add POSIX <utmpx.h>.
Now <utmpx.h> isn't any more useful on Android than <utmp.h> is, but it
is POSIX, and -- importantly -- we can implement it with just a header
file, so code can use it on every existing API level.

macOS does indeed only have the <utmpx.h> functions (although it does
still have the <utmp.h> header!), so potentially portable code might
want <utmpx.h> on Android. (glibc/musl both have both headers.)

Bug: https://github.com/landley/toybox/pull/213
Test: treehugger
Change-Id: Iaa88167708182009a63e2e1a15f11186b251ed02
2023-04-03 17:20:58 -07:00
Elliott Hughes
97c6902269 Merge "uapi headers: simplify the <linux/compiler.h> stuff." 2023-04-03 18:44:53 +00:00
Treehugger Robot
022a139497 Merge "Nullability check for spawn module" 2023-04-03 18:18:37 +00:00
Elliott Hughes
61d435c29a Merge "riscv64: typedef struct ucontext {...} ucontext_t." 2023-04-03 15:23:31 +00:00
Treehugger Robot
e744d81787 Merge "Nullability check for dirent module" 2023-04-01 02:46:24 +00:00
zijunzhao
8f23da612f Nullability check for spawn module
Bugs: b/245972273
Test: adb shell
Change-Id: Ibf99a24e2af8a317f513252391a30576f0c08e2e
2023-04-01 00:14:02 +00:00
Zijun Zhao
6ef483eb87 Merge "posix_spawn_file_actions_addopen(): crash early rather than late." 2023-03-31 23:59:02 +00:00
Elliott Hughes
53c90ebfdd riscv64: typedef struct ucontext {...} ucontext_t.
All the other architectures are already polluting the namespace with
`struct ucontext`, so make riscv64 match for source compatibility with
other Android code. (Code _should_ be using the POSIX `ucontext_t`, but
ART in particular had a lot of `struct ucontext`, and although I'll
clean that up separately, if there's some in our tree, there's probably
a lot more out there in the wild.)

Test: treehugger
Change-Id: Id0e4e97e660d7d60e792cd2462ddb9788d4772d7
2023-03-31 15:31:37 -07:00
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
zijunzhao
7d2df8be98 Nullability check for dirent module
Bugs: b/245972273
Test: adb shell
Change-Id: I70532170144a65f00dbccf56378f55daf2d362df
2023-03-31 18:54:31 +00:00
Elliott Hughes
0f0c18f695 uapi headers: simplify the <linux/compiler.h> stuff.
We don't really need <linux/compiler.h> and <linux/compiler_types.h>. We
already have a mechanism to remove unused macros, so let's do that. We
don't currently have a way to remove unused #includes, so we still need
<linux/compiler.h> and <linux/compiler_types.h> files (but I've clarified
the comments in them).

I've kept the empty definitions of `__user` and `__force` for source
compatibility. (We had one security test at least that was assuming
a kernel struct definition will "just work".)

Bug: http://b/262917450
Test: treehugger
Change-Id: Iacbbbc1aeef9a4fac52dabd7811ab875cc267d4f
2023-03-30 12:47:08 -07:00
Treehugger Robot
5ae243b7f9 Merge "Nullability check for fts module" 2023-03-30 18:20:48 +00:00
zijunzhao
dec8efd72a Nullability check for fts module
Bugs: b/245972273
Test: adb shell
Change-Id: I56f796a3968484c69c3389fffafdbd960a99845f
2023-03-29 22:51:24 +00:00
zijunzhao
2146303272 Nullability check for sched module.
Bugs: b/245972273
Test: adb shell
Change-Id: Icb8028ec5864370c0ebfb300f9b6df01edf2742d
2023-03-29 21:46:57 +00:00
Elliott Hughes
9dfcaa64e8 Merge "scandir: clarity improvements." 2023-03-29 21:07:25 +00:00