Commit graph

11094 commits

Author SHA1 Message Date
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
zijunzhao
99dd5b1e27 Nullability correction for stdlib module.
Bugs: b/245972273
Test: adb shell
Change-Id: I0a800ccfe3bae88d3e924dd621bad182cb186b27
2023-03-29 00:26:29 +00:00
Elliott Hughes
f6c25d6fd3 scandir: clarity improvements.
Move the "is there a comparator?" check into the sole caller, to match
the "is there a filter?" check. Remove the unnecessary (and unlikely)
pre-sort "is the array empty?" check.

Test: treehugger
Change-Id: I8bd461380420dce4a8bc05ef5fe3511b26347d7c
2023-03-28 22:35:24 +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
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
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
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
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
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