Commit graph

40400 commits

Author SHA1 Message Date
Elliott Hughes
8bf9a609ca Merge "Use a class for system properties filenames." into main am: 6f6df7376e am: bcfaa004a4
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2734834

Change-Id: I2fae7a6e340f08f5619c5a051a2416e44e655beb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-05 23:30:49 +00:00
Elliott Hughes
96a6c6abc1 Merge "Add epoll_pwait2()." into main am: 906d7d41e4 am: 484056aaf2
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2656904

Change-Id: I047cea95ca2b28b781e71fdaf1613ac0abd7cdf4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-05 23:30:32 +00:00
Elliott Hughes
bcfaa004a4 Merge "Use a class for system properties filenames." into main am: 6f6df7376e
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2734834

Change-Id: I7dbafaa711937b741a00e14c7e576139c57efffa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-05 23:27:10 +00:00
Elliott Hughes
6f6df7376e Merge "Use a class for system properties filenames." into main 2023-09-05 23:04:42 +00:00
Elliott Hughes
484056aaf2 Merge "Add epoll_pwait2()." into main am: 906d7d41e4
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2656904

Change-Id: I62a2f1f487678f18a602d07771a10d0fa538dfed
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-05 22:42:07 +00:00
Elliott Hughes
906d7d41e4 Merge "Add epoll_pwait2()." into main 2023-09-05 21:48:08 +00:00
Xin Li
93740a0203 [automerger skipped] Merge "Merge UP1A.230905.019" into aosp-main-future am: c9eddbb41b -s ours
am skip reason: Merged-In If7e9e5f99728c2f3a18b08346b4cf3449132f920 with SHA-1 d1076eb728 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/24623919

Change-Id: Ife12b5806b8f59db3fe577ae7e33118bbefc824d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-05 19:46:07 +00:00
Xin Li
2c96d3beb3 [automerger skipped] Merge UP1A.230905.019 am: b7f9ac421e -s ours
am skip reason: Merged-In If7e9e5f99728c2f3a18b08346b4cf3449132f920 with SHA-1 d1076eb728 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/24623919

Change-Id: I039aa0df1a73465b5ebf19ac692908383dc04bdf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-05 19:45:13 +00:00
Xin Li
c9eddbb41b Merge "Merge UP1A.230905.019" into aosp-main-future 2023-09-05 18:36:14 +00:00
Elliott Hughes
d19f7b1cba Use a class for system properties filenames.
This avoids copy & pasting the "did we overflow the string?" logic
everywhere.

Test: treehugger
Change-Id: Icbeb2fdb050a33efc08e1bbb7e9c1e46e48319fa
2023-09-05 18:28:55 +00:00
Yabin Cui
0774e1ef51 Merge "Let executables not rely on sentinels in preinit_array/init_array/fini_array" into main am: 4d3903eab9 am: 7ea5e44c24
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2725997

Change-Id: Idcfe610a1a10dafdc5b999834dfa2ec4e72785e6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-01 19:01:34 +00:00
Yabin Cui
7ea5e44c24 Merge "Let executables not rely on sentinels in preinit_array/init_array/fini_array" into main am: 4d3903eab9
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2725997

Change-Id: Ia86ca98c161ebdc6d631ccbdd1ea416298879858
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-01 18:08:55 +00:00
Yabin Cui
4d3903eab9 Merge "Let executables not rely on sentinels in preinit_array/init_array/fini_array" into main 2023-09-01 17:19:26 +00:00
Yabin Cui
744cfd3720 Let executables not rely on sentinels in preinit_array/init_array/fini_array
Currently, we use sentinels (starting with -1 and ending with 0) in
preinit_array/init_array/fini_array in executables. But after using LTO,
the sentinels can be reordered by LLD and no longer work. So make below
changes to not rely on them:
  1. In crtbegin.c, use symbols (like __init_array_start) inserted by the
     linker.
  2. Add array_count fields in structors_array_t.
  3. In static libc, use array_count fields to decide array lengths.
  4. To make new dynamic executables work with old libc.so, create a fake
     fini_array with sentinels, and pass it to __libc_init. The fake
     fini_array contains a function to call functions in real fini_array.
  5. To make old dynamic executables work with new libc.so, libc.so
     still uses sentinels to decide the length of fini_array.

Bug: 295944813
Bug: https://github.com/android/ndk/issues/1461
Test: run bionic-unit-tests-static
Test: test static executables manually
Test: boot cf_gwear_x86-trunk_staging-userdebug
Change-Id: I1ce31f07bcfe0e99b4237984898a8fc9e98ff426
2023-09-01 10:17:05 -07:00
Xin Li
b7f9ac421e Merge UP1A.230905.019
Merged-In: If7e9e5f99728c2f3a18b08346b4cf3449132f920
Change-Id: I0eb839e528b7349828d9d5f9aadb22ebf6b172a7
2023-08-31 12:07:28 -07: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
4de14c7499 Merge "__riscv_hwprobe: don't try to set errno." into main 2023-08-30 14:53:29 +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
b130e6dae0 Merge "<termios.h>: add two new POSIX functions." into main 2023-08-29 21:48:37 +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
Xin Li
ca5817fae3 [automerger skipped] Merge "Merge Android U (ab/10368041)" into aosp-main-future am: 5439bde949 -s ours
am skip reason: Merged-In I89679e7152f197f9d0961eee352189bc7d1d1c50 with SHA-1 75f70e7d15 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/24182325

Change-Id: I21731c510d0180f02969daa153f5efd5ab1594c6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-29 00:03:50 +00:00
Xin Li
b8dee64524 [automerger skipped] Merge Android U (ab/10368041) am: 661155efcb -s ours
am skip reason: Merged-In I89679e7152f197f9d0961eee352189bc7d1d1c50 with SHA-1 75f70e7d15 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/bionic/+/24182325

Change-Id: Idbaa4b7c9b230ba313b6a097c9e5b0891436a262
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-28 23:59:03 +00:00
Xin Li
5439bde949 Merge "Merge Android U (ab/10368041)" into aosp-main-future 2023-08-28 22:13:38 +00:00
Kalesh Singh
d5c5aaa9ad Merge "bionic: CFIShadow: Remove use of PAGE_SIZE macro." into main am: 97a0587f20 am: fcf5ee6e76
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2717359

Change-Id: Iadb56131b16ce9423f3227593c7d2b3985eac0c8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-28 21:31:50 +00:00
Kalesh Singh
fcf5ee6e76 Merge "bionic: CFIShadow: Remove use of PAGE_SIZE macro." into main am: 97a0587f20
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2717359

Change-Id: I3d25584b705b3b37cbce844af4a17f5bfaf1b8a3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-28 20:47:13 +00:00
Kalesh Singh
97a0587f20 Merge "bionic: CFIShadow: Remove use of PAGE_SIZE macro." into main 2023-08-28 20:04:57 +00:00
Kalesh Singh
47f06117f3 Merge "bionic: libdl_cfi: Remove PAGE_SIZE usage" into main am: de83440636 am: 256e2a786a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2727078

Change-Id: I8e93227fc44a0b52195dfb55b5e95697490e9fd2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-28 18:38:54 +00:00
Kalesh Singh
256e2a786a Merge "bionic: libdl_cfi: Remove PAGE_SIZE usage" into main am: de83440636
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2727078

Change-Id: I1f5bcab12da4efbb7fd3cab2b53a457cc683cbb8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-28 17:54:03 +00:00
Kalesh Singh
de83440636 Merge "bionic: libdl_cfi: Remove PAGE_SIZE usage" into main 2023-08-28 17:13:01 +00:00
Elliott Hughes
a9ca959498 Merge "sysconf(): implement cache queries." into main am: a71a15fe34 am: 3996bbe901
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721536

Change-Id: I42a469ff24cd418c0825a33b1345ebafd3dda04f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-28 15:50:33 +00:00
Elliott Hughes
3996bbe901 Merge "sysconf(): implement cache queries." into main am: a71a15fe34
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721536

Change-Id: Ied0b13efd8a25f1b185226d3ff430d93b4fac31a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-28 15:05:59 +00:00
Elliott Hughes
a71a15fe34 Merge "sysconf(): implement cache queries." into main 2023-08-28 14:48:20 +00:00
Elliott Hughes
02df7388f1 sysconf(): implement cache queries.
This is a bit disappointing. I'd not implemented this in the past
because it wasn't available on all platforms, and -- although the
riscv64 implementation was just a cool optimization -- I thought that
the /sys stuff was actually portable, until I ran it on arm64 hardware.
So here we have getauxval() for riscv64, /sys for x86-64, and our best
guess based on ctr_el0 for arm64.

Bug: http://b/294034962
Test: ran tests on the host, an arm64 device, and riscv64 host and qemu
Change-Id: I420b69b976d30668d4d2ac548c4229e2a4eafb20
2023-08-28 14:48:12 +00:00
Kalesh Singh
461c64db9e bionic: libdl_cfi: Remove PAGE_SIZE usage
Use max_page_size() for build time variable alignments instead
of PAGE_SIZE.

In the 4k targets there is no functional difference since
max_page_size() == page_size() == 4096.

On a 16kb device max_page_size() == 65536 and page_size() == 16384.
However, aligning up does not incur any memory regressions
since the .bss/.data sections are still be backed in PAGE_SIZE'ed
chunks. See: go/16k-page-aligned-variables

Bug: 296275298
Test: mma
Change-Id: Ic944235d8a5742a51a8fb0f2a0b75e532f404110
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-08-24 23:36:33 -07:00
Elliott Hughes
925b5f482f Merge "Add %b/%B to async-safe logging." into main am: bf4d3a95c1 am: 5abfd88813
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721534

Change-Id: I089499ab936e4b46603b0364e9188ad94121458d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-24 16:07:56 +00:00
Elliott Hughes
5abfd88813 Merge "Add %b/%B to async-safe logging." into main am: bf4d3a95c1
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721534

Change-Id: I2c8f318874f9c2fc674041a10d36f7082f9a5d43
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-24 15:26:08 +00:00
Elliott Hughes
bf4d3a95c1 Merge "Add %b/%B to async-safe logging." into main 2023-08-24 14:34:45 +00: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
Elliott Hughes
f5b4e3ce58 Add %b/%B to async-safe logging.
Missed this when we added the new C23 binary output to the printf()
family.

Also fix %X to use "0X" instead of "0x" and add missing tests.

Test: used by new LD_SHOW_AUXV functionality
Change-Id: I6623b92acec7daf534536697de0f87352a2653ad
2023-08-23 14:08:40 -07:00
Kalesh Singh
00f5906754 bionic: CFIShadow: Remove use of PAGE_SIZE macro.
The alignment of kShadowSize to a page sized multiple is
not explicitly needed, since mmap() will return a page-sized
multiple mapping.

kCfiCheckAlign remains 4k as this is chosen by the clang
compiler. [1] [2]

[1] 3568976375/clang/lib/CodeGen/CGExpr.cpp (L3433)

[2] https://clang.llvm.org/docs/ControlFlowIntegrityDesign.html#cfi-shadow

Bug: 296275298
Test: Boot 16kb device, check no cfi failures.
Test: atest -c bionic-unit-tests
Change-Id: Iac0c129c413afe01389f529f5c64051c4ffff2df
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-08-23 13:59:57 -07:00
Treehugger Robot
2f031ba684 Merge "linker: add LD_SHOW_AUXV support." into main am: 0398f8ab3a am: c08ab40d9c
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721918

Change-Id: Id362805712b98eb446de69e521720965a24b7084
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 16:05:05 +00:00
Treehugger Robot
c08ab40d9c Merge "linker: add LD_SHOW_AUXV support." into main am: 0398f8ab3a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721918

Change-Id: I68dd793cd66d062986c4750a1ae097b9d2e8a335
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 15:24:33 +00:00
Treehugger Robot
0398f8ab3a Merge "linker: add LD_SHOW_AUXV support." into main 2023-08-23 14:46:29 +00:00
Juan Yescas
81fffa2108 Merge "bionic: Set PTHREAD_STACK_MIN for page agnostic targets" into main am: fe690875d5 am: 6ffba3ea18
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719582

Change-Id: I5fdf2faf162c8398b80749fc1e8c39a5a8ddb138
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 04:06:32 +00:00
Juan Yescas
6ffba3ea18 Merge "bionic: Set PTHREAD_STACK_MIN for page agnostic targets" into main am: fe690875d5
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719582

Change-Id: Ia6a079dc076482a42756b69b962984aba9f7a173
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 03:26:18 +00:00
Juan Yescas
fe690875d5 Merge "bionic: Set PTHREAD_STACK_MIN for page agnostic targets" into main 2023-08-23 02:44:58 +00:00