Commit graph

823 commits

Author SHA1 Message Date
Elliott Hughes
c608e57893 Merge "Use the canonical idiom for sockaddr_storage." into main am: bb261225e0 am: 3f5aaa8812 am: 4b694b6969
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2852650

Change-Id: I70804a869978bd6f27482530af7446a2cc57b33b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-08 16:28:27 +00:00
Elliott Hughes
bb261225e0 Merge "Use the canonical idiom for sockaddr_storage." into main 2023-12-08 14:43:32 +00:00
Elliott Hughes
2cbd262cf1 Merge "riscv64: pass a pointer to __riscv_hwprobe() to ifunc resolvers." into main am: 75539ab928 am: 978c235f51 am: 53adad316c
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2860689

Change-Id: I86a97139f856341ab257b5092b72e00abf2b0bed
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-06 20:27:53 +00:00
Elliott Hughes
561e804ffb riscv64: pass a pointer to __riscv_hwprobe() to ifunc resolvers.
This way, callees don't need to worry about whether or not their
reference to __riscv_hwprobe() has been resolved before their ifunc
resolver is called.

This matches the current glibc proposal from rivos.

Test: treehugger
Change-Id: I0d5244aa837d0d1f0e6bd7d22091dfedb8a55bdb
2023-12-05 16:31:59 -08:00
Elliott Hughes
5850f6f3be Use the canonical idiom for sockaddr_storage.
This works out a bit silly/ugly because the bits/ header file has the
wrong name, so I've also changed the map from kernel struct to boolean
to be a map from kernel struct to filename. That not only fixes this,
it's a bit more readable too. (Just yesterday, when I had no real reason
to change it, I was asking myself "why is this a boolean?"!)

Bug: http://b/236042740
Test: treehugger
Change-Id: I3eee25b493ea97d46cc5dc5fde07f7c5e77d2a46
2023-12-05 23:13:01 +00:00
Treehugger Robot
21ec4adb23 Merge "Move ; in NDK declaration" into main am: c6034e4228 am: ec6677350c am: 15c9f8f608
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2830814

Change-Id: I5bcfbb42ea39d291bbc47b52f4b1852d8547dffb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15 02:11:04 +00:00
Nate Myren
4b94522c14 Move ; in NDK declaration
per comment on aosp/2796861, it should be at the end of the line

Bug: 291814949
Test: presubmit
Change-Id: Ib104d6764791b7a2507e371d955cbd8e69e3ccdc
2023-11-14 15:28:57 -08:00
Treehugger Robot
d78dfdb75a Merge changes from topic "appcompat_override" into main am: 0207a6a186 am: 9460fe5a83 am: 3fd59cb6af
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2796861

Change-Id: I1c6d5b67876e69650e721e465533ee897983efc4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-31 03:56:37 +00:00
Nate Myren
0ab0615f8c Move __system_properties_reload to LIBC from LIBC_PLATFORM
The zygote cannot have visiblity to LIBC_PLATFORM methods. Therefore,
move __system_properties_reload to LIBC, and rename it
__system_properties_zygote_reload, and indicate in comments that it
should not be used by non-zygote apps

Bug: 291814949
Test: atest CtsBionicRootTestCases
Change-Id: Iee8fa0c76b740543c05a433393f2f4bef36d6d3d
2023-10-25 17:41:33 -07:00
Nate Myren
b8c87b14b0 Write appcompat_override system properties
Create a second set of system properties, that can be overlaid over the
real ones if necessary, for appcompat purposes.

Bug: 291814949
Ignore-AOSP-First: Aosp -> internal merge conflict
Test: manual, treehugger, system_properties_test

Change-Id: I541d3658cab7753c16970957c6ab4fc8bd68d8f3
Merged-In: I884a78b67679c1f0b90a6c0159b17ab007f8cc60
2023-10-19 13:35:57 -07:00
Nate Myren
ae7f33dd57 Write appcompat_override system properties
Create a second set of system properties, that can be overlaid over the
real ones if necessary, for appcompat purposes.

Bug: 291814949
Ignore-AOSP-First: Aosp -> internal merge conflict
Test: manual, treehugger, system_properties_test

Change-Id: I884a78b67679c1f0b90a6c0159b17ab007f8cc60
2023-10-18 17:28:42 -07: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
Elliott Hughes
9c06d16ca3 s/master/main/
Test: treehugger
Change-Id: I2c975b2f5f92f23c7357b6f7e785578504298cc6
2023-10-04 23:36:48 +00: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
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
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
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
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
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
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
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
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
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
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
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
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
Elliott Hughes
fee0b45480 Merge "Remove the always-true __INTRODUCED_IN() annotations." 2023-06-20 20:47:49 +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
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
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
0e98fea67e Merge "Remove __RENAME_STAT64." am: 26add4eae0 am: 84670b50f9 am: 837692bb92
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2617897

Change-Id: Ib97060a8fcb64dcb8ec5e7d10d25923b2999d2a1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-10 03:29:09 +00:00
Elliott Hughes
f242ef6f98 Remove __RENAME_STAT64.
Now API level 21 is our lowest supported API level, __RENAME_STAT64 is
useless.

Test: treehugger
Change-Id: I708b2142b30dfcf6c74e1a14475da690a8c25f59
2023-06-09 15:59:23 -07:00