Commit graph

12113 commits

Author SHA1 Message Date
Elliott Hughes
82b033271d Move the ILP32 mremap() hackery into legacy_32_bit_support.cpp.
Similar to mmap(), this confuses me every time I look at it. Move it out
of the way, and make it clearer that this is just junk that can be
deleted when we remove 32-bit support.

Also improve coverage by adding a test for the varargs special case.

Ignore-AOSP-First: work around the lack of an ABI 35 dump in AOSP
Test: treehugger
Change-Id: Ia375c29d18e31e646b795e643534f0be07d382b9
2024-06-11 21:51:53 +00:00
Elliott Hughes
ce84cf0bd8 Merge "Add a missing riscv64 psabi constant." into main am: 5eb5f26e92
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3125793

Change-Id: Ib19bab7892cd1ccb5a222d26d2a7eebfb5415cc5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-11 19:23:17 +00:00
Elliott Hughes
5eb5f26e92 Merge "Add a missing riscv64 psabi constant." into main 2024-06-11 19:04:36 +00:00
Florian Mayer
68790593e3 Merge "[HWASan] [16k] do not instrument getauxval" into main am: eff0fada9d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3124273

Change-Id: I2641ac83e44c7ce0499bb4b6cf2d8d58b214b2a3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-11 15:57:21 +00:00
Florian Mayer
eff0fada9d Merge "[HWASan] [16k] do not instrument getauxval" into main 2024-06-11 15:16:52 +00:00
Elliott Hughes
c221beccc1 Add a missing riscv64 psabi constant.
Also group all the RELR/arm64/riscv64 bits together rather than mixing them up slightly as we'd done so far.

Change-Id: Iff1ea2cfca9ff702b88aa2e7d09db46e2f34f965
2024-06-11 12:59:38 +00:00
Florian Mayer
d8328a931b [HWASan] [16k] do not instrument getauxval
To support page agnostic systems, we call getauxval before HWASan is
fully set up.

Bug: 315511637
Change-Id: I0b760943a23bd3a4d83bcc2182696a827dcbd446
2024-06-10 17:35:25 -07:00
Treehugger Robot
8be62724a0 Merge "[riscv][bionic] Prototype TLS Descriptor support" into main am: 7619ddbc4e
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2940588

Change-Id: Iec6b5a1b5d5302adc2452643a3adcb685f0784ad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-10 12:13:50 +00:00
Treehugger Robot
7619ddbc4e Merge "[riscv][bionic] Prototype TLS Descriptor support" into main 2024-06-10 11:45:26 +00:00
Paul Kirth
4d4377881d [riscv][bionic] Prototype TLS Descriptor support
Add basic assembly stubs for TLS Descriptor support in the dynamic
linker, and enable several code paths related to TLSDESC for RISC-V.

Note: This patch requires an updated toolchain that supports TLSDESC
for RISC-V, and the `-mtls-dialect=` compiler option specifically.

Test: adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_filter=*tls*
Bug: 322984914
Change-Id: I74bd0fa216b44b4ca2c5a5a6aec37b3fc47b00d9
2024-06-07 14:30:22 -07:00
Elliott Hughes
0031c5a935 Merge "Move the ILP32 mmap() hackery into legacy_32_bit_support.cpp." into main am: cbc07d4d31
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3118911

Change-Id: I9a5922f1dd6fb6dd84352568799d8aec9d2e4837
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-07 10:55:52 +00:00
Elliott Hughes
4358d53cd9 Move the ILP32 mmap() hackery into legacy_32_bit_support.cpp.
Every time I look at mmap.cpp, I fail to realize it's only built for ILP32.

Also improve some of the commentary in SYSCALLS.TXT and legacy_32_bit_support.cpp.

Change-Id: Ieedfe800b437e30c060c3e8663b6d96d517dbf6f
2024-06-06 21:08:17 +00:00
Elliott Hughes
e6c408d79f Merge "new.cpp: add sized operator delete." into main am: 3e8dd2b88c
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3115108

Change-Id: Iccd1fbfb0b80dcc4babfa8b47c799f387a42b2d6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-05 17:57:03 +00:00
Elliott Hughes
3e8dd2b88c Merge "new.cpp: add sized operator delete." into main 2024-06-05 17:37:10 +00:00
Elliott Hughes
7104dd9d55 Merge "<malloc.h>: warn on unused results for malloc_usable_size()." into main am: 988c807ff8
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3113839

Change-Id: I00b69a96b5376847a255dbcedd59654936bab006
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-05 16:08:44 +00:00
Elliott Hughes
988c807ff8 Merge "<malloc.h>: warn on unused results for malloc_usable_size()." into main 2024-06-05 15:48:45 +00:00
Elliott Hughes
ad44152c38 new.cpp: add sized operator delete.
clang-19 and later default to C++14 sized deallocation. Currently we don't have C23's C equivalent of free_sized(), so we just implement these in terms of free() for now.

Bug: http://b/344993254
Change-Id: I708710aee3f7a684bfe494a96f7baed014acbe57
2024-06-05 12:26:56 +00:00
Christopher Ferris
02f33c7090 Merge "Update to v6.9 kernel headers." into main am: b9279b62c2
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3111723

Change-Id: Iff882dc72e0044d04ef7d9b9a19ef995425b0b9b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-04 18:44:07 +00:00
Elliott Hughes
c87d87ca60 Merge "<stdio.h>: warn on some unused results." into main am: 5b57093ecc
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3110539

Change-Id: I4c15330dc742672b8ab675496543e5899c8f6e61
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-04 18:43:51 +00:00
Christopher Ferris
b9279b62c2 Merge "Update to v6.9 kernel headers." into main 2024-06-04 18:22:22 +00:00
Elliott Hughes
5b57093ecc Merge "<stdio.h>: warn on some unused results." into main 2024-06-04 18:20:48 +00:00
Elliott Hughes
69ddb74135 <malloc.h>: warn on unused results for malloc_usable_size().
Not a security problem, but definitely a bug if you're calling this and ignoring the result, since it has no side-effects.

(All of the more important functions -- realloc() especially -- are already annotated.)

Change-Id: I217463518b4716befcc0ed9426648eafbfbbdde4
2024-06-04 15:32:45 +00:00
Elliott Hughes
862d6713e2 Merge "<unistd.h>: explain why getpagesize() is better than getauxval() as well as sysconf()." into main am: be241d1d6b
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3112242

Change-Id: Ic5e61455b5b2157b647a77c6bb7581ba2a1ba2d1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-04 11:20:18 +00:00
Elliott Hughes
be241d1d6b Merge "<unistd.h>: explain why getpagesize() is better than getauxval() as well as sysconf()." into main 2024-06-04 11:03:05 +00:00
Christopher Ferris
7f4c837186 Update to v6.9 kernel headers.
Kernel headers coming from:

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

Test: Builds and bionic unit tests pass on raven.
Test: Able to log in to an Android GO 32 bit device.
Change-Id: If53a38bbb65c3c653ce790fe5c6e51597901a14e
2024-06-03 14:22:19 -07:00
Elliott Hughes
7e6ca0d6b5 Merge "getpagesize(): remove "portability" claim." into main am: a84f9cffcf
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3112480

Change-Id: I3dc4c2fdf157f765ce264c031bda11d5ab9734e4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-03 20:33:08 +00:00
Elliott Hughes
4e63125ce1 getpagesize(): remove "portability" claim.
This is just POSIX nonsense. Android, iOS/macOS, the BSDs, and glibc all have getpagesize(). Window doesn't, but Windows doesn't have sysconf(3) either, so there's not a strong "portability" argument to be had there!

Change-Id: Ieacfbb61c3612045f27c20c3fa4fa12694db2243
2024-06-03 19:21:46 +00:00
Elliott Hughes
b631ec7409 <unistd.h>: explain why getpagesize() is better than getauxval() as well as sysconf().
I thought we'd already done this, but apparently not.

Bug: http://b/315511637
Change-Id: I0581438a6f551be9750b6679a9f3ad06c83f1e9b
2024-06-03 19:19:22 +00:00
Elliott Hughes
78706d25d0 <stdio.h>: warn on some unused results.
This is fairly conservative, touching only those functions (such as feof()) where it's clearly an error to not use the return value.

Also fix a test that was ignoring the return value of feof() (because it was just checking whether the function could take the lock, and genuinely didn't care about the result).

Change-Id: If2ade10ae87df45a8b9bfcb24828e460201fa9a1
2024-05-31 22:55:22 +00:00
Elliott Hughes
74e8e58109 Merge "Warn about unused results with bsearch()." into main am: b851c4c5bf
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3108440

Change-Id: I792804d3ae115d65187f7240a8c847c4b3b5cc7e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-31 20:27:27 +00:00
Elliott Hughes
d4c54b4448 Warn about unused results with bsearch().
This function has no side-effects, and the return value is the whole point.

Change-Id: Ibb9143c6a3c4089bfd6402c1c580ef76ce0f5d27
2024-05-31 17:33:33 +00:00
Elliott Hughes
7379926162 Merge "pthread_exit(): reduce duplication." into main am: aec1f25248
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3103458

Change-Id: I548a372bfa6d4043c1dd17f7d3b409be3114ec72
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-30 19:48:43 +00:00
Elliott Hughes
aec1f25248 Merge "pthread_exit(): reduce duplication." into main 2024-05-30 19:47:04 +00:00
Elliott Hughes
c62d1255f9 Merge "Spell "calling convention" out in full." into main am: a1e51dc4b8
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3107937

Change-Id: I24c02ce5102f0662aa5f1f9242b492927f889b7b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-30 12:29:43 +00:00
Elliott Hughes
a1e51dc4b8 Merge "Spell "calling convention" out in full." into main 2024-05-30 12:26:07 +00:00
Elliott Hughes
5e7b7f0056 Merge "bionic_allocator: more detailed and consistent error reporting." into main am: 793ce9c90a
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3107217

Change-Id: I7af459d9572b2a493ed665729552204df26d7208
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-30 11:59:18 +00:00
Elliott Hughes
cee6832eb3 Merge "Fix some wcwidth() special cases." into main am: f4a27aee8d
Original change: https://android-review.googlesource.com/c/platform/bionic/+/2983497

Change-Id: I0d71b38128f2bd43a6ab1da35c348c74c4f0fdf7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-30 11:59:03 +00:00
Elliott Hughes
793ce9c90a Merge "bionic_allocator: more detailed and consistent error reporting." into main 2024-05-30 11:41:59 +00:00
Elliott Hughes
f4a27aee8d Merge "Fix some wcwidth() special cases." into main 2024-05-30 11:41:24 +00:00
Elliott Hughes
8f653f8ad9 bionic_allocator: more detailed and consistent error reporting.
I only came to improve the signature mismatch error, but I was then annoyed by the copy & paste of the other checks.

get_chunk_size() seems to be deliberately avoiding any checks, though I think that might be a bug, and there should be a get_chunk_size() that _does_ check for most callers, and a get_chunk_size_unchecked() for the <sys/thread_properties.h> stuff that seems to want to only be "best effort" (but does still have _some_ possibility of aborting, in addition to the possibility of segfaulting).

Also a bit of "include what you use" after cider complained about all the unused includes in bionic_allocator.h.

Bug: https://issuetracker.google.com/341850283
Change-Id: I278b495601353733af516a2d60ed10feb9cef36b
2024-05-29 22:25:37 +00:00
Elliott Hughes
20a9f99b3b Fix some wcwidth() special cases.
Detailed explanation in the code comments.

Test: treehugger
Change-Id: I2aef2510724c1c622b83e226b51d4c8429b88272
2024-05-29 21:45:51 +00:00
Elliott Hughes
13090d0bbf Spell "calling convention" out in full.
We only use this in one other place anyway.

Also be explicit about how `__tls_get_addr` and `___tls_get_addr` differ, since I missed that at first!

Change-Id: Ica214886c5346f118f063bca26e6dd8d74ee21f4
2024-05-29 12:34:18 +00:00
Treehugger Robot
00ee4c556b Merge "<sys/thread_properties.h>: remove stray semicolon in the implementation." into main am: 1395fa865f
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3103457

Change-Id: I93338d0e279c99e91da9f19ac38e5e7f48c22d75
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-29 12:25:59 +00:00
Treehugger Robot
1395fa865f Merge "<sys/thread_properties.h>: remove stray semicolon in the implementation." into main 2024-05-29 12:02:00 +00:00
Elliott Hughes
3c7274d386 Merge "Fix gettid() in functions that call fork() or equivalent." into main am: 7147a477c1
Original change: https://android-review.googlesource.com/c/platform/bionic/+/3106497

Change-Id: I9ef6fa58a96e6f21078fe8623753e0af4fdb73cf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-29 11:41:04 +00:00
Elliott Hughes
c8ea872a2f Fix gettid() in functions that call fork() or equivalent.
Bug: https://github.com/android/ndk/issues/2024
Change-Id: Ia264ce219fac99e8823e60c4a2e0607af8518056
2024-05-28 15:23:52 +00:00
Elliott Hughes
118d5da898 pthread_exit(): reduce duplication.
Strictly, this is more of "swap one form of duplication for another", but
I found the existing code non-obvious in part because people have added new
code under existing comments (which don't apply), in two places. At this
point, duplicating the _condition_ (which is much less likely to change at
all, let alone grow more complex) clarifies the code and makes the comments
match the code they're adjacent to again.

Test: treehugger
Change-Id: Ic8f01dc5b4fd14e942bf8dd7c72cab7df06d99d5
2024-05-24 14:47:40 -04:00
Elliott Hughes
87589723cc <sys/thread_properties.h>: remove stray semicolon in the implementation.
Test: treehugger
Change-Id: I5f9d9d5b45ca74de2eb837c881582a6a87fdf0f6
2024-05-24 14:46:45 -04:00
Xin Li
431ecbca72 Merge Android 24Q2 Release (ab/11526283) to aosp-main-future
Bug: 337098550
Merged-In: Ibe2ffda9155246f2217aaa0e7d589ed7effec311
Change-Id: Ia5fa139b867a2043201c2253a7ccbff9607b8a83
2024-05-23 14:10:02 -07:00
Steven Moreland
5dd8ce7284 Merge "bionic: max_android_page_size to 16384" into main 2024-05-22 21:41:54 +00:00