Commit graph

11998 commits

Author SHA1 Message Date
Elliott Hughes
d6c3a078bc Update <android/api-level.h>.
Change-Id: Id1522fdaf3041dcd3f296a716e8a2a1936c389e8
2024-05-16 18:31:47 +00:00
Treehugger Robot
03a4448dcf Merge "[MTE] cleanup: factor out BIONIC_MEMTAG_UPGRADE_SECS handling" into main 2024-05-15 19:40:01 +00:00
Florian Mayer
f3326581c0 [MTE] cleanup: factor out BIONIC_MEMTAG_UPGRADE_SECS handling
This makes __libc_init_mte easier to read.

Change-Id: I2826f62e53895093d1631d4e6c7e3ff844cf9def
2024-05-15 16:39:36 +00:00
Dan Albert
2237fcf1fa Revert "Use inline keyword without underscores consistently"
This reverts commit 58f06e1112.

Bare `inline` is not ANSI C compatible, and NDK users may be using
that.

Test: treehugger
Change-Id: I82c5424522142001cd59da63ef3fd440014451ad
2024-05-14 17:55:54 +00:00
Treehugger Robot
d06e2e7b29 Merge "Rename GWP-ASan android_mallopt() arguments" into main 2024-05-09 17:29:34 +00:00
Jiyong Park
3aa32e2c81 Merge "Export capability.h as a filegroup" into main 2024-05-07 02:17:26 +00:00
Florian Mayer
d29fcf6e37 Merge "[MTE] update ring buffer when enabling stack trace collection" into main 2024-05-07 00:41:10 +00:00
Florian Mayer
c6d1e23b3f [MTE] update ring buffer when enabling stack trace collection
A change in scudo changed to lazy allocation of the ring buffer,
so we need to update the globals once we enable stack trace collection

Bug: 339020123
Test: sanitizer test app
Change-Id: Ideda7b761e75052d09df27de1f6b04aeb9a03dc2
2024-05-06 14:46:32 -07:00
Christopher Ferris
5fa285da96 Merge "Change malloc_not_svelte to malloc_low_memory." into main 2024-05-06 19:45:06 +00:00
Mitch Phillips
ebc2ac934f Rename GWP-ASan android_mallopt() arguments
The previous names were difficult to decipher. Now, let's change this
all to be more clear as it's actually one android_mallopt() call
depending on where it's called from, rather than the intended behaviour.

Also updated the comments so it's clear what happened across different
versions of Android.

Test: atest bionic-unit-tests CtsGwpAsanTestCases
Bug: N/a
Change-Id: I0582cab0b74aa09f4af54f9fbe5ba22697f82082
2024-05-03 13:20:45 +02:00
Jiyong Park
35a280d818 Export capability.h as a filegroup
... so that it can be used by fs_config_[dirs|files] genrules.
Previously, the fs_config_* were created by Android.mk and capability.h
was referenced directly from there. Since Soong doesn't allow that,
let's export the file explicitly.

Bug: 337993745
Test: m
Change-Id: I2777a4dbe6b977bc64c5f6defe748fa7993e578e
2024-05-03 16:53:39 +09:00
Treehugger Robot
a97a4754a3 Merge "Add deprecation message for __sF." into main 2024-05-02 22:19:13 +00:00
Treehugger Robot
000745aa37 Merge "Allow deprecation messages." into main 2024-05-02 21:53:15 +00:00
Dan Albert
cc86c74362 Add deprecation message for __sF.
Bug: None
Test: treehugger
Change-Id: I9dd9e77ad024c2ea292f021bb2709378f755c1d8
2024-05-02 20:05:29 +00:00
Dan Albert
398e1aa030 Allow deprecation messages.
I'll land another patch that makes this required once I've fixed up
all the callers.

Bug: https://github.com/android/ndk/issues/2014
Test: treehugger
Change-Id: I62b9fdd3174f37d33f01c27f7f4e9134f6d9df6e
2024-05-02 20:05:28 +00:00
Elliott Hughes
622b6aeeef __system_property_add: log specifics about failures.
Failure to add a property should be rare, so log the specific
failure to aid in debugging.

Bug: http://b/322714325
Change-Id: I9461428f16d7d04d5aceb910a5cf1c928cfe9da2
2024-05-01 23:46:45 +00:00
Christopher Ferris
b54250572d Change malloc_not_svelte to malloc_low_memory.
The malloc_not_svelte product variable has been removed and is
replaced by malloc_low_memory. This switches the sense of the

Test: Verified scudo config is used by default.
Test: Verified Android GO config uses the jemalloc low memory config.
Test: Verified that the default config on oriole produces the exact same
Test: libc.so with and without this change.
Change-Id: I48085fa6c2dcf5c61f847ef1f15c38653d1f7214
2024-05-01 15:33:45 -07:00
Florian Mayer
05c16e7f54 Make "remapping stacks as PROT_MTE" debug log
This was spamming logcat

Change-Id: I3255b583d594a91faae8680aaef94d793c3c26a9
2024-04-30 18:13:14 +00:00
Elliott Hughes
81c54c72b3 Upstream sync.
Also clean up some obsolete cruft from openbsd-compat.h...

Test: treehugger
Change-Id: I9eae0f8304e701d032045617427289002d234cd8
2024-04-29 23:41:39 +00:00
Treehugger Robot
cdbc7c75f5 Merge "[scudo] -1 is also valid for M_DECAY_TIME" into main 2024-04-29 20:07:46 +00:00
Chia-hung Duan
6abb406e0a [scudo] -1 is also valid for M_DECAY_TIME
Test: Run tests
Change-Id: I044ef84bf0ec97c0f8cb8d3a2340b82218d85efc
2024-04-26 15:24:24 -07:00
Treehugger Robot
9c7892202f Merge "Only try to initialize appcompat properties if the folder is present" into main 2024-04-24 22:35:37 +00:00
Elliott Hughes
5063d26249 Merge "Always use __foo__ for attribute names." into main 2024-04-23 00:12:32 +00:00
Treehugger Robot
ae038dcdea Merge "Replace commented-out deprecated attribute with doc comment." into main 2024-04-22 22:34:41 +00:00
Elliott Hughes
a933582f3e __system_property_set: add string names for init's error codes.
https://issuetracker.google.com/336223505 is not the first
hard-to-read bug here.

Change-Id: I520aeb2cb87423f8db394bf4709d659e3eb3a309
2024-04-22 22:18:06 +00:00
Elliott Hughes
9b9371bd0e Replace commented-out deprecated attribute with doc comment.
This attribute had been commented out since it was first
committed a decade ago. No-one's going to chase down arm32-only
trivia like that before arm32 and x86 are removed as obsolete...

Change-Id: I8e29d16657b3f4ce379e65732d747f969ea31dae
2024-04-22 20:17:22 +00:00
Elliott Hughes
a1b5ca2fe0 Always use __foo__ for attribute names.
To avoid collisions with other macros.

Change-Id: I015639043deaceccaf5f11365f8bdc45ca703da5
2024-04-22 20:10:53 +00:00
Nate Myren
9437444cf5 Only try to initialize appcompat properties if the folder is present
If the Init process doesn't write the appcompat system properties
folder, do not attempt to initialize it

Bug: 331307495
Test: manual
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:d071e949a6153e76eb7c67e5947d4d387a8afe2d)
Merged-In: I21716ea87e55a63a1b79127887c451d0fcf006f3
Change-Id: I21716ea87e55a63a1b79127887c451d0fcf006f3
2024-04-19 19:07:34 +00:00
Elliott Hughes
7d3c6cd25c Document pthread_key_create(3), pthread_key_delete(3), and PTHREAD_KEYS_MAX.
In particular "how to work around the PTHREAD_KEYS_MAX limit".

Change-Id: I330936d598ddddfa0903f0505fd00f8fcbf02543
2024-04-18 22:02:38 +00:00
Christopher Ferris
785e161dd8 Merge "Update to v6.8 kernel headers." into main 2024-04-18 16:35:43 +00:00
Nick Desaulniers
ceed466d60 libc: remove __size_mul_overflow
We should just be able to use __builtin_umull_overflow now, which expects
unsigned long parameters. We don't need __builtin_umul_overflow (which expects
unsigned ints) because Bionic is LP64 or ILP32, so for ILP32
sizeof(size_t) == sizeof(unsigned long),
so __builtin_umull_overflow will work for either ILP32 or LP64.

Test: mm
Change-Id: I872491731bca05e561767f8bfeda4c6704e10ccb
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2024-04-17 14:54:57 -07:00
Nick Desaulniers
0be8f184c2 Merge "Use inline keyword without underscores consistently" into main 2024-04-17 21:19:27 +00:00
Treehugger Robot
0b1161d9b5 Merge "Clean up __always_inline" into main 2024-04-17 20:19:14 +00:00
Nick Desaulniers
58f06e1112 Use inline keyword without underscores consistently
s/__inline__/inline
s/__inline/inline

Change-Id: I5d8d930a7a41d678a0795e7a608dacbb9eb8cb37
2024-04-17 10:51:09 -07:00
Nick Desaulniers
c574f79afa Clean up __always_inline
While studying the implementation of POSIX pthread_rwlock* functions, I noticed
that two functions were marked __always_inline twice. "They must really mean it
this time."

Also add back `inline` keyword to one other usage of __always_inline to be
consistent with other uses of __always_inline throughout the codebase.

Change-Id: Ibf9eaed5fc9fd03afcdd969cff82dec71a8ce30f
2024-04-17 10:50:41 -07:00
Florian Mayer
7d098bbee7 Fix incorrect links
Change-Id: Iee24c6b2e1a63d01359dadd5af7499fa3b4abaa5
2024-04-16 21:12:40 +00:00
Christopher Ferris
b830ddf90e Update to v6.8 kernel headers.
Kernel headers coming from:

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

Test: Builds and bionic unit tests pass on raven.
Test: Able to log in to an Android GO 32 bit device.
Change-Id: I0022cdb20c19726f526acaab2866f1e25794b77e
2024-04-16 09:49:56 -07:00
Elliott Hughes
12773b6eca Merge "Simplify Oryon ifunc resolvers." into main 2024-04-16 15:06:14 +00:00
Elliott Hughes
f978a85cc3 Simplify Oryon ifunc resolvers.
Mainly just factoring out the code, but there are two functional
changes here too:

1. The inline assembler was missing `volatile`, making the hwcap
check ineffective (because the compiler would sometimes move the
MIDR_EL1 read above the hwcap check).

2. The previous code accepted variants 0x0 to 0x5 while the comment
said 0x1 to 0x5. The comment was correct.

I resisted the temptation to actually have a table to search on the assumption that it'll be a while before we need such a thing.

Bug: https://issuetracker.google.com/330105715
Change-Id: I9fdc1e70e49b26ef32794b55ca5e5fd37f1163f9
2024-04-16 15:05:55 +00:00
Treehugger Robot
e7f4506bcb Merge "Add LINE_MAX." into main 2024-04-15 23:20:22 +00:00
Steven Moreland
117478dd4e Merge "Prefer __BIONIC_DEPRECATED_PAGE_SIZE_MACRO" into main 2024-04-10 20:57:45 +00:00
Mitch Phillips
4435aff516 Merge "[GWP-ASan] Use recoverable everywhere" into main 2024-04-10 09:30:58 +00:00
Treehugger Robot
3db97c73a2 Merge "Add NGROUPS." into main 2024-04-09 19:33:36 +00:00
Elliott Hughes
e5bd239ba1 Add NGROUPS.
Historical code still uses this, and people work around its absence
locally. All of iOS/macOS and musl/glibc have this.

Change-Id: I119834f535b346275be5fa1df3c323eee9e242cc
2024-04-09 16:48:18 +00:00
Elliott Hughes
f666d822bd <sys/shm.h>: fix a hard-coded 4096 page size.
Change-Id: I932b1ea44ab6a54a2e4d2bcd1577c6f5859f583a
2024-04-09 16:40:27 +00:00
Steven Moreland
a69e5af7ee Prefer __BIONIC_DEPRECATED_PAGE_SIZE_MACRO
Platform and future NDK releases will have no PAGE_SIZE by default,
unless __BIONIC_DEPRECATED_PAGE_SIZE_MACRO is specified.

This ensures that when people use these headers with non-standard build
systems, they will still become aware of the changes.

Bug: 312546062
Test: build/boot
Change-Id: I29f5de2cd5d59d3cefdd45a6da1ccdd7c12f1f19
2024-04-09 16:35:15 +00:00
Elliott Hughes
b266f6522f Add LINE_MAX.
LINE_MAX is a bad idea from the 1970s that we've ignored until now,
but there's already one hack in the AOSP tree (external/ltp) to work
around its absence, and kselftests would need another. Both uses are
bad code, but bad code exists, and iOS/macOS and musl/glibc all have
the same 2048 value, and it is in POSIX, so at least it's consistent
idiocy. Hopefully we're not encouraging more of it!

Bug: https://github.com/llvm/llvm-project/issues/88119
Change-Id: Ief219c3fe20b3d95da7040c4b9411f997b1c0470
2024-04-09 15:41:10 +00:00
Mitch Phillips
aa8c229e7d [GWP-ASan] Use recoverable everywhere
Use recoverable mode for system processes and system apps as well.
Given we're a sampled bug detector anyway, why not let these processes
continue. This might save some user experience if something ends up
crashing that requires a SysUI reboot (like system_server). And, hey,
starting up processes is expensive.

Bug: N/A
Test: atest CtsGwpAsanTestCases
Change-Id: Ia6be4fcf3b3ed55a3089587d060aba7ab318cf97
2024-04-09 12:35:31 +02:00
Elliott Hughes
252ed5704a Merge "riscv64: use L() in the handful of places we didn't already." into main 2024-04-08 21:30:36 +00:00
Elliott Hughes
6937761c52 arm64: use L() in the handful of places we didn't already.
Change-Id: Ieb3cc5c9623291421c1d2fdc204e27812fee8ffd
2024-04-08 16:38:41 +00:00