Commit graph

2333 commits

Author SHA1 Message Date
Prashanth Swaminathan
7b873fb033 Merge "string/memory functions: avoid qemu bugs/performance issues." into main am: c20bf013a1 am: 453fbd0e9a am: 7c32826486
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2806377

Change-Id: I110797573c0c309313815c0e2144c786d1b0fd13
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-17 19:18:42 +00:00
Elliott Hughes
e7b35c0dc4 Merge "libc_init_static.cpp: drop gold support." into main am: 63dce74ca0 am: b620ed5206 am: 7e7d42a8ce
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2836070

Change-Id: Ie8642466c77ed05b82e9d0dfc56b5cfb9f9d129e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-17 18:26:20 +00:00
Prashanth Swaminathan
c20bf013a1 Merge "string/memory functions: avoid qemu bugs/performance issues." into main 2023-11-17 17:47:20 +00:00
Elliott Hughes
d65368e7d7 libc_init_static.cpp: drop gold support.
The NDK no longer includes gold, so static binaries built by the NDK no
longer need to support gold.

Test: bionic static unit tests
Change-Id: Idddcb9eb18921acfc1ae2a3c755592a5ab30290a
2023-11-16 17:31:09 -08:00
Elliott Hughes
aefe999d92 string/memory functions: avoid qemu bugs/performance issues.
Use V on real hardware, but GC on qemu.

Change-Id: I419546d94555540e14a14dcc52bd99413cbbcfa1
2023-11-15 15:49:57 -08:00
Christopher Ferris
abe2b20309 Merge "Stop fp unwinding if the pc is 0." into main am: 0b27d314d6 am: 94df76e5ed am: e013c439b8
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2813433

Change-Id: Iaef76f9c61b7a645343ed407747ca2edef72565c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-01 21:32:30 +00:00
Christopher Ferris
0b27d314d6 Merge "Stop fp unwinding if the pc is 0." into main 2023-11-01 19:50:33 +00:00
Christopher Ferris
cfcb7b6c83 Stop fp unwinding if the pc is 0.
The android_unsafe_frame_pointer_chase keeps going even when a
frame is 0. Modify the unwind to stop when this case is found.

I found this while running the GwpAsanCrasherTest.run_gwp_asan_test
from debuggerd_test and printing the tombstone created. The
deallocated by and allocated by stack traces always ended in 0 frame.

After fixing this, the last 0 frame is no longer present.

Test: Ran the debuggerd test and printed the tombstone on a raven
Test: verifying that the last frame is non-zero.
Test: Ran the bionic unit tests.
Change-Id: I8d64679277abcf5f237e6759051db11ffaa34c2f
2023-10-31 14:14:28 -07: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
Christopher Ferris
44dfd3ebab Merge "Add android_mallopt M_GET_DECAY_TIME_ENABLED." into main am: 35aaed9e1b am: be90376e0c am: 41f64cc03d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2810911

Change-Id: Ib46ad5bb6ed2dbd74462544ffe940f348bf24586
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-31 03:56:04 +00:00
Treehugger Robot
0207a6a186 Merge changes from topic "appcompat_override" into main
* changes:
  Move __system_properties_reload to LIBC from LIBC_PLATFORM
  Write appcompat_override system properties
2023-10-31 02:29:57 +00:00
Christopher Ferris
b4e560ed7c Add android_mallopt M_GET_DECAY_TIME_ENABLED.
The bionic benchmarks set the decay time in various ways, but
don't necessarily restore it properly. Add a new method for
getting the current decay time and then a way to restore it.

Right now the assumption is that the decay time defaults to zero,
but in the near future that assumption might be incorrect. Therefore
using this method will future proof the code.

Bug: 302212507

Test: Unit tests pass for both static and dynamic executables.
Test: Ran bionic benchmarks that were modified.
Change-Id: Ia77ff9ffee3081c5c1c02cb4309880f33b284e82
2023-10-30 15:30:16 -07: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
19d8167626 Merge "Write appcompat_override system properties" into main 2023-10-19 19:29:59 +00: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
Mitch Phillips
25ab1c2abf Merge "Use DYNAMIC entries for MTE enablement" into main am: 363e743200 am: 3b3a96de07 am: 059d2db070
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2765590

Change-Id: I307efae2207df52c9dffdfb920fa9df075d5c695
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-18 12:31:48 +00:00
Mitch Phillips
363e743200 Merge "Use DYNAMIC entries for MTE enablement" into main 2023-10-18 10:17:37 +00:00
Mitch Phillips
7c1f3770af Use DYNAMIC entries for MTE enablement
Adds support for the dynamic entries to specify MTE enablement. This is
now the preferred way for dynamically linked executables to specify to
the loader what mode MTE should be in, and whether stack MTE should be
enabled. In future, this is also needed for MTE globals support.

Leave the existing ELF note parsing as a backup option because dynamic
entries are not supported for fully static executables, and there's
still a bunch of glue sitting around in the build system and tests that
explicitly include the note. When -fsanitize=memtag* is specified, lld
will create the note implicitly (along with the new dynamic entries),
but at some point once we've cleaned up all the old references to the
note, we can remove the notegen from lld.

Bug: N/A
Test: atest bionic-unit-tests CtsBionicTestCases --test-filter=*Memtag*
Test: Build/boot the device under _fullmte.

Change-Id: I954b7e78afa5ff4274a3948b968cfad8eba94d88
2023-10-17 13:49:24 +02:00
Elliott Hughes
32c281cbb8 Merge "Clarify the fcntl() "that's not how F_SETFD works" error." into main am: b4e2219987 am: dfb9662b24 am: 4f1282b9bf am: 98c1a703b7 am: a4427fa9ab
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2780900

Change-Id: I7bc9c9f3e374731e0fdcf7b0815e09ff011a67b5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 20:35:45 +00:00
Elliott Hughes
25af17c587 Clarify the fcntl() "that's not how F_SETFD works" error.
The first app developer (we know of) that hit this didn't understand
what it was trying to tell them.

Before:
    FORTIFY: fcntl(F_SETFD) passed non-FD_CLOEXEC flag: 0x801

After:
    FORTIFY: fcntl(F_SETFD) only supports FD_CLOEXEC but was passed 0x801

Bug: https://issuetracker.google.com/304348746
Test: treehugger
Change-Id: I8522e851d8f74c91152ebae68b083b5272d49255
2023-10-12 16:04:14 +00:00
Elliott Hughes
f1ce4648a9 Merge "Remove <ctype.h> cruft." into main am: 389a40a0a8 am: a468e56569 am: bc717f9b8d am: 4ca2aabbff am: ac7ef66045
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2455758

Change-Id: If05fcc6343f23138f026fe0759948ca3f6fae967
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-07 00:59:27 +00:00
Elliott Hughes
389a40a0a8 Merge "Remove <ctype.h> cruft." into main 2023-10-06 19:49:26 +00:00
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
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
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
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
Yabin Cui
ac668cc137 Merge "Let executables not rely on sentinels in preinit_array/init_array/fini_array" into main am: 4d3903eab9 am: 7ea5e44c24 am: 0774e1ef51 am: 745305bb5c am: afefe1c2c2
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2725997

Change-Id: I423ecb4bf9822058ceb7f2ae215c3b3f693ee7a2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-01 21:32:03 +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
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
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
Xin Li
5439bde949 Merge "Merge Android U (ab/10368041)" into aosp-main-future 2023-08-28 22:13:38 +00:00
Elliott Hughes
7dae3812d7 Merge "sysconf(): implement cache queries." into main am: a71a15fe34 am: 3996bbe901 am: a9ca959498 am: 3e268603ec am: 6a12624063
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2721536

Change-Id: I115e6e6175972cf111078edad7ed67ed8de76df3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-28 17:54:43 +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
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
Kalesh Singh
ac516c4239 Merge "bionic: libc_init_static: Use page_size()" into main am: 8cd1ddcbf0 am: 5c7512474e am: 9ac016c5df am: 542dc8ea3f am: f4fa351c9c
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719578

Change-Id: I33f2ad296febef576d344601004c4d99ba249caa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-23 03:27:00 +00:00
Kalesh Singh
8cd1ddcbf0 Merge "bionic: libc_init_static: Use page_size()" into main 2023-08-23 00:16:26 +00:00
Juan Yescas
9e24def386 Merge "bionic: Use max_page_size() instead of PAGE_SIZE" into main am: ac587f827c am: c48775c9fa am: 94f8520923 am: 83395bc0c3 am: 31a450554d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2719394

Change-Id: I41be7b98903fd23e2ae3c9f5763c4cbf2e95b90e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 18:09:37 +00:00
Elliott Hughes
8c4e1adab2 Merge "riscv64: fix ifuncs, improve the ifunc tests." into main am: d53ad05e38 am: c512636d31 am: 96591865e3 am: b889ba04ca am: 28765348af
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2695693

Change-Id: I4010768df4e17016fa731f8ba7451f752464177f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-08-22 18:08:30 +00:00