Commit graph

11394 commits

Author SHA1 Message Date
Treehugger Robot
0428fc1a9c Merge "Nullability check for thread_properties module." 2023-06-06 00:18:33 +00:00
zijunzhao
70586d6a99 Nullability check for thread_properties module.
Bugs: b/245972273
Test: adb shell
Change-Id: I8f2c640d74d73576d81453973d63568472b2676e
2023-06-05 22:07:50 +00:00
Yun Hsiang
40a82d005c Implement rvv version mem* and str* for riscv64
Add vector version mem* and str* functions and only build them when the
vector extension is enabled.
The original implementation comes from
https://github.com/sifive/sifive-libc, which we agree to contribute to
the Android Open Source Project.

Test: mma

Change-Id: I11b671a5bc571d7c783a657f272f282df7d16c29
Signed-off-by: Yun Hsiang <yun.hsiang@sifive.com>
2023-05-31 09:32:42 +08:00
Treehugger Robot
32ce2d5c82 Merge "time.h: add doc comments." 2023-05-26 20:11:05 +00:00
Elliott Hughes
e17ebfd51a <math.h>: more use of __RENAME_LDBL.
Now the NDK doesn't support API levels below 21, we don't actually need
weird x86-specific annotations. In general we haven't been removing
this historical information because it might be interesting to someone,
and there's no real reason to remove it, but we've had versioner bugs
recently with these more complex cases.

Test: treehugger
Change-Id: Ia457bb338ecf55af8e319e411ec3bf48a03f3c03
2023-05-26 13:00:51 -07:00
Elliott Hughes
db36e0829b <sched.h>: __INTRODUCED_IN_ removal.
Now the NDK doesn't support API levels below 21, we don't actually need
the different arm32 vs x86 annotations. In general we haven't been
removing this historical information because it might be interesting to
someone, and there's no real reason to remove it, but we've had
versioner bugs recently with these more complex cases.

Test: treehugger
Change-Id: Id9c9b8ecc01d232becd5dd8741509c104a8b6e19
2023-05-26 12:58:14 -07:00
Elliott Hughes
d192dbecf0 time.h: add doc comments.
C23 adds timegm(), gmtime_r(), and localtime_r(). We should remove the
"non-standard" text for timegm(), and while I'm here, let's just
document everything in this file.

Test: treehugger
Change-Id: Ia44c1bd155c939f694f6f8138b9cb7503519522c
2023-05-26 09:13:41 -07:00
zijunzhao
c412f654c5 Nullability check for nameser module.
Bugs: b/245972273
Test: adb shell
Change-Id: I96a4616d1a758d0f04af5d7f0fb8a0206f068b6a
2023-05-25 21:47:11 +00:00
zijunzhao
bf627f4292 Nullability check for inet module.
Bugs: b/245972273
Test: adb shell
Change-Id: I5acb1910f25dc025e1c8924ebf8b6801503f5161
2023-05-24 22:02:49 +00:00
Elliott Hughes
525761fd7d static_assert is a keyword in C23.
Test: treehugger
Change-Id: I4eba529475b6255bef1af558f54c373aad8737d0
2023-05-24 08:48:42 -07:00
zijunzhao
969d6c129a Nullability check for shm module.
Bugs: b/245972273
Test: adb shell
Change-Id: I9bdd5727719311d063fa126fc286618e9d24a45b
2023-05-23 19:15:25 +00:00
Elliott Hughes
3285ae5a4d Merge "Fix the *return* types in the arm64 dynamic function dispatch." 2023-05-23 13:46:30 +00:00
Elliott Hughes
20f9d67327 Fix the *return* types in the arm64 dynamic function dispatch.
No actual effect on the code, but misleading and wrong. (The previous
change only fixed the argument types; I didn't notice that some of the
return types were wrong too.)

Test: treehugger
Change-Id: I1ee5c48e2652fd8cbf8178d5659e57f79e61898e
2023-05-22 19:28:33 +00:00
zijunzhao
9f6b4caa9e Nullability check for xattr module.
Bugs: b/245972273
Test: adb shell
Change-Id: I0137c86f3fa7e17fb5fe284c7693315b2df1e2db
2023-05-22 18:31:16 +00:00
Elliott Hughes
01db121db5 Merge "Fix the types in the arm64 dynamic function dispatch." 2023-05-19 14:15:53 +00:00
Elliott Hughes
a1974064ae Fix the types in the arm64 dynamic function dispatch.
No actually effect on the code, but misleading and wrong.

Test: treehugger
Change-Id: I55405ac224b4dcc2ae515954aed179c1cde3c73c
2023-05-18 13:40:12 -07:00
zijunzhao
2572571786 Nullability check for mman module.
Bugs: b/245972273
Test: adb shell
Change-Id: Ib5c4887d89581eaedcf4a3e128811a6a374a8d1b
2023-05-18 19:02:25 +00:00
Treehugger Robot
83f9b28792 Merge "Nullability check for system_properties module." 2023-05-18 18:38:17 +00:00
Florian Mayer
e20c5fa4ac Merge "Revert "Add debug logging for memtag level"" 2023-05-18 01:06:23 +00:00
Florian Mayer
dd44378da7 Revert "Add debug logging for memtag level"
This reverts commit b3f3e86878.

Reason for revert: This created spam in tombstones.

Change-Id: Ia7b8285a6abd6f89d49859a981be1c9cfa104f81
2023-05-17 20:59:14 +00:00
zijunzhao
a505b2d37a Nullability check for system_properties module.
Bug: b/245972273
Test: adb shell
Change-Id: I3a55b8107898014fe74fd1a6f442f1ec00e08790
2023-05-17 20:43:51 +00:00
Treehugger Robot
ad333b6161 Merge "riscv64: say "x3" rather than "gp" in shadow call stack assembler." 2023-05-17 16:51:16 +00:00
Elliott Hughes
c35a0dc08e riscv64: say "x3" rather than "gp" in shadow call stack assembler.
Neither is great, but "gp" seems actively misleading (and setjmp.S
says x3 every time, so we should be consistent if nothing else).

Bug: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/379
Test: treehugger
Change-Id: Ibccda74d4794caa770b82e7ba2e31ce7b645b83f
2023-05-16 16:09:30 -07:00
zijunzhao
2067ec5967 Nullability check for time module.
Bug: b/245972273
Test: adb shell
Change-Id: I61f69f48f3428ef1f544dd01e573ff078a9eab17
2023-05-16 00:17:36 +00:00
Elliott Hughes
a198c71752 Merge "printf unification: floating point." 2023-05-12 20:15:02 +00:00
Shreshta Manu
56dba096a2 Merge "Revert "Nullability check for inet module."" 2023-05-12 18:20:56 +00:00
Zijun Zhao
07a2b29dd6 Revert "Nullability check for inet module."
This reverts commit 53dbd78ae0.

Reason for revert: Break build https://android-build.googleplex.com/builds/submitted/10125312/test_suites_x86_64_coverage/latest/view/logs/build_error.log?legacy

Change-Id: Ifccf22768b916d85263abb89b2b4223ae2ce5d80
2023-05-12 18:18:29 +00:00
Zijun Zhao
50d729b228 Merge "Nullability check for inet module." 2023-05-12 17:17:48 +00:00
Zijun Zhao
8e5e8ee14b Merge "Nullability check for if module." 2023-05-12 17:17:23 +00:00
Elliott Hughes
531199c56c printf unification: floating point.
The only remaining differences between vfprintf.cpp and vfwprintf.cpp
after this are the wide/narrow conversions for %c, %m, and %s. I've used
"chars" and "bytes" for the named constants for the directions because
(a) I find -1 and 1 pretty confusing and (b) although "narrow" is the
obvious opposite of "wide", only Windows actually moved to wide
characters, so "narrow" (aka "multibyte", and probably "utf8") is the
default/normal case. Even though C confuses bytes and characters via its
`char` type, "bytes" versus "chars" seems like the appropriate
terminology (and it's what Java/Python use).

Also improve the swprintf tests assertion so failures are readable.

Test: treehugger
Change-Id: Ife8f70f65ec28d96058a7d68df353945524835d2
2023-05-11 16:51:13 -07:00
zijunzhao
53dbd78ae0 Nullability check for inet module.
Bugs: b/245972273
Test: adb shell
Change-Id: I51830ddbf5ceb7c02154bd335feb65ca1a230b66
2023-05-11 22:57:27 +00:00
zijunzhao
c741aea751 Nullability check for netdb module
Bugs: b/245972273
Test: adb shell
Change-Id: Id9b4338ca2f0fb64033c221f3bfb269ab930b79b
2023-05-11 21:31:42 +00:00
zijunzhao
87aae5309b Nullability check for if module.
Bugs: b/245972273
Test: adb shell
Change-Id: If6be7027e0ebdcf68ae4062c57e1c4e82a767abe
2023-05-11 17:15:57 +00:00
Mao Han
d4e662edab riscv64: fix return value when errorno is 4095
This issue was discovered by seccomp_seccomp_bpf_riscv_64 test.
Actual output:
[0]code=20 jt=00 jf=00 k=0000
[1]code=15 jt=00 jf=01 k=003F
[2]code=06 jt=00 jf=00 k=51000
[3]code=06 jt=00 jf=00 k=7FFF0000
ret=-4095, errno=0

Expected output:
[o]code=20 jt=00 jf=00 k=0000
[1]code=15 jt=00 jf=01 k=003F
[2]code=06 jt=00 jf=00 k=51000
[3]code=06 jt=00 jf=00 k=7FFF0000
ret=-1, errno=4095

Change-Id: Ieebf5f0d1e2f18e2887c463b58ef7ea05ea52898
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Signed-off-by: haocheng.zy <zhangye@linux.alibaba.com>
2023-05-11 14:52:56 +08:00
Christopher Ferris
983292a972 Merge "Update to v6.3 kernel headers." 2023-05-10 23:28:53 +00:00
Christopher Ferris
b7cef6d910 Update to v6.3 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-6.3

Test: Bionic unit tests pass.
Change-Id: I5270ef291a77343e47ef3a5fbd02b8cacf218ec5
2023-05-09 19:04:15 +00:00
Elliott Hughes
26a0ebd24b More printf unification: FLUSH().
wprintf doesn't need this (and already only has the iov stuff because
the non-wide printf implementation needs it), but we can further reduce
the diff between the two implementations by defining a no-op FLUSH() for
wide characters.

Test: treehugger
Change-Id: Ifefcb4b8474b086f995e2b0796f61558a19e2a42
2023-05-09 11:54:09 -07:00
Treehugger Robot
68904aee7b Merge "Make fork equivalent to vfork when HWASan or MTE stack tagging is enabled." 2023-05-09 00:53:48 +00:00
Peter Collingbourne
b6a592b25b Make fork equivalent to vfork when HWASan or MTE stack tagging is enabled.
Bug: 274056091
Change-Id: Iac029ca6b0e26f57f20c0a54822b75e3cae67344
2023-05-08 15:26:00 -07:00
Zijun Zhao
aaaf468370 Merge "Nullability check for uio module." 2023-05-04 20:52:09 +00:00
Elliott Hughes
e023a02cce Merge "<time.h>: change the new C23 TIME_ constants." 2023-05-04 17:35:17 +00:00
zijunzhao
d633600d1c Nullability check for uio module.
Bugs: b/245972273
Test: adb shell
Change-Id: I132f618c50f7b7a3f9b9ef26c9ac1a87a97a1b78
2023-05-04 17:13:15 +00:00
Elliott Hughes
1dff230f75 Merge "syslog.h: implement LOG_PERROR." 2023-05-04 15:09:51 +00:00
Elliott Hughes
7db0a6cc5f <time.h>: change the new C23 TIME_ constants.
Jens Gustedt suggested a better implementation last year on the musl
mailing list: https://www.openwall.com/lists/musl/2022/11/19/1

It means the constants are sparse, but in return it means we can add
future constants and they'll be backward compatible. (Sadly you'll need
to be on API level 35 before you can use anything but TIME_UTC.)

I doubt this will ever matter, because everyone should just stick to
clock_gettime()/clock_getres() anyway, and anyone who does have a
legitimate use for timespec_get() and timespec_getres() probably needs
to support non-Linux and so can't use any clocks that aren't in ISO C
anyway. But given that we don't _have_ to paint ourselves into a corner
here, we may as well take the opportunity to not do so.

Test: strace
Change-Id: I293d32fcbcf7f6703564dac0978ae2a10192a482
2023-05-03 15:37:46 -07:00
Elliott Hughes
9118450303 Merge "Add an enum for the riscv64 <sys/ucontext.h> register constants." 2023-05-03 21:43:24 +00:00
Elliott Hughes
213d943a33 syslog.h: implement LOG_PERROR.
This is the one openlog() flag that toybox uses. We should probably try
to unify toybox's POSIX logger and Android-specific log at some point,
and this will help.

Also fix our behavior with an empty format string, noticed while adding
tests.

Test: treehugger
Test: adb shell logger -s foo
Change-Id: Ic027e78a460be3db83cc4c6f9946c9efa22be6e1
2023-05-03 14:19:40 -07:00
Elliott Hughes
7fc63f2c9a Add an enum for the riscv64 <sys/ucontext.h> register constants.
That lets us have idempotent #defines to reduce namespace pollution.

Bug: http://b/279405445
Test: treehugger
Change-Id: I00312cc8911025696cf0eea2d70e3219ab361613
2023-05-03 17:45:41 +00:00
Treehugger Robot
e61cf18c3c Merge "Nullability check for get_device_api_level_inlines module." 2023-05-03 02:06:08 +00:00
zijunzhao
136e28fa8b Nullability check for get_device_api_level_inlines module.
Bugs: b/245972273
Test: adb shell
Change-Id: I49d64a12b542c8f3723f89531c63d10b84d16d26
2023-05-02 23:36:34 +00:00
zijunzhao
1fdece95d3 Implement C23 printf 'wf' length modifiers
wfN: Specifies that a following b, d, i, o, u, x, or X conversion specifier applies to a fastest minimum-width integer argument with a specific width where N is a positive decimal integer with no leading zeros (the argument will have been promoted according to the integer promotions, but its value shall be converted to the unpromoted type); or that a following n conversion specifier applies to a pointer to a fastest minimum-width integer type argument with a width of N bits. All fastest minimum-width integer types (7.22.1.3) defined in the header <stdint.h> shall be supported. Other supported values of N are implementation-defined.

Bug: b/271903607
Test: adb shell
Change-Id: Ida36d5a50af2a46fd04cb5fe039793d8872f9f3b
2023-05-02 21:06:09 +00:00
Elliott Hughes
721b93d7ec Merge "Fix the WIFSTOPPED definition." 2023-05-02 14:40:15 +00:00
Elliott Hughes
2b8ca55d14 Fix the WIFSTOPPED definition.
Although this breaks job control in several shells (including mksh),
this has been broken since the initial commit and no-one's noticed until
now.

Bug: https://github.com/android/ndk/issues/1878
Test: treehugger
Change-Id: Id7c4805965c5e5847db99b57df1af13355adcc22
2023-05-01 19:48:12 +00:00
zijunzhao
d3f2f109fc Nullability check for getopt module.
Bugs: b/245972273
Test: adb shell
Change-Id: I243bb87fe26beecd376d894b25cedd993c246880
2023-05-01 16:19:44 +00:00
zijunzhao
a23e448288 Nullability check for resource module.
Bugs: b/245972273
Test: adb shell
Change-Id: Ia875f9e0189f72317276cc28bfe6faf1f95c2908
2023-04-28 22:18:02 +00:00
Treehugger Robot
3ee441491a Merge "Nullability check for ctype_inlines module." 2023-04-28 20:57:27 +00:00
Almaz Mingaleev
8cad3f9776 Merge "Update tzcode from 2022a to 2023a." 2023-04-28 18:41:33 +00:00
zijunzhao
b4e4d05439 Nullability check for ctype_inlines module.
Bugs: b/245972273
Test: adb shell
Change-Id: I7645c51d40a226cc90bfbf8587e8b094c0c38242
2023-04-28 18:02:12 +00:00
Almaz Mingaleev
d86a3ab241 Update tzcode from 2022a to 2023a.
57b8fc957a
changes the way overflows are tracked: now compiler builtins
are used instead of manual arithmetics. But as int_fast32_t on
64-bit Android takes 8 bytes, new logic behaves differently.
See time_test.cpp changes for more details.

Changes were applied using following commands:
  1) Checkout tzcode repo
  2) Prepare patches for all tzcode file using
    git diff 2022a 2023a -- <file-name> > <file-name-patch>
  3) Apply these patches to files in bionic using
    patch -p1 <file-name> <file-name-patch>

Bug: 279742606
Test: CtsBionicTestCases
Test: CtsLibcoreTestCases
Test: CtsLibcoreOjTestCases
Test: atest toybox-tests
Change-Id: I7772a90538b8185bdd2f4be6e9d1740c95509d6c
2023-04-28 16:52:53 +01:00
Christopher Ferris
e28867ca6e Modify the wording of the mallopt.
The original wording implies that memory tagging can be disabled
per thread. That is not really possible, and doesn't happen. Instead,
this option only turns off some of the memory tagging initialization.
Leave this slightly vague since it's possible this might change
in the future.

Bug: 272383932

Test: NA
Change-Id: I6333f16175edb52a38aadfc67ce7c9ce76113e59
2023-04-27 17:07:17 -07:00
Treehugger Robot
028bb5473b Merge "Nullability check for strcasecmp module." 2023-04-27 21:20:09 +00:00
zijunzhao
88f4b1a957 Nullability check for strcasecmp module.
Bugs: b/245972273
Test: adb shell
Change-Id: Ic6322e957cccd827fe437a4a3dd2848036913f29
2023-04-27 18:03:38 +00:00
zijunzhao
628d8ca6eb Nullability check for swab module.
Bugs: b/245972273
Test: adb shell
Change-Id: I92ce194ac12cbc337932357567b8450c484f93f3
2023-04-27 18:01:33 +00:00
Elliott Hughes
0593e7922f Merge "C23: add timespec_getres() and the new TIME_* constants." 2023-04-27 15:25:06 +00:00
Treehugger Robot
c35f7d6a84 Merge "Set __BIONIC_COMPLICATED_NULLNESS for the vsnprintf family" 2023-04-27 01:50:38 +00:00
zijunzhao
e1833e54a7 Set __BIONIC_COMPLICATED_NULLNESS for the vsnprintf family
When annotating the netinet directory aosp/2552567, we realize the
argment s for vsnprintf family can be null only if the buffer size is 0.
So we correct them and add some tests to verify our assumption.

Bugs: b/245972273
Test: adb shell
Change-Id: I51063286272be0daee0d7c1453a374b1f5674481
2023-04-26 23:14:36 +00:00
Elliott Hughes
52541eea33 C23: add timespec_getres() and the new TIME_* constants.
Nothing to see here --- you'll want to keep using POSIX clock_gettime()
and clock_getres() instead. But portable code might use this eventually,
and it's trivial, so let's add it anyway.

(The whole "zero as an error return" precluding the direct use of
Linux's CLOCK_ constants is what really makes this a terrible API ---
we're going to have to add explicit translation any time they add a
new base.)

Test: treehugger
Change-Id: Iddb6cbe67b67b2b10fdd8b5ee654896d23deee47
2023-04-25 17:29:22 -07:00
Treehugger Robot
4d1405e509 Merge "Nullability check for modules in the netinet directory." 2023-04-25 22:35:44 +00:00
zijunzhao
577177a326 Nullability check for modules in the netinet directory.
Bugs: b/245972273
Test: adb shell
Change-Id: Ia133f55c3e93ae00b605298365f1c00396bcfba7
2023-04-25 20:10:14 +00:00
Elliott Hughes
873c1ca3cb Add SYS_riscv_flush_icache.
Fix the uapi import script to look at the riscv/asm/ directory too, and
re-run it to add the missing SYS_riscv_* entry (there's only this one)
to glibc-syscalls.h.

Test: treehugger
Change-Id: Ie52c6ca1943c05bb615932174e49e7fb79725a7b
2023-04-25 12:13:56 -07:00
Treehugger Robot
d3733e1edd Merge "riscv64: fix the name of Zisslpcfi." 2023-04-22 01:19:29 +00:00
Elliott Hughes
7663578d73 riscv64: fix the name of Zisslpcfi.
Love these risc-v extension names!

Test: N/A
Change-Id: Ieb13f82a507aa11d79650b2cf627e68f213d6a79
2023-04-21 15:32:46 -07:00
zijunzhao
271d4d2515 Nullability check for sem module.
Bugs: b/245972273
Test: adb shell
Change-Id: Ie29aa34c449300c53591557c99b6ec08ebe3efcf
2023-04-21 21:34:11 +00:00
zijunzhao
21e1f2d324 Nullability check for statvfs module.
Bugs: b/245972273
Test: adb shell
Change-Id: I7e28a869e4dd66a05182abe71ff121da7cfc7283
2023-04-21 00:06:14 +00:00
zijunzhao
3b846ea6e7 Implement C23 printf 'w' length modifiers
wN: Specifies that a following b, d, i, o, u, x, or X
conversion specifier applies to an integer argument with
a specific width where N is a positive decimal integer with
no leading zeros

Bug: b/271903607
Test: adb shell
Change-Id: I688f6cefeb2e5c8325b007a59935a46f4116ac29
2023-04-20 20:34:33 +00:00
Zijun Zhao
e2abfb3ddf Merge "Nullability check for select module." 2023-04-20 17:33:46 +00:00
zijunzhao
7ce2f95e28 Nullability check for wchar module.
Bugs: b/245972273
Test: adb shell
Change-Id: I9898a1120c2364e5269633a67bf789a8bb943ba5
2023-04-20 01:41:49 +00:00
zijunzhao
271abebf58 Nullability check for select module.
Bugs: b/245972273
Test: adb shell
Change-Id: If847c46df7f1666e4d0d530b196ee3e2be6f0cb8
2023-04-20 01:19:03 +00:00
Elliott Hughes
17b2bae190 Merge "Make tmpfile() respect $TMPDIR." 2023-04-19 20:01:51 +00:00
Spandan Das
a43de5cbfe Revert "Add versions property to libc_hwasan stubs"
This reverts commit fe2907c133.

Reason for revert: Breaks bionic-unit-tests b/278795547. Since the original mixed build change is being reverted for now (aosp/2547450), fe2907c133 is not needed immediately

Change-Id: I2deb06a38322bf8296d4721c840f06f35b757177
2023-04-19 17:06:24 +00:00
Elliott Hughes
8b86c0bdeb Make tmpfile() respect $TMPDIR.
Contrary to the old comment, POSIX says nothing about whether or not
tmpfile() respects $TMPDIR, and it's significantly more useful on
Android if it does (because there's no shared /tmp that everyone can
write to).

Bug: https://issuetracker.google.com/36991167
Test: treehugger
Change-Id: I3cc45adff167420f100c8ed1c63cba1ea67e9f70
2023-04-18 17:11:06 -07:00
Spandan Das
fe2907c133 Add versions property to libc_hwasan stubs
bp2build will generate the stub targets only if versions is not empty.

Test: b query //bionic/libc:* | grep libc_hwasan_stub_libs-current

Change-Id: Iac905497ae4955a44b7b29e2d29a2c702c86da8e
2023-04-18 16:38:46 +00:00
Zijun Zhao
7b90c81b7c Merge "Nullability check for mount module." 2023-04-17 18:41:24 +00:00
Zijun Zhao
8d3ae82c52 Merge "Nullability check for inotify module." 2023-04-17 18:25:05 +00:00
Treehugger Robot
e1df179f00 Merge "Nullability check for wait module." 2023-04-17 18:13:09 +00:00
Treehugger Robot
a1ff2e6159 Merge "Nullability check for msg module." 2023-04-17 18:09:10 +00:00
zijunzhao
fa1936bd0b Nullability check for wait module.
Bugs: b/245972273
Test: adb shell
Change-Id: I407cc592522fc8feda1916d72525d147c9c58711
2023-04-15 01:17:54 +00:00
zijunzhao
ccc9d8dbf4 Nullability check for mount module.
Bugs: b/245972273
Test: adb shell
Change-Id: I86ccf6c68f8376e47cb59f05c737d4bbef58ef86
2023-04-15 01:16:51 +00:00
zijunzhao
f4141fbcfa Nullability check for inotify module.
Bugs: b/245972273
Test: adb shell
Change-Id: I213035a8a3cf1fada0092f97c42723739d49db61
2023-04-15 01:15:31 +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
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
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
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
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
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
1cccc1a059 Merge "Nullability check for resolv module" 2023-03-11 01:26:13 +00:00
zijunzhao
e589574d22 Nullability check for thread module
Bugs: b/245972273
Test: adb shell
Change-Id: Id93d0456e063adf0d41483a1f99f66c2d67bd4df
2023-03-10 20:37:27 +00:00
zijunzhao
16c23883bd Nullability check for resolv module
Bugs: b/245972273
Test: adb shell
Change-Id: I3ee948b3c832ece1969453d499e6f5de5d0bd85e
2023-03-10 01:40:04 +00:00
Elliott Hughes
d2e55dd05b Merge "The syscall call uses the 'tail' instruction call" 2023-03-09 22:03:42 +00:00
caowencheng
c42c74138c The syscall call uses the 'tail' instruction call
If the 'j' command is used here,it cannot always be called.
The 'tail' command is used here, let the compiler decide
which instruction to use,when the call distance is less
than 1M, it will be compiled into 'j' command, and when
the distance is greater than 1M, it will be compiled
into 'aupic' and 'jr' command.

Test: llvm-objdump -d
Change-Id: I53d8aa7f54b9c4c96fce491487dcba7b63348219
Signed-off-by: caowencheng <caowencheng@eswincomputing.com>
2023-03-09 07:44:03 +00:00
Zijun Zhao
7f8133dc2f Merge "Nullability check for pidfd module" 2023-03-09 00:06:12 +00:00
Zijun Zhao
85fc6b141e Merge "Nullability check for utsname module" 2023-03-08 23:47:42 +00:00
Zijun Zhao
5bfbc5330f Merge "Nullability check for assert module" 2023-03-08 23:47:30 +00:00
Elliott Hughes
6cb7db2b03 Merge "riscv64: use tail for tail calls." 2023-03-08 21:13:37 +00:00
zijunzhao
edc554dace Nullability check for pidfd module
Bugs: b/245972273
Test: adb shell
Change-Id: I825cd4091f6e9d052a332e91c8b2455dd5c71b01
2023-03-08 21:06:57 +00:00
zijunzhao
f6f0c9dd1b Nullability check for utsname module
Bugs: b/245972273
Test: adb shell
Change-Id: I713c54998ab32e3dc9a6d53fd64523f5fdcbf79a
2023-03-08 21:05:19 +00:00
zijunzhao
698b6160a3 Nullability check for assert module
Bugs: b/245972273
Test: adb shell
Change-Id: Ic682d7bfd1dab53a776bcd783fbff9df07e309f5
2023-03-08 21:02:48 +00:00
Elliott Hughes
b0d3f0bcef riscv64: use tail for tail calls.
Don't assume that a `j` will always be in range. Let the toolchain
come up with the shortest sequence that will actually work.

Test: llvm-objdump -d
Change-Id: I497a68ecae434aad173c2b1c8024aed3756b8440
2023-03-08 18:22:29 +00:00
Treehugger Robot
a7015eaa64 Merge "Fix the compile errors "R_RISCV_JAL out of rang" when the jump range is greater than 1M memory space between vfork and __set_errno_internal" 2023-03-08 18:19:19 +00:00
Treehugger Robot
7f2f9410ab Merge "Nullability check for grp module" 2023-03-08 06:26:15 +00:00
Zijun Zhao
2c445d9979 Merge "Nullability check for stdio module" 2023-03-08 05:16:57 +00:00
caowencheng
d27c83fbd4 Fix the compile errors "R_RISCV_JAL out of rang" when the jump range is greater than 1M memory space between vfork and __set_errno_internal
the "tail" command is used here, let the compiler decide
which instruction to use. when the call distance is less
than 1M, it will be compiled into "jr" command, and when
the distance is greater than 1M, it will be compiled
into "aupic" and "jr" command.

Test: make libc
Change-Id: I80d099d25c7cc2439a297d8afc65abeb5a7a360c
Signed-off-by: caowencheng <caowencheng@eswincomputing.com>
2023-03-08 01:44:50 +00:00
Alistair Delva
78f71a53e5 Merge "Guard registers definitions for riscv64" 2023-03-08 00:55:11 +00:00
zijunzhao
33102fb381 Nullability check for grp module
Bugs: b/245972273
Test: adb shell
Change-Id: Ic45b8ff095f5e388389078b63ac2cd5e745422cf
2023-03-08 00:15:01 +00:00
Nelly Vouzoukidou
1cb31580f8 Guard registers definitions for riscv64
Guarding the definitions of registers with `#if definded(__USE_GNU)`.
This resolves a name conflict with the mesa3d library when
Virgl is enabled.

Test: launch_cvd -console=true -guest_enforce_security=false\
                 --gpu_mode=drm_virgl
Change-Id: I4402500eff74e26343700c099dd397b8a19a5ee3
2023-03-07 17:03:41 +00:00
Elliott Hughes
75a114b0b1 Merge "Sync with upstream openbsd." 2023-03-07 16:48:06 +00:00
Elliott Hughes
056ce2eb34 Merge "Add the %b/%B PRI* and SCN* macros." 2023-03-07 16:21:44 +00:00
zijunzhao
00a3dbaab6 Nullability check for stdio module
Bugs: b/245972273
Test: adb shell
Change-Id: I6d1f2afad6ab3f884795a2d33875684a14fe54d6
2023-03-07 01:07:19 +00:00
Elliott Hughes
53b6dfbc64 Sync with upstream openbsd.
Upstream made a change similar to our %s change, so we don't need that
difference any more. (But they didn't seem interested in our GNU
extensions, even though they're sensible ones that just ensure symmetry
between strftime() and strptime().)

Bug: http://b/167569813
Test: treehugger
Change-Id: I1d86d69c87b51719f0583341fafa7802869cd37e
2023-03-06 23:32:48 +00:00
Elliott Hughes
ac34ad2ae6 Add the %b/%B PRI* and SCN* macros.
This was a suggested change:

https://open-std.org/JTC1/SC22/WG14/www/docs/n3072.htm#pri-and-scn-macros-are-missing-for-new-format-specifiers

That has been accepted, but at the time of writing, there isn't yet
a new PDF that includes the changes.

Test: treehugger
Change-Id: If7b68d246561716465e937a7d2c7482d2c739ce7
2023-03-06 21:41:54 +00:00
Elliott Hughes
529c16a678 Merge "memset_chk into assembly file" 2023-03-06 20:53:36 +00:00
caowencheng
ab457f9022 memset_chk into assembly file
Writing an assembly file can reduce several
assembly instructions, and compare it through
the disassembly of this file

Test: make libc
Change-Id: Ifdcc9c76742cc95b2ad9e3c14fac4796c36e12e6
Signed-off-by: caowencheng <caowencheng@eswincomputing.com>
2023-03-06 07:23:10 +00:00
Elliott Hughes
ae1c64ac92 Slightly simplify perror().
Using %m is slightly less code, and means that perror() wouldn't touch
the strerror buffer in TLS. Doesn't matter, but noticed while I was
looking at this for another reason, and since it's _less_ code...

Test: treehugger
Change-Id: I99d31a5c326962958ad843ec4da2c3cc3b93b048
2023-03-03 23:46:34 +00:00
Elliott Hughes
8dd531cef9 Merge "Remove #if cruft." 2023-03-02 23:55:45 +00:00
Elliott Hughes
dc3ed4f164 Merge "Pull flockfile/funlockfile/ftrylockfile into stdio.cpp." 2023-03-02 21:24:19 +00:00
Elliott Hughes
20dd3fed7a Pull flockfile/funlockfile/ftrylockfile into stdio.cpp.
These are just one-liners, and the _FLOCK() macro seemed to me more
obscure than just inlining it (especially because there are only four
call sites total, so it's not like anyone's going to see that macro very
often).

Also add the missing CHECK_FP() calls. I don't expect this to break
anything, but if it does we can add a target API level check.

Test: treehugger
Change-Id: Ifa1a39d5d9eee46cca783acbe9ec3b3a1e6283d9
2023-03-02 01:44:54 +00:00
Zijun Zhao
6bda367899 Merge "Nullability check for dlfcn module" 2023-03-02 00:32:47 +00:00
zijunzhao
447c346475 Nullability check for dlfcn module
Bugs: b/245972273
Test: adb shell
Change-Id: I0ecde8a0f1f71b6ec2262ff637d33c518578d54d
2023-03-01 21:29:41 +00:00
Elliott Hughes
5ee6292872 Remove #if cruft.
There's negative value to explicitly calling out Linux and ELF here,
when Android -- and especially this project -- is always both anyway.

No functional change.

Test: treehugger
Change-Id: Ic7514d74a5b5f6f06e64c46486c12773995076cd
2023-03-01 20:26:41 +00:00
zijunzhao
e7d41ab7c0 Nullability check for ifaddrs module
Bugs: b/245972273
Test: adb shell
Change-Id: Iccb419667282922d31e2c81b3d9dbac8b6009a76
2023-03-01 01:36:30 +00:00
Elliott Hughes
93398b1b14 Merge "Remove <pthread.h> cruft." 2023-02-28 16:27:57 +00:00
zijunzhao
6b6d51e9ea Nullability check for stdio_ext module
Bugs: b/245972273
Test: adb shell
Change-Id: I4175218f6fa7f4581a739bb0f12cf10b6bdb529e
2023-02-27 23:34:25 +00:00
Elliott Hughes
9108f258ad Remove <pthread.h> cruft.
The next NDK to take these headers only supports API 21 and later.

Note that this change leaves the _implementation_ of these functions
behind, so that any old apps calling these APIs should continue to work,
you just can't (without declaring the functions yourself) write new ones
that do (and declaring the functions yourself would only work on LP32
anyway, so that's not going to get you very far in 2023).

Test: treehugger
Change-Id: Ie03514e4215b40f6e9feaa6e4bf5df5b16dc8d59
2023-02-27 21:31:11 +00:00
Elliott Hughes
957d34a85c Merge "Remove libandroidsupport cruft." 2023-02-25 02:28:38 +00:00
Elliott Hughes
20cd43a66d Merge "Remove <stdlib.h> cruft." 2023-02-24 23:35:29 +00:00
Zijun Zhao
41a4aa3174 Merge "Nullability check for iconv module" 2023-02-24 23:14:16 +00:00
Zijun Zhao
67737cdf9f Merge "Nullability check for error module" 2023-02-24 23:08:57 +00:00
Zijun Zhao
2b26a1e22c Merge "Nullability check for ftw module" 2023-02-24 20:33:47 +00:00
Elliott Hughes
fbd79707c3 Remove <stdlib.h> cruft.
The next NDK to take these headers only supports API 21 and later.

Test: treehugger
Change-Id: Ib5962989c5c978996b04789c21c0822dd8792303
2023-02-24 19:48:50 +00:00
zijunzhao
377954fdc6 Nullability check for error module
Bugs: b/245972273
Test: adb shell
Change-Id: I9d1c20cf2a7e1e4201c3c54a321c9d9f896c92e2
2023-02-24 19:44:21 +00:00
Pierre-Clément Tosi
39aed9c58a Merge "librust_baremetal: Add libc_netbsd" 2023-02-24 19:42:45 +00:00
Elliott Hughes
fa7c0dbf47 Remove libandroidsupport cruft.
The next NDK to take these headers only supports API 21 and later.

Test: treehugger
Change-Id: I084ec887158ce4e40d6927df49da748671bfd127
2023-02-24 19:33:33 +00:00
Elliott Hughes
f2ca0bc13d Merge "Remove <sys/socket.h> inlines for obsolete API levels." 2023-02-24 19:23:51 +00:00
Elliott Hughes
59d90262ed Merge "Remove <fenv.h> inlines for obsolete API levels." 2023-02-24 19:23:24 +00:00
Elliott Hughes
f5e899d84d Merge "Remove <sys/stat.h> inlines for obsolete API levels." 2023-02-24 19:23:15 +00:00
Elliott Hughes
af17562d0e Merge "Remove <time.h> cruft." 2023-02-24 19:23:06 +00:00
Elliott Hughes
7dfa18a49f Merge "Remove <signal.h> inlines for obsolete API levels." 2023-02-24 19:19:19 +00:00
Elliott Hughes
66734f0c35 Merge "Remove <sys/mman.h> inlines for obsolete API levels." 2023-02-24 19:19:13 +00:00
Elliott Hughes
d54d92c4fd Merge "Remove <errno.h> inlines for obsolete API levels." 2023-02-24 19:18:38 +00:00
zijunzhao
32b6d4371e Nullability check for iconv module
Bugs: b/245972273
Test: adb shell
Change-Id: I9b6223b039cffda1f665c01013900824b35a8e42
2023-02-24 02:32:35 +00:00
zijunzhao
d6af63b795 Nullability check for ftw module
Bugs: b/245972273
Test: adb shell
Change-Id: If132a01d3e07ddb92a81e3289aa7cd4f83b44b51
2023-02-24 01:44:26 +00:00
Elliott Hughes
b5ff68cf24 Remove a tautology from <bits/threads_inlines.h>.
The next NDK to take these headers only supports API 21 and later.

Test: treehugger
Change-Id: I31a07842a498e818ec8f16c217c365b100a5e05b
2023-02-24 01:02:24 +00:00
Elliott Hughes
f4105789fb Remove <time.h> cruft.
The next NDK to take these headers only supports API 21 and later, but
even if it didn't --- there is no inline!

Test: treehugger
Change-Id: Ibb194e1cbf0a8551bff863d940d92c35ed06a1e1
2023-02-24 00:56:25 +00:00
Elliott Hughes
82b0d52cb0 Remove <sys/socket.h> inlines for obsolete API levels.
The next NDK to take these headers only supports API 21 and later.

Test: treehugger
Change-Id: I445eb6ea2d42c3c8a4beb12ef88ba423cfb64f20
2023-02-24 00:46:48 +00:00
Elliott Hughes
19ed204031 Remove <sys/mman.h> inlines for obsolete API levels.
The next NDK to take these headers only supports API 21 and later.

Test: treehugger
Change-Id: I64baf933d3796f20dee5c1465ed58f8bb45394b5
2023-02-24 00:41:30 +00:00
Elliott Hughes
acaaab007c Remove <errno.h> inlines for obsolete API levels.
The next NDK to take these headers only supports API 21 and later.

Test: treehugger
Change-Id: Ie9e9bc82612a326d9e608b0d5974231f4acc5638
2023-02-24 00:32:47 +00:00
Elliott Hughes
432a4afb1e Remove <signal.h> inlines for obsolete API levels.
The next NDK to take these headers only supports API 21 and later.

Test: treehugger
Change-Id: I8fe617e6eb781629ddf0b98b0037a9b3e54c559c
2023-02-24 00:28:20 +00:00
Elliott Hughes
2f5829b55d Remove <fenv.h> inlines for obsolete API levels.
The next NDK to take these headers only supports API 21 and later, so
clean up some of the trivial cruft.

Test: treehugger
Change-Id: Ib735a776d244cc82858f2ed629dd63a54dbaf650
2023-02-24 00:16:41 +00:00
Elliott Hughes
3f3a8cd57e Remove <sys/stat.h> inlines for obsolete API levels.
The next NDK to take these headers only supports API 21 and later.

Test: treehugger
Change-Id: Ia2a4c04fdd144cfbe961bdf8d4f53bd4958befe8
2023-02-23 22:53:37 +00:00
Elliott Hughes
b890ff36d1 Merge "libc/include: remove easy __ANDROID_API__ tautologies." 2023-02-23 22:45:57 +00:00
Elliott Hughes
6ccb71ca0c Merge "Remove <sys/statvfs.h> inlines for API level 19." 2023-02-23 18:55:04 +00:00
Elliott Hughes
f4ace9d634 libc/include: remove easy __ANDROID_API__ tautologies.
The next NDK to take these headers only supports API 21 and later, so
clean up some of the trivial cruft.

This doesn't include the remaining "legacy inlines", since they're a bit
more complicated. I'll remove those in later changes.

Test: treehugger
Change-Id: I94c32f6393dd3ae831165917303ea591222baa0d
2023-02-23 17:38:37 +00:00
Elliott Hughes
9a7155dbbd riscv64 SCS support.
Bug: https://github.com/google/android-riscv64/issues/55
Test: treehugger
Change-Id: I05d48a07a302305126942d38529ffa280640c7b7
2023-02-23 01:21:07 +00:00
Elliott Hughes
3c3736e1bd Remove <sys/statvfs.h> inlines for API level 19.
API level 19 is no longer supported by the NDK.

While I'm here, let's remove the duplicated structure defintion (as
we've already done for `struct stat`).

Test: treehugger
Change-Id: I9d8286f9e7ba803f3131b6dcb0486ff1b0f9d5d1
2023-02-22 21:58:24 +00:00
Christopher Ferris
8b7fdc9124 Update to v6.2 kernel headers.
Kernel headers coming from:

Git: https://android.googlesource.com/kernel/common/
Branch: android-mainline
Tag: android-mainline-6.2

Test: Bionic unit tests pass.
Change-Id: I9f665add01ebeb155dd8a934308897f90000a557
2023-02-21 13:36:32 -08:00
Elliott Hughes
d3ebc2f7c4 Merge "Remove <stdlib.h> abs/labs/llabs inline for API level 19." 2023-02-21 21:14:49 +00:00
Pierre-Clément Tosi
eb46ac9ae4 librust_baremetal: Add libc_netbsd
Get bsearch and other baremetal-compatible functions from NetBSD.

Bug: 249723852
Bug: 262344886
Test: -
Change-Id: Idd90188ae13c84ed35af8f1475370cec0fe8cdbb
2023-02-21 15:47:01 +00:00
zijunzhao
3e39b3ac4a Nullability check for glob module
Bugs: b/245972273
Test: adb shell
Change-Id: Ic631bfe3c70080f140bb1be13e98ab751ab52252
2023-02-19 22:33:27 +00:00
Elliott Hughes
5fb10ce72d Merge "Remove <sys/wait.h> wait4() inline for API level 18." 2023-02-18 15:56:49 +00:00
Elliott Hughes
0572153fea Merge "Add documentation for a couple of pthread functions." 2023-02-18 02:12:08 +00:00
Elliott Hughes
527d01221e Remove <stdlib.h> abs/labs/llabs inline for API level 19.
API level 19 is no longer supported by the NDK.

Test: treehugger
Change-Id: I9fa1e9b3c492b3d3384e393994a7dddfdb35d805
2023-02-17 23:51:57 +00:00
Elliott Hughes
ed07723a34 Remove <sys/wait.h> wait4() inline for API level 18.
API level 18 is no longer supported by the NDK.

Test: treehugger
Change-Id: I526b628bf3aa9215c9832275f7eeaa15b52a107d
2023-02-17 23:41:55 +00:00
Elliott Hughes
8d8a911eab Add documentation for a couple of pthread functions.
These cause great confusion, so explicitly point out that apps can't use
one, and probably want the other.

Bug: https://github.com/android/ndk/issues/1255
Test: N/A
Change-Id: I287e820dc45a8446e3c72c9a2e4007db76828e3b
2023-02-17 23:31:17 +00:00
Treehugger Robot
c83efcab83 Merge "Nullability check for fenv module" 2023-02-16 18:57:36 +00:00