Commit graph

40554 commits

Author SHA1 Message Date
Kalesh Singh
76866e9305 Merge "bionic: tests: Remove PAGE_SIZE usage" into main am: a05918bd83
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2798272

Change-Id: Id4681d0cf436b27d8ddfeb10e271ead933af3e25
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-20 02:23:08 +00:00
Kalesh Singh
a05918bd83 Merge "bionic: tests: Remove PAGE_SIZE usage" into main 2023-10-20 01:03:27 +00:00
Kalesh Singh
41c8951c91 bionic: tests: Remove PAGE_SIZE usage
Instead of the hardcoded PAGE_SIZE 4096 macro, use the
real system page-size as queried from the auxillary vector.

Bug: 277272383
Bug: 300367402
Test: atest -c bionic-unit-tests
Change-Id: I2f1ad1b431e36ef45e9f53f713ced6b06e0d4f70
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
2023-10-19 15:49:50 -07:00
Elliott Hughes
f0485d1425 Merge "Use the R_RISCV_TLSDESC constant in the linker." into main am: 777756d21d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2796852

Change-Id: I14aa26af20a8bd6fa0a5368959cf2c17858091a4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-19 18:49:19 +00:00
Elliott Hughes
777756d21d Merge "Use the R_RISCV_TLSDESC constant in the linker." into main 2023-10-19 18:03:22 +00:00
Treehugger Robot
b282ac9488 Merge "Clarify one of the "missing" FreeBSD ELF constants." into main am: b8021fbe21
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2796853

Change-Id: Ia9f778d6b368e4c4c43be4a3564339efda16a0f4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-19 00:16:34 +00:00
Treehugger Robot
b8021fbe21 Merge "Clarify one of the "missing" FreeBSD ELF constants." into main 2023-10-18 23:41:36 +00:00
Elliott Hughes
dcfd870fac Clarify one of the "missing" FreeBSD ELF constants.
Test: treehugger
Change-Id: I7173ac704e6537a4e99a976baec46aa22df751bd
2023-10-18 14:47:12 -07:00
Elliott Hughes
c6c3e8614f Use the R_RISCV_TLSDESC constant in the linker.
Bug: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/94
Test: treehugger
Change-Id: I1580686c8381be7dfdb5d7684934a176e0d11d77
2023-10-18 14:12:31 -07:00
Mitch Phillips
47b5af1df0 Merge "Use DYNAMIC entries for MTE enablement" into main am: 363e743200
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2765590

Change-Id: Idac3c2c5b02ea2b44e2bd7c9aff9193e0a401c07
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-18 11:05:54 +00:00
Mitch Phillips
363e743200 Merge "Use DYNAMIC entries for MTE enablement" into main 2023-10-18 10:17:37 +00:00
Edward Liaw
889a7863bf Merge "Add test for replacing macro arguments" into main am: f2f99ec626
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2794634

Change-Id: Ia210cf9a5a8adabb4e32a38f4225082e5111745f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-17 21:55:18 +00:00
Edward Liaw
f2f99ec626 Merge "Add test for replacing macro arguments" into main 2023-10-17 21:29:41 +00:00
Edward Liaw
5cbab1165a Merge "Replace macro arguments when applying replaceTokens" into main am: 2f993a51bd
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2792161

Change-Id: Iadbf0e544cf72ba0c40f5b303e6f39f624c1af39
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-17 20:32:37 +00:00
Edward Liaw
d903a736fb Add test for replacing macro arguments
Add test for aosp/2792161

Bug: 297317502
Test: cpp.py
Change-Id: I2eadd3b9371ec2f8b8c24107888cad5e3ae26f60
Signed-off-by: Edward Liaw <edliaw@google.com>
2023-10-17 20:09:42 +00:00
Edward Liaw
2f993a51bd Merge "Replace macro arguments when applying replaceTokens" into main 2023-10-17 19:59:02 +00:00
Edward Liaw
c291c39137 Replace macro arguments when applying replaceTokens
replaceTokens was only replacing tokens for cpp name clashes in the
macro body.  This change will also replace tokens in the arguments.

Bug: 297317502
Test: bionic/libc/kernel/tools/update_all.py
Change-Id: I102d000a8a4cea507b00c867df2a16106d8aed89
Signed-off-by: Edward Liaw <edliaw@google.com>
2023-10-17 17:42:40 +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
289b4ef5f9 Merge "Keep ioprio_value; <linux/ioprio.h> relies on this." into main am: 8fbdc58733 am: 211b6433db
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2787554

Change-Id: I0b2ed6fc60255813654b2450f721a0968c29a60d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-13 16:47:57 +00:00
Elliott Hughes
211b6433db Merge "Keep ioprio_value; <linux/ioprio.h> relies on this." into main am: 8fbdc58733
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2787554

Change-Id: Id07009d852a271f09a105604052e8b1a70df797c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-13 16:12:32 +00:00
Elliott Hughes
8fbdc58733 Merge "Keep ioprio_value; <linux/ioprio.h> relies on this." into main 2023-10-13 15:50:18 +00:00
Elliott Hughes
b10c99d077 Keep ioprio_value; <linux/ioprio.h> relies on this.
We were keeping the macros that call this function, but not the function
itself. That's not helpful.

Bug: http://b/297317502
Test: treehugger
Change-Id: Icf8f734a129fe73ec740bb7cfbb11deb01a98cb3
2023-10-13 00:11:01 +00:00
Elliott Hughes
4f1282b9bf Merge "Clarify the fcntl() "that's not how F_SETFD works" error." into main am: b4e2219987 am: dfb9662b24
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2780900

Change-Id: I7c2edb29fc544acabfb09bcd2ad5bed4dcb012f8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 18:56:27 +00:00
Elliott Hughes
dfb9662b24 Merge "Clarify the fcntl() "that's not how F_SETFD works" error." into main am: b4e2219987
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2780900

Change-Id: I24088e1c91afc29509177e7d6c44ce913e2eaa9b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-12 18:23:14 +00:00
Elliott Hughes
b4e2219987 Merge "Clarify the fcntl() "that's not how F_SETFD works" error." into main 2023-10-12 17:51:20 +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
450f7694b4 Merge "Add tests for stdio functions not setting the error indicator." into main am: 713dfe3e16 am: 5c2de859ce
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2779321

Change-Id: I1b9c3ef45598697da65bb710313e619d42385676
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-11 18:18:09 +00:00
Elliott Hughes
5c2de859ce Merge "Add tests for stdio functions not setting the error indicator." into main am: 713dfe3e16
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2779321

Change-Id: I4f39b8ce918bb75e1515d0252f53b326d59be2c5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-11 17:48:39 +00:00
Elliott Hughes
713dfe3e16 Merge "Add tests for stdio functions not setting the error indicator." into main 2023-10-11 16:20:47 +00:00
Elliott Hughes
728bd30de8 Merge "Sync upstream OpenBSD stdio." into main am: 1bcebdae38 am: 865d80a22f
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2779341

Change-Id: I328c9789302462b2f8a15c1468a35ecb821c2929
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 22:07:47 +00:00
Elliott Hughes
865d80a22f Merge "Sync upstream OpenBSD stdio." into main am: 1bcebdae38
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2779341

Change-Id: Ie4228be69762cd999863c2311d64a798d9ef7692
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 21:20:07 +00:00
Elliott Hughes
1bcebdae38 Merge "Sync upstream OpenBSD stdio." into main 2023-10-10 20:29:05 +00:00
Treehugger Robot
aba9b2107d Merge "<ctype.h>: stop using _ctype_." into main am: e253761e14 am: 01de1a47fa
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2779335

Change-Id: Ia5f94cc1b42a178e4cedcffce130726652bc3b45
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-10 00:15:05 +00:00
Elliott Hughes
307ff340db Sync upstream OpenBSD stdio.
"""
__swsetup: set error flag and errno on error.

Previously, we set errno to EBADF if the cantwrite() macro (which calls
__swsetup()) returns true for POSIX compliance.  However, we neglected
to also set the error flag, __SERR.  Rather than set the error flag in
all callers of cantwrite(), set both errno and the error flag in
__swsetup().  This matches what FreeBSD does and makes it possible
to choose a proper errno value for the second error condition in
__swsetup().  OK deraadt@
"""
fc99cf9338

Bug: http://b/302742247
Test: treehugger
Change-Id: If3be4905fc21e513cb8718cca671eae3885e411a
2023-10-09 16:53:31 -07:00
Elliott Hughes
76a3ad4e44 Add tests for stdio functions not setting the error indicator.
From https://reviews.llvm.org/D150044#4597254.

Bug: http://b/302742247
Test: treehugger
Change-Id: I001e7a995aabef37bdcdb53791c4af36c77d7b57
2023-10-09 16:50:55 -07:00
Treehugger Robot
01de1a47fa Merge "<ctype.h>: stop using _ctype_." into main am: e253761e14
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2779335

Change-Id: I99943226277d1f4e4d17d1ad6dd0927c9f237337
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-09 23:40:50 +00:00
Treehugger Robot
e253761e14 Merge "<ctype.h>: stop using _ctype_." into main 2023-10-09 22:54:25 +00:00
Elliott Hughes
69270ed6b9 <ctype.h>: stop using _ctype_.
The code comment that's being removed here defends the old
implementation by claiming that it's faster. Annoyingly, we don't know
what hardware that was run on. Running on current-ish hardware
(cheetah), I can't really tell the difference except: (a) for hwasan,
avoiding the unsafe memory access by _not_ using the array is a huge
win, and (b) even for arm32 the logic is (very slightly) faster than the
array lookup.

So let's get rid of the unsafety (as musl and FreeBSD have already done)
and the large hwasan slowdown (10ns vs 2ns). It's possible in-order
cores might still care, but it's 2023 and it's time to move on.

This change _does not_ remove `_ctype_` and associated macros from the
headers, though we might want to come back and do that. Historically
libc++ used these implementation details directly, but that's no longer
the case, and it seems unlikely that anyone else is, and today's results
suggest they probably shouldn't anyway, and doing so only ever really
made sense for something like ISO-Latin-1 anyway. Most ASCII tests are
_always_ better off inlined, and Android's never supported non-ASCII for
<ctype.h> anyway (use the isw*() functions if you want that, but bear in
mind that if you're actually dealing with human languages, you probably
want icu4c rather than libc anyway).

Test: treehugger & benchmarks
Change-Id: Ifac25c23ac33e996a3c726317b5c6e602dc72e30
2023-10-09 13:53:03 -07:00
Elliott Hughes
aaaedf31d0 Merge "Remove unreliable CFI test." into main am: f89da9b996 am: 5d32b3be4a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2778127

Change-Id: I4b0464feb57fd8cdabb2472d44666c9236496d3c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-09 18:24:27 +00:00
Elliott Hughes
5d32b3be4a Merge "Remove unreliable CFI test." into main am: f89da9b996
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2778127

Change-Id: Iabf46428a4b65a6baebc27dc17e46e610557f258
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-09 16:59:38 +00:00
Elliott Hughes
f89da9b996 Merge "Remove unreliable CFI test." into main 2023-10-09 16:19:07 +00:00
Elliott Hughes
b2f2fc8184 Remove unreliable CFI test.
Remove tests of implementation details rather than the CFI
functionality itself. In particular, CFI is designed to protect against
invalid calls to executable code, whereas heap memory is covered by page
protection.

Bug: http://b/298741930
Test: treehugger
Change-Id: Ib7f8af283b4c0001da8fa80a1b281bdc4c50af51
2023-10-06 16:58:12 -07:00
Elliott Hughes
bc717f9b8d Merge "Remove <ctype.h> cruft." into main am: 389a40a0a8 am: a468e56569
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2455758

Change-Id: I652e4558540e2c43f7ba383885352f8fd4c7dc50
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-06 21:12:28 +00:00
Elliott Hughes
a468e56569 Merge "Remove <ctype.h> cruft." into main am: 389a40a0a8
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2455758

Change-Id: I9a07f1dccb516c448522b39168551251bd65faca
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-06 20:35:04 +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
Spandan Das
24b37f48b0 Merge "Delete cc_api_* bionic bazel targets" into main am: 17b35ecfd0 am: 5e8ea220d9
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2776977

Change-Id: I2c5e77ba767c3b292edd5e00b46544cea5885fef
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-06 03:42:47 +00:00
Spandan Das
5e8ea220d9 Merge "Delete cc_api_* bionic bazel targets" into main am: 17b35ecfd0
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2776977

Change-Id: I2e55c3cb364fb492615a487d433ddc9724464ee9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-06 03:10:42 +00:00
Spandan Das
17b35ecfd0 Merge "Delete cc_api_* bionic bazel targets" into main 2023-10-06 02:39:54 +00:00
Treehugger Robot
1da887ea0a Merge "Remove unused declarations." into main am: 488887c8ea am: 0194ba475f
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2775906

Change-Id: Ib8eeb98dcb12ed305352b599f7b32b6454f7ebb3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-06 00:48:13 +00:00