Commit graph

35521 commits

Author SHA1 Message Date
Elliott Hughes
cf59e19e22 Add preadv2/pwritev2 wrappers.
They're in glibc, though not in musl.

Also add basic doc comments to the whole of <sys/uio.h>.

Bug: http://b/203002492
Test: treehugger
Change-Id: Ic607f7f349e5b7c9bf66c25b7bd68f827da530d6
2021-10-18 12:58:47 -07:00
Liz Kammer
ad60768bdf Merge "Remove libc++demangle from static libs." 2021-10-13 15:07:04 +00:00
Liz Kammer
0d7d7ac01f Remove libc++demangle from static libs.
This is implicitly added by Soong with stl
https://cs.android.com/android/platform/superproject/+/master:build/soong/cc/stl.go;l=157;drc=cb0ac95bde896fa2aa59193a37ceb580758c322c

Test: m
Change-Id: Ie18a7cda8001deb3a0e714db02a50919e631c319
2021-10-12 13:42:36 -04:00
Chih-hung Hsieh
aaf20e105c Merge "Add/allow clang-14 warnings." 2021-10-12 00:14:58 +00:00
Chih-Hung Hsieh
9935aa7a27 Add/allow clang-14 warnings.
* -Wstatic-in-inline found in
  libm/upstream-freebsd/lib/msun/src/s_lround.c

Test: mm in bionic/tests
Bug: 201432564
Bug: 202752322
Change-Id: I4d506fa539ab0de939d85924a5fd9a61644e4fb0
2021-10-11 12:37:56 -07:00
Daniele Di Proietto
456eed0638 Merge "malloc_heapprofd: Avoid a spurious error log" 2021-10-11 10:17:07 +00:00
Daniele Di Proietto
b6d3c78244 malloc_heapprofd: Avoid a spurious error log
In the following scenario:

* Heapprofd wants to profile a process.
* The process receives the heapprofd signal, so it sets up the ephemeral
  hooks.
* The process does not perform any allocation, so the proper heapprofd
  hook is never installed.
* Heapprofd terminates.
* Now heapprofd wants to start a new profiling session.
* The process receives the heapprofd signal (again).

In the signal handler, no action is needed at this point. The ephemeral
hooks are already setup, so, at the next malloc, the proper heapprofd
hooks will be installed.

Before this commit, the code logged an error message, but still worked
correctly.

This commit basically just skips the error_log below.

Example of the error message that is now suppressed:

```
process: heapprofd: failed to transition kInitialState ->
kInstallingEphemeralHook. current state (possible race): 2
```

Tested by:
* Running a process that calls malloc on input from stdin.
* (Optional, tested both cases) Enable GWP-Asan by calling
  `android_mallopt(M_INITIALIZE_GWP_ASAN, ...`. The call will return
  success.
* Attaching heapprofd:
```
external/perfetto/tools/heap_profile -i 1 -p `adb shell pidof <...>`
```
* Detaching heapprofd (CTRL-C). The trace will be empty.
* (If not enabled before) Enabling GWP-Asan. The call will fail (because
  GWP-Asan detects heapprofd hooks).
* Reattaching heapprofd.
* Triggering some malloc()s in the process. The error log from above
  will not appear in `adb logcat`.
* Detaching heapprofd (CTRL-C). The trace will NOT be empty.

Bug: 192258849
Change-Id: I01699b10ecd19e52e1e77f83fcca955ebd885942
2021-10-07 17:25:00 +01:00
Steven Moreland
f72eb4e575 Merge "Revert "strerror: incl enum name"" 2021-10-07 00:25:39 +00:00
Steven Moreland
4ef83d6919 Revert "strerror: incl enum name"
Revert submission 1833622-usable-strerror

Reason for revert: b/202330586
Bug: 202330586
Reverted Changes:
I4d8f617a0:Track strerror(3) change.
I8ea86220c:strerror: incl enum name
I407bd9f4d:strerror: incl enum name

Change-Id: I81ed563221a77827084711eadd7fb739aeba52a1
2021-10-07 00:19:18 +00:00
Elliott Hughes
8afd4f34f1 Merge "strerror: incl enum name" am: 71ab61902b
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1833622

Change-Id: I2aa12728395e9045db294b64f4edd2032af186a5
2021-10-06 19:53:46 +00:00
Elliott Hughes
71ab61902b Merge "strerror: incl enum name" 2021-10-06 19:35:51 +00:00
Steven Moreland
c3060de20f strerror: incl enum name
strerror is nice, but usually I don't care about the text, I care about
the uppercase enum

Bug: N/A
Test: ./tests/run-on-host.sh glibc (existing failures -> b/201305529)
Test: atest bionic-unit-tests-static
Test: atest malloc_debug_unit_tests

Change-Id: I407bd9f4dfa918fff66a0da7df8d7239f789c7b8
2021-10-05 11:12:30 -07:00
Elliott Hughes
617c4b5876 Merge "Move ExecTestHelper to using a regex." am: b4d9304628
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1843499

Change-Id: I1c1f6cb3fe3930de9593cf531d49ca99681b59b6
2021-10-01 23:43:31 +00:00
Elliott Hughes
b4d9304628 Merge "Move ExecTestHelper to using a regex." 2021-10-01 23:31:05 +00:00
Christopher Parsons
4201548a9a Merge "Remove bazel_module stanzas from bionic/linker" am: 39c2776fff
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1842696

Change-Id: Ibe3045926690f69442f853069c445e8afd811b71
2021-10-01 22:21:38 +00:00
Christopher Parsons
39c2776fff Merge "Remove bazel_module stanzas from bionic/linker" 2021-10-01 22:11:52 +00:00
Colin Cross
de04eeba47 Merge "Add more tests to TEST_MAPPING" am: 8d9297f905
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1842081

Change-Id: I9978f200ea493aed0cfd973991099c56860cadfc
2021-10-01 21:15:27 +00:00
Colin Cross
8d9297f905 Merge "Add more tests to TEST_MAPPING" 2021-10-01 21:00:23 +00:00
Elliott Hughes
419554e99c Move ExecTestHelper to using a regex.
Test: treehugger
Change-Id: I1aa6bc174e000cb57481c51109d98b8c2c5acb8e
2021-10-01 13:11:53 -07:00
Chris Parsons
ebe5e5f7d4 Remove bazel_module stanzas from bionic/linker
This also effectively re-enables linker_wrapper, which may have been
independently fixed some time ago.

Test: mixed_droid.sh
Change-Id: I9bc7e099fe3c5da1c4da12c79128baf6f807354a
2021-10-01 16:06:38 -04:00
Colin Cross
6f7870742e Merge "Convert bionic dlext test zips to Android.bp" am: 7b40b4dda0
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1838353

Change-Id: I8f4f3cc333c9a9709ad323b58813d716ac7c818f
2021-10-01 16:46:26 +00:00
Colin Cross
7b40b4dda0 Merge "Convert bionic dlext test zips to Android.bp" 2021-10-01 16:27:54 +00:00
Colin Cross
0cc60afa33 Add more tests to TEST_MAPPING
Test: treehugger
Change-Id: I1d7dd32fd7f90a20d61de4701293527f83dc4ec4
2021-10-01 09:25:36 -07:00
Colin Cross
badcb38d3c Convert bionic dlext test zips to Android.bp
Use cc_genrules to create the dlext test zips needed by the bionic
tests.  The genrules aren't visible to Make, and so don't work with
the `required` property.  Move all of the dependencies to `data_bins`,
`data_libs` or `data` for helper binaries, shared libraries or
genrule zip files respectively.  The `data*` properties copy the
files into the same directory as a test, respecting the
`bionic-loader-test-libs` relative path specified by each, but
does not put each helper binary in its own subdirectory, so update
the paths in each of the tests.

Bug: 200872604
Test: atest CtsBionicTestCases
Test: atest bionic-unit-tests
Test: cts-tradefed run commandAndExit cts -m CtsBionicTestCases
Test: adb push $OUT/data/nativetest/bionic-unit-tests /data/nativetest/ && adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Change-Id: Ic4257cb4104ff558326df2363730acd20464b051
2021-09-30 14:04:27 -07:00
Treehugger Robot
cb38a389dd Merge "Treat static binaries "the same" for the profiling signals." am: 5b4913a599
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1840754

Change-Id: I6dece10d59d8560c8049f21d47195f0cdbfa5cbf
2021-09-30 16:57:36 +00:00
Treehugger Robot
5b4913a599 Merge "Treat static binaries "the same" for the profiling signals." 2021-09-30 16:45:49 +00:00
Lalit Maganti
276e49cb89 Merge "bionic: fix broken end atrace events" am: e8cc2c32ac
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1810418

Change-Id: I7ed065c8ab5f4a51e92221560f2fb887d08c3bb6
2021-09-30 10:59:40 +00:00
Lalit Maganti
e8cc2c32ac Merge "bionic: fix broken end atrace events" 2021-09-30 10:45:38 +00:00
Elliott Hughes
377193745d Treat static binaries "the same" for the profiling signals.
Strictly this still isn't quite the same, because they won't actually be
profiled, but at least they won't *crash* now if they're sent a
profiling signal.

Bug: http://b/201497662
Test: treehugger
Change-Id: I0728492eed77584cd850d28897056996387e6671
2021-09-29 17:10:02 -07:00
Lalit Maganti
2aa3f7cb26 bionic: fix broken end atrace events
When calling write on an FD for trace_marker, it is expected that the
pointer passed will be paged into memory. If this isn't the case, the
kernel will ignore the string passed and instead write "<faulted>" to
the ring buffer.

For end events, we were passing a constant string which resides in
the rodata section of the ELF file. If this section is paged out, we
end up not closing atrace stacks correctly leading to very broken traces.

For even more context, see the associated bug.

Fix this issue by reading the constant string to the stack first
which should mean the string is always paged in.

Bug: 197620214
Change-Id: I6a444ac6fe83a6a9fb696c5621e392eca7e9437a
2021-09-29 18:33:27 +01:00
Evgenii Stepanov
2ebb8f465f Merge "Add CtsBionicTestCases to hwasan-postsubmit." am: c6b6f5e7ef
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1836409

Change-Id: I60abf556feb11f474620d33e4a57e48171a95801
2021-09-24 22:33:02 +00:00
Evgenii Stepanov
2014e706a6 Merge "Random HWASan cleanups." am: b34d313d17
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1830382

Change-Id: If9ace9c23ccaff70f9022ab090886f28ebc9a74c
2021-09-24 22:32:57 +00:00
Evgenii Stepanov
c6b6f5e7ef Merge "Add CtsBionicTestCases to hwasan-postsubmit." 2021-09-24 22:21:26 +00:00
Evgenii Stepanov
b34d313d17 Merge "Random HWASan cleanups." 2021-09-24 22:15:43 +00:00
Evgenii Stepanov
1d7077a1ce Add CtsBionicTestCases to hwasan-postsubmit.
Bug: 193568145
Test: none

Change-Id: I8aa9b9d299973600e7488aeae93b92f59776d5e5
2021-09-24 13:20:43 -07:00
Evgenii Stepanov
4edbcee2c6 Random HWASan cleanups.
Makes CtsBionicTestCases pass under HWASan.

Bug: 193568145
Test: CtsBionicTestCases
Change-Id: I38ee8a8508827c0ffee61ce33bb8c6a3f40388c9
2021-09-24 11:21:38 -07:00
Christopher Ferris
3e3ada4ff3 Merge "Update allocator alignment tests." am: 258642b7d7
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1832879

Change-Id: I45d13def0ccd2389647972f58dcc34b170698842
2021-09-22 01:03:26 +00:00
Christopher Ferris
258642b7d7 Merge "Update allocator alignment tests." 2021-09-22 00:47:17 +00:00
Christopher Ferris
b3cac0fab4 Update allocator alignment tests.
clang was configured to force 16 byte alignments on allocations > 8
for 64 bit. Unfortunately, we never updated our alignment test to
verify this behavior. So this finally adds these new restrictions.

In addition, when GWP-ASan is enabled, it will take over allocations
from the native allocator. In order to make sure that GWP-ASan also
obeys these alignment checks, add a test that forces GWP-ASan on and
runs the alignment check test.

Test: Ran unit tests on a flame using scudo (both 32 bit and 64 bit).
Test: Ran unit tests on a flame using jemalloc (both 32 bit and 64 bit).
Change-Id: I87a20b9c2f32b9d207f36437d291ed44247dcbd1
2021-09-21 16:09:22 -07:00
Christopher Ferris
10878a22ca Merge "Fix broken return code of M_INITIALIZE_GWP_ASAN." am: b47aa42a11
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1831562

Change-Id: I0e7bc8e3c1ead0ea4547f342ebb95de4173be08c
2021-09-21 17:42:15 +00:00
Christopher Ferris
b47aa42a11 Merge "Fix broken return code of M_INITIALIZE_GWP_ASAN." 2021-09-21 17:30:59 +00:00
Christopher Ferris
8f9713e237 Fix broken return code of M_INITIALIZE_GWP_ASAN.
When calling android_mallopt using M_INITIALIZE_GWP_ASAN, nothing
was being returned. Fix this, add a test, and also refactor the
code a bit so dynamic and static share the same code.

Test: Unit tests pass in dynamic and static versions.
Test: Passed using both jemalloc and scudo.
Change-Id: Ibe54b6ccabdbd44d2378892e793df393978bc02b
2021-09-20 18:07:07 -07:00
Treehugger Robot
9ed43777fe Merge "Use the BSD license for our bogus fts.h." am: e8121199fd
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1826812

Change-Id: Ib06ae198d46177c27bca7827855e66e2101150af
2021-09-14 22:32:33 +00:00
Treehugger Robot
e8121199fd Merge "Use the BSD license for our bogus fts.h." 2021-09-14 22:11:31 +00:00
Elliott Hughes
c7fe26aa82 Use the BSD license for our bogus fts.h.
...since the implementation is BSD. I missed this in the original code
review (and the presubmit hooks were skipped, so the machines didn't
notice).

Test: N/A
Change-Id: Ia9fe067c68b3ab8045d3f5dfe256f3200f102fbf
2021-09-14 12:26:08 -07:00
Elliott Hughes
5356f2de42 Merge "Use lp64 rather than explicitly saying "arm64,x86_64"." am: dc448a82b1
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1819299

Change-Id: I4f8b81ba63cd9b5284d18ec026a1b69cfa260872
2021-09-10 21:24:01 +00:00
Elliott Hughes
dc448a82b1 Merge "Use lp64 rather than explicitly saying "arm64,x86_64"." 2021-09-10 21:12:43 +00:00
Treehugger Robot
d87aa4117b Merge changes Ifac9a59e,I213d423a am: 406589b975
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1819303

Change-Id: Iae2b9bb2b8b65df0bb4695d09ed4d64a790fd3d0
2021-09-09 04:28:56 +00:00
Treehugger Robot
406589b975 Merge changes Ifac9a59e,I213d423a
* changes:
  Export fts as a static library for use with musl
  Compile fts.c in libc_openbsd_ndk
2021-09-09 04:15:12 +00:00
Treehugger Robot
a64e82b278 Merge "Add API level define for T." am: 41fed4d461
Original change: https://android-review.googlesource.com/c/platform/bionic/+/1822489

Change-Id: I3223faa589746b5a7c3f0613f42e75927f30224f
2021-09-09 00:49:48 +00:00