Commit graph

2513 commits

Author SHA1 Message Date
Elliott Hughes
e37068889d Remove <ctype.h> cruft.
The NDK only supports API 21 and later, so we don't need to worry
about older API levels any more.

All the functions in this file are trivial, being but a single
instruction on most architectures. For that reason, we inline them by
default. (We continue to also provide actual symbols for any caller
that needs them --- in particular existing binaries!)

Also inline all the _l() variants too. No-one should be using them,
but since we're already using trickery to only implement the non-_l()
variants once, we may as well use the same trick for both.

Test: treehugger
Change-Id: I17637c49dd14be9e5ecb8246e72e8acc662739f1
2023-10-06 15:06:17 +00:00
Treehugger Robot
0962881106 Merge "s/master/main/" into main am: a01b292ab9 am: f461a3878c am: 3852cfe4cb am: 3b3e2e9d46 am: 381d04c046
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2773870

Change-Id: If6c55eb8331d792fdb9836bc5cb32f220ed860a4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-05 21:12:57 +00:00
Treehugger Robot
a01b292ab9 Merge "s/master/main/" into main 2023-10-05 17:36:09 +00:00
Elliott Hughes
6b302c6354 Merge "Reduce duplication in the NOTICE file." into main am: 22743e3a7e am: f8d775b943 am: ce7fe40659 am: 9fc4c42656 am: 4023666514
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2773704

Change-Id: I51ff69aa78e23d3231778be1ddf1e9076b166cb5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-05 02:51:24 +00:00
Elliott Hughes
9c06d16ca3 s/master/main/
Test: treehugger
Change-Id: I2c975b2f5f92f23c7357b6f7e785578504298cc6
2023-10-04 23:36:48 +00:00
Elliott Hughes
73e37b535a Reduce duplication in the NOTICE file.
Test: treehugger
Change-Id: I8a9c4f22534330dd498636a155b872bd2d2af5b6
2023-10-04 22:28:27 +00:00
Elliott Hughes
7add1bbca8 Merge "Add strerrordesc_np() and strerrorname_np()." into main am: a67fe1b171 am: d37c19670a am: 5f921a71e1 am: 546379ea3d am: a2224bbe45
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2760166

Change-Id: Iae04cc2f17e272e0212b92dbeb5d776aeeb8cc62
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-28 04:05:28 +00:00
Elliott Hughes
a67fe1b171 Merge "Add strerrordesc_np() and strerrorname_np()." into main 2023-09-27 22:26:37 +00:00
Elliott Hughes
2109f12c3b Add strerrordesc_np() and strerrorname_np().
strerrordesc_np() isn't very useful (being just another name for
strerror()), but strerrorname_np() lets you get "ENOSYS" for ENOSYS,
which will make some of our test assertion messages clearer when we
switch over from strerror().

This also adds `%#m` formatting to all the relevant functions.

Test: treehugger
Change-Id: Icfe07a39a307d591c3f4f2a09d008dc021643062
2023-09-27 11:21:12 -07:00
Treehugger Robot
88dd367bef Merge "<sys/statvfs.h>: add a new mount option." into main am: 732b98203b am: a325f94c85 am: e7430e692f am: 4789e289f3 am: c9ca34ce85
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2760790

Change-Id: I32714539af9486e7e6db71d2c3ac452ac2134fc4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-23 05:00:48 +00:00
Elliott Hughes
6711d21230 <sys/statvfs.h>: add a new mount option.
This flag was added as part of
https://sites.google.com/a/chromium.org/dev/chromium-os/chromiumos-design-docs/hardening-against-malicious-stateful-data#TOC-Restricting-symlink-traversal
in 2020.

Annoyingly, these flags are in include/linux/statvfs.h rather than in
the uapi headers, so we don't get them for free.

Test: treehugger
Change-Id: I55c0dcc8a5da17c3efc8938ec04f23f157764d4d
2023-09-22 19:48:05 +00:00
Treehugger Robot
1de053cd59 Merge "Add the risc-v TLSDESC relocations." into main am: 631dfbb8ad am: ed30c58ae0 am: 843c792620 am: 2ded7e6e23 am: 77fd02d176
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2752785

Change-Id: Icc2c719959e6d725d8d5e778633da0e875e6eb4c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-16 00:31:40 +00:00
Treehugger Robot
631dfbb8ad Merge "Add the risc-v TLSDESC relocations." into main 2023-09-15 19:53:19 +00:00
Elliott Hughes
ba7654ad92 Add the risc-v TLSDESC relocations.
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/94 was
merged.

Bug: https://github.com/google/android-riscv64/issues/3
Test: treehugger
Change-Id: Ifc0c4d7408367f0372cec969d4ee6f84699bee30
2023-09-14 18:02:17 +00:00
Christopher Ferris
050206e6dd Merge "Update to v6.5 kernel headers." into main am: 6d2b71eb45 am: 74415a49e9 am: 150238db38 am: 4661569b5b am: 0206ee1a6d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2743819

Change-Id: I4f4b7af5f02387142b4bf7cb305ae6aaf7a6159c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-12 22:06:05 +00:00
Christopher Ferris
8666d0462f Update to v6.5 kernel headers.
Kernel headers coming from:

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

Test: Builds and bionic unit tests pass on raven.
Test: Able to log in to an Android GO 32 bit device.
Change-Id: Ia0397ce27e088bc20338bbd2d125be6f169c4ba0
2023-09-06 19:33:21 -07:00
Elliott Hughes
7eac72c3cc Merge "Add epoll_pwait2()." into main am: 906d7d41e4 am: 484056aaf2 am: 96a6c6abc1 am: a607f6744f am: cbaea16804
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2656904

Change-Id: I8915b268e7ec3c1abe1ff11d8090ca8f84316b97
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-06 01:48:32 +00:00
Elliott Hughes
906d7d41e4 Merge "Add epoll_pwait2()." into main 2023-09-05 21:48:08 +00:00
Elliott Hughes
4c238d8dea Merge "__riscv_hwprobe: don't try to set errno." into main am: 4de14c7499 am: e62a9e0329 am: d086dd0ef4 am: e888177487 am: 95c3c58d2e
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2731044

Change-Id: Ia88d2ff7a36534c56969ba62a48518c164c35dea
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-30 20:15:29 +00:00
Elliott Hughes
d086dd0ef4 Merge "__riscv_hwprobe: don't try to set errno." into main am: 4de14c7499 am: e62a9e0329
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2731044

Change-Id: Ie20354036f9bd578b23344a5e6388ee68bfcb274
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-30 16:51:25 +00:00
Elliott Hughes
e62a9e0329 Merge "__riscv_hwprobe: don't try to set errno." into main am: 4de14c7499
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2731044

Change-Id: I9a73661a7e500e689285e62f57773b727d94ce5b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-30 16:02:53 +00:00
Elliott Hughes
92424f76cb Merge "<termios.h>: add two new POSIX functions." into main am: b130e6dae0 am: f9189bb67d am: 0e87776adc am: 42fd8dbd98 am: 678e06ac31
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2729340

Change-Id: I4289276cf2977a006d1a771e8bec2a74a7902912
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-30 01:39:55 +00:00
Elliott Hughes
0e87776adc Merge "<termios.h>: add two new POSIX functions." into main am: b130e6dae0 am: f9189bb67d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2729340

Change-Id: I42a8041d25c29bd58ffdd91e29a3feef8ec85be4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-29 23:16:11 +00:00
Elliott Hughes
fce8a155df __riscv_hwprobe: don't try to set errno.
When used in an ifunc resolver, errno@plt won't be available. This is
the API the rivos folks contributing to glibc are leaning towards, for
the same reason. Hit by the berberis folks because they don't implement
the syscall so they were trying to set errno to ENOSYS.

Tested by looking at the generated assembler, and also disabling the
vdso (since on actual systems, this will go via the vdso).

Test: treehugger
Change-Id: Ie2779110f141f20efe97cb892fbdefd808b5339b
2023-08-29 15:41:36 -07:00
Elliott Hughes
f9189bb67d Merge "<termios.h>: add two new POSIX functions." into main am: b130e6dae0
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2729340

Change-Id: I8640dfffbc43c7a5c0a5b1dcd42d8b031b25eb4b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-29 22:25:52 +00:00
Elliott Hughes
647472db9b <termios.h>: add two new POSIX functions.
musl already added tcgetwinsize() and tcsetwinsize(), but I didn't
notice.

Trivial single-line inlines added to a header that's already written
that way.

Test: treehugger
Change-Id: Iac95ea6a89f3872025c512f7e61987b81d0aafa7
2023-08-29 09:33:04 -07:00
Elliott Hughes
4c62e59fe6 Add epoll_pwait2().
I've also added doc comments for everything in <sys/epoll.h>.

I've also broken up the old "smoke" test (which was taking 2s on my
riscv64 qemu) to keep the total runtime for all the tests down to 200ms.

Test: treehugger
Change-Id: Icd939af51886fdf21432653a07373c1a0f26e422
2023-08-23 15:59:12 -07:00
Xin Li
661155efcb Merge Android U (ab/10368041)
Bug: 291102124
Merged-In: I89679e7152f197f9d0961eee352189bc7d1d1c50
Change-Id: I02dd1d48d478b0e0d702f1653271437e2cf7cef7
2023-08-23 14:43:14 -07:00
Juan Yescas
304f21df3c Merge "bionic: Set PTHREAD_STACK_MIN for page agnostic targets" into main am: fe690875d5 am: 6ffba3ea18 am: 81fffa2108 am: 160ab18874 am: 1b8591f26d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719582

Change-Id: I9d4ee180804a966c7964c5db7af68f52444a4a3f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 05:58:46 +00:00
Treehugger Robot
44f2404296 Merge "<sys/user.h>: factor PAGE_SIZE out into <bits/page_size.h>." into main am: 9fd0f4b90d am: 1882061f69 am: ca3bdafdd4 am: 628c6925e0 am: 6ed3136d47
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721533

Change-Id: I204f541caff1a602758e1a019f7f04c7b9ee4e55
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 21:14:19 +00:00
Juan Yescas
8d3866bacb bionic: Set PTHREAD_STACK_MIN for page agnostic targets
Page size agnostic targets will have a pthread stack equals
to 65536. Page size agnostic targets will only support ARM64 arch.

For not agnostic builds, PTHREAD_STACK_MIN will remain the same.

Bug: 296907948
Test: source build/envsetup.sh
      lunch aosp_cf_arm64_phone_pgagnostic
      m

      source build/envsetup.sh
      aosp_cf_x86_64_phone-userdebug
      m

Change-Id: Ifcc04a9d924501f686cdfec34428d3f29154fdf0
2023-08-22 20:04:13 +00:00
Treehugger Robot
9fd0f4b90d Merge "<sys/user.h>: factor PAGE_SIZE out into <bits/page_size.h>." into main 2023-08-22 18:21:22 +00:00
Treehugger Robot
1611e0ee52 Merge "riscv64: increase jmp_buf size." into main am: d4c9419441 am: 0fee718de7 am: fdbfa3c887 am: ebec2073e5 am: 668cee3bb2
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719577

Change-Id: I78e107a567a085455345092a36cba9962601d844
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 18:10:02 +00:00
Elliott Hughes
1245abf7e3 <sys/user.h>: factor PAGE_SIZE out into <bits/page_size.h>.
If we're going to need PAGE_SIZE in other places, we don't want the
namespace pollution of pulling in all of <sys/user.h>. (The experimental
support for non-4KiB pages found an existing place -- <pthread.h> --
where we were assuming PAGE_SIZE is already available, as if
<sys/user.h> has already been included, so that was actually an existing
bug.)

Test: treehugger
Change-Id: Icd90ffbca1f2cf3645fadb2e432f6f45a4d63eb6
2023-08-22 15:31:51 +00:00
Elliott Hughes
7c6c1f8b59 riscv64: increase jmp_buf size.
Today's risc-v psABI meeting brought up the topic of CFI-related ABI
changes, and FreeBSD wasn't worried about jmp_buf because they already
had twice the space we do (OpenBSD matches us, presumably because they
too just picked "the next power of two" over what they actually
required), and glibc wasn't worried because they have a hilariously
large sigset_t that they can steal space from (and apparently already
did to support the x86-64 CET shadow stack).

So rather than continue to assume that our minimal amount of free space
will suffice, let's just double it while our ABI isn't yet fixed, and
know we won't have to worry about it in a couple of years time when we
actually have riscv64 hardware shadow stack.

Test: treehugger
Change-Id: I2d4cb2f5db2ac8085a2c9e9ad4f910d0d4792005
2023-08-21 20:50:14 +00:00
Treehugger Robot
c4bd25f3a8 Merge "Add some new risc-v ELF relocations." into main am: 0c56cbad11 am: 333099cedb am: 9322f9611f am: 043b73ae28 am: 2b9a6fb187
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2717354

Change-Id: I6a51aa0303da6e04986abe5c1d828250323e4c5f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-20 13:16:43 +00:00
Treehugger Robot
0c56cbad11 Merge "Add some new risc-v ELF relocations." into main 2023-08-20 08:20:14 +00:00
Elliott Hughes
f517b68c82 Add some new risc-v ELF relocations.
Also add the link to the canonical source.

Test: treehugger
Change-Id: I06c5d1ded5e1b372630c6963c81947450946c29a
2023-08-18 17:51:53 +00:00
Juan Yescas
02f37a2c14 Merge changes from topic "bionic no page size macro" into main am: 6e73f92f04 am: d277b4a2b4 am: 55499d78ea am: fd299bd8c4 am: 9a4073ead4
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2702053

Change-Id: I4b8b7f284328c628ac30a7ef904f4e3957063815
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-11 10:09:59 +00:00
Juan Yescas
7de2012422 bionic: PAGE_SIZE macro won't be used in page size agnostic targets
When the C flag -D__BIONIC_NO_PAGE_SIZE_MACRO is defined,
the PAGE_SIZE macro won't be used for page size agnostic builds.

Note: Only arm64 architectures support page size agnostic builds.

Bug: 277272383
Bug: 289419664

Test: source build/envsetup.sh
      lunch aosp_cf_arm64_phone_pgagnostic
      m

      source build/envsetup.sh
      lunch aosp_cf_x86_64_phone
      m

Change-Id: I755d5fcdd493fe6da5277a60d8e90805e9b2754d
2023-08-10 15:33:02 -07:00
Treehugger Robot
0293cd474c Merge changes Ia6b8cff4,I390ea200 into main am: 007bb4d1e8 am: 8003988d69 am: e1be10f328 am: 0d863ca056 am: 9f60001427
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2670165

Change-Id: I79c687319663c740feed983847eefaf4c2824698
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-05 01:59:51 +00:00
Dan Albert
a9e914dd2f Make multibyte result constants public.
The magic numbers that C defines are obnoxious. We had partial
definitions for these internally. Add the missing one and move them to
a public header for anyone else that may want to use them.

Bug: None
Test: None
Change-Id: Ia6b8cff4310bcccb23078c52216528db668ac966
2023-08-04 19:48:35 +00:00
Elliott Hughes
0e77183a65 Merge "riscv64: add <sys/hwprobe.h>." into main am: c4d3867b6c am: 98f649e224 am: 63043c04ad am: fa6b4559f7 am: 7fcea3c45a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2679530

Change-Id: Id7a4a3e60b84cc87abe1c6043828fa60a9644bc0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-29 03:43:58 +00:00
Elliott Hughes
f3d6b44e2b riscv64: add <sys/hwprobe.h>.
This is source compatible with the current proposal for glibc.

Bug: https://github.com/google/android-riscv64/issues/27
Test: treehugger
Change-Id: I428777e4eac1fe643d442a93a4b3ad1fdf0ffd97
2023-07-28 09:29:06 -07:00
Treehugger Robot
8fb52847a0 Merge "Listen on property_service_for_system socket for powerctl messages" into main 2023-07-19 22:18:07 +00:00
Elliott Hughes
0d30cf6fe2 Merge "Update <sys/cachectl.h>." into main am: 9634513a63 am: b7f7f55e1e am: 389fbc14a9 am: 40663afff0 am: f986f09cb9
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2661559

Change-Id: Ie57c8953c30499476ac0c34f0e739df1aa87733f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-19 02:05:24 +00:00
Treehugger Robot
f7789c169f Merge "Make getentropy available from <unistd.h>" into main am: 7ca162602b am: 84b1673b7d am: 5f08946acf am: f5cb7c1701 am: 2baab919e6
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2659335

Change-Id: I83b0002fa9a546be27a835ee3a71e0eeef6fbb42
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-19 00:07:27 +00:00
Elliott Hughes
9634513a63 Merge "Update <sys/cachectl.h>." into main 2023-07-18 22:36:53 +00:00
Treehugger Robot
7ca162602b Merge "Make getentropy available from <unistd.h>" into main 2023-07-18 20:10:06 +00:00
Elliott Hughes
8d350da500 Update <sys/cachectl.h>.
NDK API review complained about missing nullability annotations (added),
not having a `__riscv` #if guard around this function (added), and not
using `__INTRODUCED_IN(35)`. I haven't done the last of these because
that seems less helpful than the traditional "nothing" meaning "always
available" (since this riscv64-only function will be available from
whatever the first riscv64 API level ends up being).

Bug: http://b/291777120
Test: treehugger
Change-Id: I501b42851bd5b1612244bd86351628d249a57b99
2023-07-18 18:58:02 +00:00
Paul Lawrence
71ade013f4 Listen on property_service_for_system socket for powerctl messages
It is easy to dos the property_service socket, since it will wait for a
complete data packet from one command before moving on to the next one.

To prevent low privilege apps interfering with system and root apps,
add a second property_service socket that only they can use.

However, since writes to properties are not thread-safe, limit use of
this second socket to just sys.powerctl messages. These are the messages
that this security issue is concerned about, and they do not actually
write to the properties, rather they are acted upon immediately.

Bug: 262208935
Test: Builds, boots
Ignore-AOSP-First: Security fix
Change-Id: I1e96444115de4cc0b021c6864922845de331f6a7
2023-07-18 08:51:19 -07:00
David Benjamin
7110157e94 Make getentropy available from <unistd.h>
getentropy is originally an OpenBSD-ism, where it was in <unistd.h> from
day one:
https://man.openbsd.org/OpenBSD-5.6/getentropy

FreeBSD's and Linux's current man pages also document it this way:
https://man7.org/linux/man-pages/man3/getentropy.3.html
https://man.freebsd.org/cgi/man.cgi?query=getentropy&sektion=3&format=html

The man7.org URL is even cited by bionic itself in the comments, though
glibc originally put it in <sys/random.h> and added to <unistd.h> very
shortly afterwards:
https://sourceware.org/bugzilla/show_bug.cgi?id=17252#c9

The cited man page (maintained separately from glibc) originally
documented <sys/random.h>...
https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man3/getentropy.3?id=b0265728162cdcafb8e7d7f1372e8de1a4c963ed

But similarly fixed it to <unistd.h> three months later:
https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man3/getentropy.3?id=9cf011f94b56e8832c5a5d8cf66d4a115d34b9cc

musl matches the BSDs in putting it in <unistd.h>, but not
<sys/random.h>.
https://git.musl-libc.org/cgit/musl/tree/include/unistd.h?id=25e6fee27f4a293728dd15b659170e7b9c7db9bc#n183

POSIX will likely place it there too:
https://www.austingroupbugs.net/view.php?id=1134

macOS and Fuchsia place it in <sys/random.h> and not <unistd.h>, though
given the rest of this precedent, they're clearly outliers. (Note iOS
does *not* have getentropy, just macOS. The system has it, but it's not
exposed as public API. See https://dev.gnupg.org/T5375 and
https://github.com/openssl/openssl/pull/15924.)

Use the more standard location in bionic and put getentropy in
<unistd.h>. This will improve portability and avoid needing workarounds
in BoringSSL. For compatibility, keep it also available in
<sys/random.h> by using a <bits/getentropy.h> header.

BYPASS_INCLUSIVE_LANGUAGE_REASON=Above URLs are not hosted by Android and reference the name of a command-line utility, short for 'manual', as in instruction manual

Bug: 290898063
Test: treehugger
Change-Id: Id2d6b6ea09d814e5ba2cb117a7af2c74861148fb
2023-07-17 21:50:53 +00:00
Paul Lawrence
05328b4160 Revert "Use proprety_socket_for_system if permissions allow" am: 78973da8ef am: 5210d35c91
Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/24028889

Change-Id: I26225b9eb5a8e6875577eddb18f3bf9e83456f90
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-17 17:37:46 +00:00
Elliott Hughes
600c4e0cf3 Merge "Add __riscv_flush_icache() to <sys/cachectl.h>." into main am: a09f741c2a am: 953b78a72d am: 1cb2c81563 am: 7a62037690 am: 6efb89a064 am: ab17456006
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2655793

Change-Id: Ie093fdfd7f8fe1d0e3c6aeec0ad389a432ce8d40
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-14 00:44:01 +00:00
Elliott Hughes
7a62037690 Merge "Add __riscv_flush_icache() to <sys/cachectl.h>." into main am: a09f741c2a am: 953b78a72d am: 1cb2c81563
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2655793

Change-Id: If49d7451200b2c882f20a5edd0da5695d543b396
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-13 22:00:45 +00:00
Elliott Hughes
74d9765be9 Add __riscv_flush_icache() to <sys/cachectl.h>.
The obsolete mips header rides again!

The most interesting part of this change is that I've removed the hack
that meant that all system call wrappers starting with `__` defaulted to
being hidden symbols. That's no longer useful given our linker scripts,
and it actively got in the way here because the public libc symbol
actually starts with `__` in glibc, and it would be weird and annoying
for developers if we chose a different name.

Test: strace
Change-Id: I230479787895e8e34f566ade36346a8241eea998
2023-07-12 16:30:55 -07:00
Christopher Ferris
149baeb0aa Merge "Update to v6.4 kernel headers." into main am: df85637d32 am: eaafb7d35e am: e2e8b7017f am: ad535ae36c am: 35fe0883c3 am: 6c9c143c34
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2651110

Change-Id: Iea0a8d73f01ca910b7f666415786044a3b5eefb9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-12 02:14:23 +00:00
Christopher Ferris
ad535ae36c Merge "Update to v6.4 kernel headers." into main am: df85637d32 am: eaafb7d35e am: e2e8b7017f
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2651110

Change-Id: I4d352414927067c75fff6bfb0adeef9ac687dcbd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-12 00:07:59 +00:00
Christopher Ferris
df85637d32 Merge "Update to v6.4 kernel headers." into main 2023-07-11 21:51:16 +00:00
Paul Lawrence
78973da8ef Revert "Use proprety_socket_for_system if permissions allow"
This reverts commit 24839a681e.

These fixes for b/262208935 introduced a race condition. We believe the
race is fixed by ag/23879563, but at this point in the release feel that
reverting the fixes and refixing in main is the better solution

Test: Builds, boots
Bug: 283202477
Bug: 288991737
Ignore-AOSP-First: Reverting CL only in internal
Change-Id: If0736e504928641c85934eae4d298f14e711116c
2023-07-11 14:02:53 -07:00
Elliott Hughes
95cdbadd14 Merge "Clarify the <sys/ifunc.h> docs." into main am: 6a6f527dfc am: 6c29ab66c8 am: 708998128e am: c051c9376b am: a1aee26789 am: a35b7503f8
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2651113

Change-Id: Ie627c2e3245ba8e79c0ee7b4644743f4639219fa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-11 19:36:57 +00:00
Elliott Hughes
c051c9376b Merge "Clarify the <sys/ifunc.h> docs." into main am: 6a6f527dfc am: 6c29ab66c8 am: 708998128e
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2651113

Change-Id: I77200e0be472a2755b8d97b60f8492562131e0d2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-07-11 17:29:33 +00:00
Elliott Hughes
0c50ed4c7c Clarify the <sys/ifunc.h> docs.
This confused the Arm folks implementing function multi-versioning.

Test: treehugger
Change-Id: Ib56fc142bed4a2f2a394d60a07f322add40702e5
2023-07-10 22:32:09 +00:00
Christopher Ferris
37c3f3c67e Update to v6.4 kernel headers.
Kernel headers coming from:

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

Test: Bionic unit tests pass.
Change-Id: I991f8eaa2b272a464166addb13e6bdc63734444d
2023-07-10 10:59:05 -07:00
Steven Moreland
4b3d3fa472 Merge "Revert^2 "fdsan android::Parcel"" 2023-06-30 17:02:54 +00:00
Treehugger Robot
4e8a4d8858 Merge "Explicitly document overcommit and adb shell's use of oom_score_adj." am: 143f3cea32 am: f29bae24dc am: 8fee5d8740
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2638672

Change-Id: I7517e8859471623bc003c43137b43cdaae89fa34
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-27 01:30:44 +00:00
Elliott Hughes
0a94e1584e Explicitly document overcommit and adb shell's use of oom_score_adj.
This comes up now and then, and the different behavior with `adb shell`
in particular confuses people.

Bug: https://github.com/android/ndk/issues/1897
Test: N/A
Change-Id: I757fa6b6277610a139f326563d508fb9009dcb75
2023-06-26 19:03:41 +00:00
Treehugger Robot
511c5aa8cb Merge "Mark getpagesize() const." am: 48d405ea4b am: 6663a539b4 am: 23925d9c91
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2636854

Change-Id: I24ed50d9a0d062ca5df9985dbe153b4989b412d7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-24 03:40:52 +00:00
Treehugger Robot
48d405ea4b Merge "Mark getpagesize() const." 2023-06-24 01:09:17 +00:00
Elliott Hughes
c77993eda3 Mark getpagesize() const.
If folks want to use this instead of PAGE_SIZE, let's let the compiler
know that it doesn't need to be called more than once. Using "const"
rather than "pure" lets us cover more cases, and although this function
may need to check global state, it's _immutable_ global state, so it's
effectively "const".

Test: llvm-objdump -d
Change-Id: I0b13de79d44b57545258121df7cdd6490a9a5be1
2023-06-23 22:40:57 +00:00
Treehugger Robot
7ea8a9ea53 Merge "Document how to use tzalloc()/tzfree() with std::unique_ptr." am: 8995672880 am: 5aeec3b87d am: d301fe1a1f
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2636324

Change-Id: I45f25ed368998e0f8dba772f0d6c29fc167b07e3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-23 21:40:11 +00:00
Elliott Hughes
027f108b2e Merge "Fix tzalloc(nullptr) and add a test." am: 0e437c00e0 am: 8e1ea43c79 am: 667d82ead1
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2630990

Change-Id: I2312d32633d3dbb6f2bc54d6b734c489a7ab5904
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-22 23:45:01 +00:00
Steven Moreland
1d413fce69 Revert^2 "fdsan android::Parcel"
7836677d99

Change-Id: If972bf911fd61286780a7c9800239b83ecddccab
2023-06-22 23:03:57 +00:00
Priyanka Advani
7836677d99 Revert "fdsan android::Parcel"
Revert submission 23699976-fdsan-parcel

Reason for revert: Possible culprit for b/288448299

Reverted changes: /q/submissionid:23699976-fdsan-parcel

Change-Id: I709d2629755b7d014763a7bbd03a65d9f6e7efa7
2023-06-22 21:22:35 +00:00
Elliott Hughes
5ea305b10e Document how to use tzalloc()/tzfree() with std::unique_ptr.
The hidden pointer makes this trickier than the usual incantation, so
leave some copy & paste lying around for anyone trying to work this out.

Test: treehugger
Change-Id: I26e94bf7a74ce3e43de587edc52ab63e36d1d86b
2023-06-22 20:54:12 +00:00
Elliott Hughes
31fc69f67f Fix tzalloc(nullptr) and add a test.
This works (by reading /etc/localtime) on NetBSD, but not on Android
since we have no such file. Fix that by using our equivalent system
property instead.

Also s/time zone/timezone/ in documentation and comments. We've always
been inconsistent about this (as is upstream in code comments and
documentation) but it seems especially odd now we expose a _type_ that
spells it "timezone" to talk of "time zone" even as we're describing
that type and its associated functions.

Bug: https://github.com/chronotope/chrono/issues/499
Test: treehugger
Change-Id: I142995a3ab4deff1073a0aa9e63ce8eac850b93d
2023-06-22 09:51:01 -07:00
Treehugger Robot
75f70e7d15 Merge "Remove __INTRODUCED_IN_NO_GUARD_FOR_NDK(21)." am: 833ad6ee51 am: a43db276fd am: 36b4ebdecf
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2631630

Change-Id: I89679e7152f197f9d0961eee352189bc7d1d1c50
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-21 18:13:04 +00:00
Elliott Hughes
4c784ccfd6 Merge "Remove the always-true __INTRODUCED_IN() annotations." am: fee0b45480 am: 7fc60f8d93 am: 7b4b75bb9c
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2627536

Change-Id: Ib664b506e7a747716e2682e630f0686bcfa197f7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 22:43:19 +00:00
Christopher Ferris
0ceeea5a49 Merge "Add new mallopt M_LOG_STATS." am: 90e2827762 am: 29bedad140 am: 1e364e01b8
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2585453

Change-Id: Ia79a45c3a23c008e0c22cfb7e2c5e4ee000aa6f4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 22:42:53 +00:00
Elliott Hughes
2bdeff449b Remove __INTRODUCED_IN_NO_GUARD_FOR_NDK(21).
There are still some instances of
`__INTRODUCED_IN_NO_GUARD_FOR_NDK(26)` which we can get rid of after the
libc++ update, but we can get rid of the API level 21 instances right
now, since the NDK no longer supports older API levels anyway.

Test: treehugger
Change-Id: I243957f15b68d3d89ec8e15e2aefc45e8c294c31
2023-06-20 14:32:58 -07:00
Elliott Hughes
fee0b45480 Merge "Remove the always-true __INTRODUCED_IN() annotations." 2023-06-20 20:47:49 +00:00
Christopher Ferris
90e2827762 Merge "Add new mallopt M_LOG_STATS." 2023-06-20 20:35:53 +00:00
Elliott Hughes
5c5e6d1ba1 Merge "<arpa/nameser.h>: rationalize __INTRODUCED_IN." am: e405c90f19 am: fbca3365f9 am: 50fa6162f2
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2626138

Change-Id: I06f7688262f18e5c52385349dd0cd4053f31359a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 18:36:12 +00:00
Elliott Hughes
34e8dfd85a Merge "_FILE_OFFSET_BITS is spelled with one underscore." am: 0749b7bcbf am: 1e0a7c3690 am: d570e3f8be
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2627534

Change-Id: Ibc1d2a65b0f889fcb7d62c7f65fd64a451bf3a3f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-20 18:35:48 +00:00
Elliott Hughes
e405c90f19 Merge "<arpa/nameser.h>: rationalize __INTRODUCED_IN." 2023-06-20 16:56:13 +00:00
Christopher Ferris
e9a7b81d4a Add new mallopt M_LOG_STATS.
This new mallopt cause statistics of the allocator to be printed in
the log.

Add a stats print for jemalloc.

This is designed to be used as part of a dumpsys meminfo --XXXX
option so that it's easier to get information about apps that
have an unusual memory footprint.

Test: Unit tests pass.
Test: Ran on a device using jemalloc and verified log data.
Test: Ran on a device using scudo and verified log data.
Change-Id: I6fa44ce619c064b2596fbbb478c231994af94f4c
2023-06-17 00:00:02 +00:00
Elliott Hughes
9dbfe8bb69 <arpa/nameser.h>: rationalize __INTRODUCED_IN.
Investigation shows that the symbols that claimed to have been in 32-bit
builds one API level earlier than in 64-bit builds actually weren't ---
everything was actually API level 22. This patch fixes the libc.map.txt
to match reality, and then simplifies the __INTRODUCED_IN()
incantations.

Investigation also shows that we have a bunch of unused #defines, so
this patch removes the ones that don't correspond to functions we
actually expose.

Test: treehugger
Change-Id: I540dd0d1d9561cac17c55eb68a07bed58dd718fa
2023-06-16 15:59:52 -07:00
Elliott Hughes
655e430b28 Remove the always-true __INTRODUCED_IN() annotations.
The NDK no longer supports API levels earlier than 21.

This *doesn't* include <ctype.h> because I have a separate change
rewriting that (that's blocked on the upcoming libc++ update).

Test: treehugger
Change-Id: I53e915f27011dfc0513e0c78d8799377e183ceca
2023-06-16 12:39:33 -07:00
Elliott Hughes
836e81d019 _FILE_OFFSET_BITS is spelled with one underscore.
Test: treehugger
Change-Id: Ic21082ffa1083b63a95514dcd7f2d9e23f84c9b0
2023-06-16 11:55:07 -07:00
Elliott Hughes
bc93a2acf2 Merge "Expose tzalloc()/localtime_rz()/mktime_z()/tzfree()." am: f5cd29269f am: 472f1d099e am: ecb17c8cf4
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2626240

Change-Id: I1cebfa0141dc9ed977927f88ba5813f18427deda
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-16 17:40:04 +00:00
Elliott Hughes
f5cd29269f Merge "Expose tzalloc()/localtime_rz()/mktime_z()/tzfree()." 2023-06-16 15:14:24 +00:00
Elliott Hughes
2bd4316bd6 Expose tzalloc()/localtime_rz()/mktime_z()/tzfree().
* Rationale

The question often comes up of how to use multiple time zones in C code.
If you're single-threaded, you can just use setenv() to manipulate $TZ.
toybox does this, for example. But that's not thread-safe in two
distinct ways: firstly, getenv() is not thread-safe with respect to
modifications to the environment (and between the way putenv() is
specified and the existence of environ, it's not obvious how to fully
fix that), and secondly the _caller_ needs to ensure that no other
threads are using tzset() or any function that behaves "as if" tzset()
was called (which is neither easy to determine nor easy to ensure).

This isn't a bigger problem because most of the time the right answer
is to stop pretending that libc is at all suitable for any i18n, and
switch to icu4c instead. (The NDK icu4c headers do not include ucal_*,
so this is not a realistic option for most applications.)

But what if you're somewhere in between? Like the rust chrono library,
for example? What then?

Currently their "least worst" option is to reinvent the entire wheel and
read our tzdata files. Which isn't a great solution for anyone, for
obvious maintainability reasons.

So it's probably time we broke the catch-22 here and joined NetBSD in
offering a less broken API than standard C has for the last 40 years.
Sure, any would-be caller will have to have a separate "is this
Android?" and even "is this API level >= 35?" path, but that will fix
itself sometime in the 2030s when developers can just assume "yes, it
is", whereas if we keep putting off exposing anything, this problem
never gets solved.

(No-one's bothered to try to implement the std::chrono::time_zone
functionality in libc++ yet, but they'll face a similar problem if/when
they do.)

* Implementation

The good news is that tzcode already implements these functions, so
there's relatively little here.

I've chosen not to expose `struct state` because `struct __timezone_t`
makes for clearer error messages, given that compiler diagnostics will
show the underlying type name (`struct __timezone_t*`) rather than the
typedef name (`timezone_t`) that's used in calling code.

I've moved us over to FreeBSD's wcsftime() rather than keep the OpenBSD
one building --- I've long wanted to only have one implementation here,
and FreeBSD is already doing the "convert back and forth, calling the
non-wide function in the middle" dance that I'd hoped to get round to
doing myself someday. This should mean that our strftime() and
wcsftime() behaviors can't easily diverge in future, plus macOS/iOS are
mostly FreeBSD, so any bugs will likely be interoperable with the other
major mobile operating system, so there's something nice for everyone
there!

The FreeBSD wcsftime() implementation includes a wcsftime_l()
implementation, so that's one stub we can remove. The flip side of that
is that it uses mbsrtowcs_l() and wcsrtombs_l() which we didn't
previously have. So expose those as aliases of mbsrtowcs() and
wcsrtombs().

Bug: https://github.com/chronotope/chrono/issues/499
Test: treehugger
Change-Id: Iee1b9d763ead15eef3d2c33666b3403b68940c3c
2023-06-16 08:10:47 -07:00
Treehugger Robot
f4f99abf79 Merge "Nullability check for socket module." am: 0181dd9f05 am: 3960b11233 am: f0ff731e8b
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2605708

Change-Id: I1b8806d993cb0f3585cc605e857aeadb8ddb0b6a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-16 05:04:24 +00:00
zijunzhao
4e274fa0a9 Nullability check for socket module.
Bugs: b/245972273
Test: adb shell
Change-Id: Id0f1aa156ff010358f2484b2f58aa3beacc1409c
2023-06-15 23:51:02 +00:00
Treehugger Robot
374c55909b Merge "Nullability check for wctype module." am: 5c6961ff6d am: 957f7a1203 am: 4cb0d63209
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2626775

Change-Id: Ife44b81f3e504fdcc408144f0fbde8f6473a9786
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-15 03:57:48 +00:00
Treehugger Robot
e84c18791b Merge "<iconv.h>: clarify the docs a bit more." am: 42e7ac10ed am: 5e6c6e6e0f am: 1174fd0360
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2627204

Change-Id: Idcbc21c9f5cfc58f96e15fbf2e780b0798242367
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-15 01:41:52 +00:00
Elliott Hughes
318e4187a9 Merge "<arpa/nameser.h>: don't use __INTRODUCED_IN_64 in a defined(__LP64__) block." am: db14a74701 am: 4653bfa75e am: 305154ecae
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2621717

Change-Id: Ic0122a33993c02608ea789157a66805d9b6c5189
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-15 01:41:31 +00:00
Treehugger Robot
5c6961ff6d Merge "Nullability check for wctype module." 2023-06-15 00:29:25 +00:00
Steven Moreland
94e2325940 fdsan android::Parcel
Parcel manages ownership of FDs from the binder kernel
in a complicated way. Since sizeof(Parcel) is frozen
in the ABI right now, and we can't allocate more things
on the heap in Parcel, we need to keep on managing
FD ownership manually there.

Ignore-AOSP-First: this requires some fixes only in
  git_master to avoid crashing

Bug: 287093457
Test: boot
Change-Id: I4976507727899f1bb09de41e97f329bee58a4572
2023-06-14 23:36:24 +00:00
Treehugger Robot
42e7ac10ed Merge "<iconv.h>: clarify the docs a bit more." 2023-06-14 23:16:06 +00:00