Commit graph

35535 commits

Author SHA1 Message Date
Christopher Ferris
d3f05492df Update for libunwindstack shared_ptr MapInfos.
Bug: 120606663

Test: Malloc debug unit tests pass.
Change-Id: Ic8fa25c770953ebc0a78d67e54bc0d7b8e0abd87
Merged-In: Ic8fa25c770953ebc0a78d67e54bc0d7b8e0abd87
(cherry picked from commit 04233539b4)
2021-10-29 13:03:05 -07:00
Colin Cross
3b868a87de Merge "Revert "Make native bridge libc uninstallable"" 2021-10-29 18:10:59 +00:00
LaMont Jones
035702e36b Revert "Make native bridge libc uninstallable"
Revert submission 1874144-native_bridge_libc_dup_rules

Reason for revert: breaks ndk_translation_all build
Reverted Changes:
I5379aa959:Make native bridge libc uninstallable
I2220d6b48:Remove BUILD_BROKEN_DUP_RULES from cuttlefish buil...
I8e0eaed21:Make installable arch-variant for cc modules

Bug: 204136549
Fixes: 204572444
Change-Id: I57e00a4fb37f756c5190546867a9bf4a2837949c
2021-10-29 18:08:12 +00:00
Colin Cross
a62fd9d9ae Merge "Make native bridge libc uninstallable" 2021-10-29 14:58:10 +00:00
Treehugger Robot
de6c4cd4e0 Merge "Don't open /dev/null until we need to." 2021-10-29 01:06:23 +00:00
Colin Cross
48efa5b8cd Make native bridge libc uninstallable
The native bridge libc.so is overridden by
//frameworks/libs/native_bridge_support/libc:libc, mark it
installable: false to avoid a collision in the install rules.
Allows removing BUILD_BROKEN_DUP_RULES from cuttlefish builds.

Bug: 204136549
Test: m checkbuild
Change-Id: I5379aa9595a714efdbe1ddc1ff4f65bb45fc67e8
2021-10-28 14:44:37 -07:00
Elliott Hughes
7a2386bf89 Don't open /dev/null until we need to.
This saves a couple of syscalls in the common case, and also lets static
binaries run in a chroot without /dev/null as long as
stdin/stdout/stderr are actually connected to something (which the
toybox maintainer tried to do).

Test: manual with strace
Change-Id: Ic9a28896a07304a3bd428acfd9ddca9d22015f6e
2021-10-28 09:55:27 -07:00
Yi Kong
d8854293d1 Merge "Workaround Clang cannot build ifunc with LTO" 2021-10-23 12:47:26 +00:00
Yi Kong
b952a77e70 Workaround Clang cannot build ifunc with LTO
This is a KI: https://bugs.llvm.org/show_bug.cgi?id=46488

Bug: 203737712
Test: m GLOBAL_THINLTO=true bionic-unit-tests-static
Change-Id: I950a85f9676136299fc994a800d32e20bf12a8dd
2021-10-21 14:19:48 +00:00
Christopher Ferris
dc4b3789e6 Merge "Add execinfo functionality." 2021-10-21 00:25:24 +00:00
Christopher Ferris
11526e2fc6 Add execinfo functionality.
Bug: 27877410

Test: Add new unit tests.
Change-Id: Id5d7eb27a23f50e99a04f5ee1ab64047ba269bab
2021-10-20 21:53:07 +00:00
Treehugger Robot
af2340a515 Merge "Update bionic coverage docs." 2021-10-19 04:51:00 +00:00
Dan Albert
837b683b46 Update bionic coverage docs.
These docs refer to the old coverage workflow from the Android.mk
build.

AFAIK there's no way to get coverage for the host tests, so that part
was removed.

Test: followed the docs, got coverage data
Bug: None
Change-Id: Ibef5ae2d354296a77b752d3b7c9c48cf7a34ef98
2021-10-18 16:32:53 -07:00
Treehugger Robot
a3c6e7030c Merge "Add preadv2/pwritev2 wrappers." 2021-10-18 22:15:38 +00:00
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