Commit graph

42761 commits

Author SHA1 Message Date
Elliott Hughes
ecaa192929 Add a README.md to docs/, as a guide to what we have available.
I was actually here to add some new documentation, but realized there wasn't really a good place to put it...

Change-Id: I8a2fc93e61a89e87aa53dd0beb9dfcc6561687ca
2024-06-04 18:20:05 +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
Elliott Hughes
1bebfd3c10 Merge "setjmp_test: riscv64 does have callee-save fp registers." into main 2024-06-03 20:30:33 +00:00
Elliott Hughes
a84f9cffcf Merge "getpagesize(): remove "portability" claim." into main 2024-06-03 20:27:00 +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
86968d95f1 setjmp_test: riscv64 does have callee-save fp registers.
The setjmp implementation is correct, but this comment was wrong, and we were missing the implementation of the test. This would be slightly simpler if we enabled Zfa in the build system and qemu, but this works for now.

Change-Id: Iad32771019584beacd8b35138ac2bf4c0a14c903
2024-06-03 18:38:10 +00:00
Elliott Hughes
b851c4c5bf Merge "Warn about unused results with bsearch()." into main 2024-05-31 20:17:57 +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
3cd51b749d Merge "fdtrack: make it clearer that there's more information available." into main 2024-05-30 19:47:07 +00:00
Elliott Hughes
aec1f25248 Merge "pthread_exit(): reduce duplication." into main 2024-05-30 19:47:04 +00:00
Elliott Hughes
e56350c4ad fdtrack: make it clearer that there's more information available.
A lot of people who see these via pitot or whatever don't even think to look at the real tombstone. Make it explicit that this is what they should do next. Also, since we have the numbers, say exactly what we mean by "most common".

Bug: http://b/338882189
Change-Id: Ia21848a40e82cb2486538a7578501e2ec0948e1c
2024-05-30 17:26:25 +00:00
Elliott Hughes
a1e51dc4b8 Merge "Spell "calling convention" out in full." into main 2024-05-30 12:26:07 +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
f6486e0e71 Merge "Remove unused Android.mk under bionic" into main 2024-05-29 12:26:38 +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
7147a477c1 Merge "Fix gettid() in functions that call fork() or equivalent." into main 2024-05-29 11:23:06 +00:00
kellyhung
0aaab1b66f Remove unused Android.mk under bionic
Bug: b/311284462
Test: CIs
Change-Id: I2586c425616ef59dbf2ba88fe1cbaa75a3bc2d5c
2024-05-29 14:50:18 +08:00
Treehugger Robot
cdaaa0a6bb Merge "Revert^2 "Convert Android.mk under bionic to Android.bp"" into main 2024-05-29 03:25:37 +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
Kelly Hung
9fb1a6cdbd Revert^2 "Convert Android.mk under bionic to Android.bp"
This reverts commit 1e32ad88ff.

Reason for revert: 1. aosp/3099017 merged. 2. verified in ABDT run
https://android-build.corp.google.com/abtd/run/L00400030004085752/

Change-Id: I6f07c67ab84ea93406dee88a5d20d0674a2d2a79
2024-05-24 13:56:08 +00:00
Ryan Prichard
d475ee45aa Merge "Revert^2 "Switch the loader to a noexcept version of libc++"" into main 2024-05-22 23:59:04 +00:00
Steven Moreland
5dd8ce7284 Merge "bionic: max_android_page_size to 16384" into main 2024-05-22 21:41:54 +00:00
Christopher Ferris
dc82bd1aae Merge "Read maps data before using and do safe reads." into main 2024-05-22 20:46:34 +00:00
Steven Moreland
8401230be6 bionic: max_android_page_size to 16384
The maximum page size Android supports
now is 16384, and Art only supports 16kB,
so we can save a bit of space.

Bug: 332556665
Test: N/A
Change-Id: I23df607bcc5cf9e96d7b6a66169413cd1a883f7e
2024-05-22 18:29:04 +00:00
Elliott Hughes
7c22b4c372 Merge "Don't leak a thread when timer_create() fails." into main 2024-05-22 11:40:39 +00:00
Satish Yalla
b5c54ac8b6 Merge "Revert "Convert Android.mk under bionic to Android.bp"" into main 2024-05-22 01:46:05 +00:00
Christopher Ferris
65e349d6c8 Read maps data before using and do safe reads.
Rather than only updating the maps when a pc can't be found, always update
the maps before using them. This avoids issues where the maps change
and it could cause a crash reading from a map that has been modified.

This assumes that executed code never gets unloaded, or that the
code is unloaded so infrequently that it doesn't matter. This happens
because the pcs for the backtraces are gathered as the program runs
and those pcs are symbolized and made into relative pcs at a later time.

Also, add safe reading of the elf data when necessary to avoid any
crashes if maps are changing while this is running.

Since the MapEntry objects can be deleted, copy the values for
the current map in the backtrace code to detect when in our own code
instead of keeping a pointer.

Bug: 340988785

Test: malloc_debug unit/system tests pass.
Test: libmemunreachable tests pass.
Change-Id: Ica2ba50a5bcf9e19c7e4033e29a5a67a1847d1a6
2024-05-21 17:41:22 -07:00
Priyanka Advani
1e32ad88ff Revert "Convert Android.mk under bionic to Android.bp"
This reverts commit 12b2042a3f.

Reason for revert: Droidmonitor triggered revert due to build breakage in b/342029467. Will be verifying through ABTD before submission.

Change-Id: I801b4999047732b86985f0be2f4aae90b9998e4a
2024-05-22 00:34:12 +00:00
Treehugger Robot
d9864c21eb Merge "Convert Android.mk under bionic to Android.bp" into main 2024-05-22 00:07:46 +00:00
Elliott Hughes
c793bc00f5 Don't leak a thread when timer_create() fails.
We do the same thing in pthread_create().

This has the nice side-effect of letting us move part of the child setup that we were doing in the parent into the child where it belongs.

Bug: https://issuetracker.google.com/340125671
Change-Id: Ibe646d5ca9066f487d08fd40f004550349e8a02e
2024-05-21 21:35:49 +00:00
Elliott Hughes
b7e98953b0 Merge "execinfo.cpp: Add a __riscv case." into main 2024-05-21 21:07:04 +00:00
Elliott Hughes
021cd6d2ca Merge "linker benchmark: our riscv64 toolchain has lga now." into main 2024-05-21 17:45:21 +00:00
Elliott Hughes
c2a4e89139 linker benchmark: our riscv64 toolchain has lga now.
This doesn't make any difference, but it does let us delete an obsolete comment.

Change-Id: Ibf81978bb7883e8c6b86c1f6c459ff70bca3f682
2024-05-21 15:37:39 +00:00
Elliott Hughes
ccc4dbf135 execinfo.cpp: Add a __riscv case.
This makes this TraceFunction() more like trace_function() in malloc_debug. I'll leave whether we can collapse these into one implementation as an open question for now...

Change-Id: I3981e4114244d49f8dbae1d3b776a7e9c32be688
2024-05-21 15:11:15 +00:00
Elliott Hughes
a13b3b32e0 Merge "Tidy and document the inline/__inline/__inline__ situation." into main 2024-05-21 11:49:20 +00:00
Elliott Hughes
e852abd1fc Merge "utils.h: quote regex match failure messages." into main 2024-05-20 18:21:27 +00:00
Elliott Hughes
0b29ce212a Merge "Add riscv64 implementation of __get_bionic_tcb_for_thread()." into main 2024-05-20 13:26:22 +00:00
Elliott Hughes
abbec338f9 utils.h: quote regex match failure messages.
This still won't be easy to read, but it should at least be "less bad".

Change-Id: I14ecf06ffcc54a4bb48003e8cba3b731d8a0073d
2024-05-20 13:12:09 +00:00
kellyhung
12b2042a3f Convert Android.mk under bionic to Android.bp
Bug: b/311284462
Test: m bionic-compile-time-tests1-clang++; m bionic-compile-time-tests2-clang++

Change-Id: I538dda9f56f0c85bf3779cc55f721a7e1c1fcc5a
2024-05-20 01:13:54 +08:00
Elliott Hughes
09c660bf75 Add riscv64 implementation of __get_bionic_tcb_for_thread().
Bug: http://b/339287219
Change-Id: I2b6f2603cd34e1575d575565c369663bfcdf9be1
2024-05-17 17:18:57 +00:00
Treehugger Robot
e78370e5f8 Merge "linker: update non-PIE error message." into main 2024-05-17 13:51:17 +00:00
Elliott Hughes
71abb3dcf4 linker: update non-PIE error message.
Also remove the commentary, which isn't really relevant in 2024.

Change-Id: I9d17159daddc6717a2255d956c9a90820fe4d17a
2024-05-17 12:16:16 +00:00
Elliott Hughes
bab8f345a6 Merge "linker: remove useless comments." into main 2024-05-17 12:13:04 +00:00