Commit graph

10027 commits

Author SHA1 Message Date
Treehugger Robot
e3bc50d44f Merge changes If42905f3,Id351a993,I8a082fd0
* changes:
  fdtrack: don't do anything while vforked.
  fdsan: don't do anything when vforked.
  Track whether a thread is currently vforked.
2020-05-12 07:04:58 +00:00
Jiyong Park
262ff01d2b Merge "Set apex_available property" 2020-05-10 06:25:04 +00:00
Jiyong Park
4ede160cb1 Set apex_available property
The marked library(ies) were available to the APEXes via the
hand-written whitelist in build/soong/apex/apex.go. Trying to remove the
whitelist by adding apex_available property to the Android.bp of the
libraries.

Exempt-From-Owner-Approval: cherry-pick from internal

Bug: 150999716
Test: m
Merged-In: If64eff62b9e93af95089e5010c30eb586673b92e
(cherry picked from commit 693a7214d6)
Change-Id: If64eff62b9e93af95089e5010c30eb586673b92e
2020-05-10 06:24:42 +00:00
Peter Collingbourne
947125edf1 Fix typo in if statement.
It turns out that we weren't actually enabling stack traces due
to a typo in one of the if statements. Fix it.

Bug: 135772972
Change-Id: Ic19352280f65acd621b9d88c361c55680b3327f0
2020-05-08 10:05:39 -07:00
Josh Gao
4129113128 fdtrack: don't do anything while vforked.
Bug: http://b/153926671
Test: 32/64-bit bionic-unit-tests on blueline, x86_64 emulator
Change-Id: If42905f3d6a76ed70a45e5b9edd029ffd7789045
2020-05-07 20:18:45 -07:00
Josh Gao
65fb2a7f03 fdsan: don't do anything when vforked.
Bug: http://b/153926671
Test: 32/64-bit bionic-unit-tests on blueline, x86_64 emulator
Change-Id: Id351a993e396774b68239edfef83d9e81205290b
2020-05-07 20:18:40 -07:00
Josh Gao
2303283740 Track whether a thread is currently vforked.
Our various fd debugging facilities get extremely confused by a vforked
process closing file descriptors in preparation to exec: fdsan can
abort, and fdtrack will delete backtraces for any file descriptors that
get closed. Keep track of whether we're in a vforked child in order to
be able to detect this.

Bug: http://b/153926671
Test: 32/64-bit bionic-unit-tests on blueline, x86_64 emulator
Change-Id: I8a082fd06bfdfef0e2a88dbce350b6f667f7df9f
2020-05-07 19:44:27 -07:00
Treehugger Robot
073c3dc1eb Merge "Add goldfish-opengl to use bionic_libc_platform_headers" 2020-05-08 00:53:07 +00:00
Roman Kiryanov
067f51824b Add goldfish-opengl to use bionic_libc_platform_headers
We need __get_tls and TLS_SLOT_OPENGL for our
OpenGL implementation. We currently use .mk files
and this restriction does not apply, since we are
migrating to .bp we need to address restriction.

Bug: 154151802
Test: presubmit
Signed-off-by: Roman Kiryanov <rkir@google.com>
Change-Id: I007664d919204cd4f6a623f9695a56e94bab7ae6
2020-05-07 15:06:55 -07:00
Peter Collingbourne
144a6ab341 Merge "Introduce a new heap tagging level, M_HEAP_TAGGING_LEVEL_SYNC." 2020-05-07 17:51:51 +00:00
Peter Collingbourne
d3060019de Introduce a new heap tagging level, M_HEAP_TAGGING_LEVEL_SYNC.
The SYNC tagging level enables stack trace collection for allocations and
deallocations, which allows allocation and deallocation stack traces to
appear in tombstones when encountering a tag check fault in synchronous tag
checking mode.

Bug: 135772972
Change-Id: Ibda9f51b29d2c8e2c993fc74425dea7bfa23ab1e
2020-05-05 13:28:16 -07:00
Martin Stjernholm
82d84bcd7e Make Bionic and kernel system includes explicit in the blueprints.
Before this Soong added hardcoded system include paths to
bionic/libc/{include,kernel}, which won't work when Bionic libs are
packaged up as prebuilts in an SDK module snapshot.

Test: Build and boot
Test: Check in out/verbose.log.gz that a C file doesn't get any bionic
  include path for linux_glibc.
Bug: 153590472
Change-Id: I13c8eb3dd7150d6e0fee001b290b53fcebebcfea
2020-05-05 13:34:14 +01:00
Jooyung Han
95c00dcf0b Merge "Set min_sdk_version for mainline dependencies" 2020-05-05 06:43:24 +00:00
Jooyung Han
15c32a8e1a Set min_sdk_version for mainline dependencies
To enforce all modules included in mainline modules(apex/apk),
modules should set min_sdk_version which is the minimum sdk versions
that compiled artifacts run against.

Setting this doesn't change build output.

Bug: 145796956
Test: m
Change-Id: Ibbe3771592677d729c81343fe00859c0afa81918
2020-05-05 10:45:46 +09:00
Treehugger Robot
49f7f10f62 Merge "Add API constant for S." 2020-05-05 00:35:17 +00:00
Evgenii Stepanov
5a73e03305 [libc] Zero and pattern initialization of heap memory.
Bug: 155227507
Test: scudo_unit_tests

Change-Id: I85075acfd85172f6cc7e48f79eeb577e293d0d30
2020-05-01 14:06:54 -07:00
Martin Stjernholm
82c1096cac Merge "Reland "Make bionic_platform_headers available only for Bionic targets"." 2020-04-30 14:11:50 +00:00
Josh Gao
4d0c40be89 Merge changes I8b25accf,I59013f0c,I6c881e5d,I66826f31,I552692ae, ...
* changes:
  fdtrack: add wrapper for socketpair.
  fdtrack: add wrapper for eventfd.
  fdtrack: add wrappers for epoll_create, epoll_create1.
  fdtrack: add wrappers for pipe, pipe2.
  fdtrack: add tests for individual wrappers.
  fdtrack: don't destroy traces.
2020-04-30 01:54:08 +00:00
Peter Collingbourne
514faf92c8 Merge "Switch to new kernel ptrace interface for reading tags." 2020-04-30 00:55:45 +00:00
Josh Gao
b107eab5ef fdtrack: add wrapper for socketpair.
Bug: https://issuetracker.google.com/154450436
Test: bionic-unit-tests
Change-Id: I8b25accf00dc01f6fab351f3ba612f6b0ff9d094
2020-04-29 17:21:16 -07:00
Josh Gao
7de412443d fdtrack: add wrapper for eventfd.
Bug: https://issuetracker.google.com/154450436
Test: bionic-unit-tests
Change-Id: I59013f0c4da0debbcc50269c64ae9db0cdc4eaa0
2020-04-29 17:21:16 -07:00
Josh Gao
a38331d833 fdtrack: add wrappers for epoll_create, epoll_create1.
Bug: https://issuetracker.google.com/154450436
Test: bionic-unit-tests
Change-Id: I6c881e5d67596c543526536541d5b8086e21d9e9
2020-04-29 17:21:16 -07:00
Josh Gao
1fad5283a0 fdtrack: add wrappers for pipe, pipe2.
Bug: https://issuetracker.google.com/154450436
Test: bionic-unit-tests
Change-Id: I66826f312a65ab9f1bd8193bf684e330baa952dc
2020-04-29 17:21:16 -07:00
Martin Stjernholm
a276343e14 Reland "Make bionic_platform_headers available only for Bionic targets".
The triggering reason for this change is that the SDK snapshot
generation cannot readily handle header libraries that are required for
targets that the SDK itself isn't available for. However, these include
files shouldn't be used without Bionic anyway.

Relanding unchanged - the build problem was due to a split topic.

Test: m checkbuild (on aosp_taimen)
Test: m (on aosp_taimen_hwasan)
Test: atest CtsBionicTestCases
Test: lunch fvp-userdebug && mmm bionic
Bug: 152255951
Change-Id: Iaf49597ea265e6f2a042de5ee873238073b2e545
2020-04-29 18:14:11 +01:00
Martin Stjernholm
d20571efe1 Merge "Revert "Make bionic_platform_headers available only for Bionic t..."" 2020-04-29 12:27:37 +00:00
Martin Stjernholm
ed95d0134d Revert "Make bionic_platform_headers available only for Bionic t..."
Reason for revert: Breaks rvc-d1-dev-plus-aosp: http://ab/6443190
Reverted Changes:
Ide447b89a:bionic_libc_platform_headers is only available whe...
Ia93cd3ec8:bionic_libc_platform_headers is only available whe...
Icdc495588:Make bionic_platform_headers available only for Bi...
Idfd7c87dc:bionic_libc_platform_headers is only available whe...

Bug: 152255951
Bug: 155269399
Change-Id: I214f1165bb0a7e59d3b35a13b3cceb1965be922b
2020-04-29 12:18:36 +00:00
Martin Stjernholm
38d0a7d9dc Merge "Make bionic_platform_headers available only for Bionic targets." 2020-04-29 10:30:23 +00:00
Mitch Phillips
ba1e921294 [NFC] Align pointer to type.
Typo fix.

Bug: N/A
Test: N/a
Change-Id: Ia19076da9ea19fc7629e625023e969105d2f8786
2020-04-28 11:33:48 -07:00
Treehugger Robot
5057c42012 Merge "malloc_hooks README.md: fix example compilation failures" 2020-04-27 23:29:41 +00:00
Martin Stjernholm
249f726583 Make bionic_platform_headers available only for Bionic targets.
The triggering reason for this change is that the SDK snapshot
generation cannot readily handle header libraries that are required for
targets that the SDK itself isn't available for. However, these include
files shouldn't be used without Bionic anyway.

Test: m checkbuild (on aosp_taimen)
Test: m (on aosp_taimen_hwasan)
Test: atest CtsBionicTestCases
Test: lunch fvp-userdebug && mmm bionic
Bug: 152255951
Change-Id: Icdc49558893c5355860f78d23275c49ba0119900
2020-04-27 19:07:01 +01:00
Jooyung Han
1d9ccdfb1a Merge "libc: Add stubs.versions=R" 2020-04-25 04:41:43 +00:00
Steven Moreland
6cdeed3124 malloc_hooks README.md: fix example compilation failures
Bug: N/A
Test: N/A
Change-Id: I017f47990417446f1bff5fc7a5bf7e53e8e1f85e
2020-04-25 00:46:45 +00:00
Peter Collingbourne
a41c3256d7 Switch to new kernel ptrace interface for reading tags.
Bug: 135772972
Change-Id: I1839f04130736b8f7ba0c282d4d6833d50b1a9ae
2020-04-24 17:32:23 -07:00
Elliott Hughes
3093e71811 Block all signals in ScopedSignalBlocker.
When a thread calls pthread_exit(3), ScopedSignalBlocker blocks all
user-visible signals, but leaves internal-use signals 33/34/36/36/37.
Signal 33 is used to unwind a thread for a backtrace, which can cause us
to access the stack after it's been unmapped. (Avoiding this was the
reason why we have the ScopedSignalBlocker in pthread_exit(3)!)

Fix this (and other potential issues) by changing ScopedSignalBlocker to
call __rt_sigprocmask(2) directly, so we don't mask out the internal-use
signals.

Bug: https://issuetracker.google.com/153624226
Test: not trivially reproducible
Change-Id: I9b125ed41ddee4c5d33b45920f1d142e52db47cb
2020-04-23 15:57:58 -07:00
Tom Cherry
ad9e99dad7 Include log/log_read.h for reading logs
log/log.h is concerned with writing logs.

Bug: 78370064
Test: build
Change-Id: I03d35f47acaa6eb0c8865836767d855be0203e92
2020-04-22 19:00:42 -07:00
Ryan Prichard
f3110d6840 Merge "x86: Switch get_pc_thunk to comdat" 2020-04-20 23:02:12 +00:00
Ryan Prichard
a992a06701 x86: Switch get_pc_thunk to comdat
Switch the __x86.get_pc_thunk.{bx,cx} functions from .gnu.linkonce to
comdat section groups. lld doesn't implement .gnu.linkonce and will
instead discard the input sections. Currently, it might produce a
faulty binary that has no get_pc_thunk function in it, which would
crash.

Normally, these functions are generated by GCC and are present in many
object files compiled with PIC. Clang doesn't use them, and instead
initializes the PIC base register with a "call 1f; 1: pop %ebx" pair.

Bug: http://b/154376560
Bug: https://bugs.llvm.org/show_bug.cgi?id=45594
Test: bionic-unit-tests
Change-Id: I3e4857aecdc281b32232270bff4880433e5b6afa
2020-04-20 14:28:10 -07:00
Mitch Phillips
c8480193db Merge "Set the top bit for tagged pointers." 2020-04-20 20:57:41 +00:00
Elliott Hughes
0361a4f867 Merge "tmpfile(3): use O_TMPFILE where available." 2020-04-17 23:29:24 +00:00
Mitch Phillips
b125ca48de Set the top bit for tagged pointers.
Some applications may incorrectly assume that a "negative" pointer
indicates error. By setting the top bit in TBI mode, we catch these
cases as well. Although they don't directly indicate incompatibility
with MTE (as MTE uses the 2nd-highest nibble) - this ensures we catch
HWASan errors as well as reserve the bits for future MTE expansion.

Bug: 154272452
Test: Boot flame, device boots successfully.
Change-Id: I94a6821a82ce7ead59e6ca2dd113a5a50ee9e56b
2020-04-17 22:04:27 +00:00
Peter Collingbourne
23ec1421b5 Merge "Add PTRACE_PEEKTAG to mte_kernel.h." 2020-04-17 18:16:05 +00:00
Treehugger Robot
a06df5faef Merge "arc4random.h: remove some cruft." 2020-04-17 15:32:47 +00:00
Elliott Hughes
bb575d93c4 arc4random.h: remove some cruft.
This hasn't been used since the code was rewritten years ago.

Test: builds
Change-Id: I2c4bccb3fffb15115083afbb178519bd133c64de
2020-04-16 23:14:38 +00:00
Elliott Hughes
a4c2f33fc7 tmpfile(3): use O_TMPFILE where available.
This also removes the ScopedSignalBlocker, which doesn't seem to have
made any sense since threads were invented.

Test: treehugger
Change-Id: I9a323ab4a0b43f14fd5d1f0df1f80184aef63770
2020-04-16 16:12:03 -07:00
Treehugger Robot
1ddfe48a9c Merge "Set apex_available property" 2020-04-11 04:59:53 +00:00
Tom Cherry
03581d7aa9 Merge changes I6c9c2bf5,I23991692
* changes:
  Tighten pwd/grp iteration tests.
  Cleanup some trivial TODOs.
2020-04-10 23:04:55 +00:00
Tom Cherry
6f2e810198 Cleanup some trivial TODOs.
1) "fix the system properties design" is written for the old protocol,
   so we've already changed the design.  There are no other further
   planned changes.
2) "don't drag in all the macros, just the types." is not likely to
   happen or be particularly impactful.
3) "Find a location suitable for these functions ..." is refering to
   legacy code.  More likely that this code will be removed before we
   find a serious reason to fix this TODO.
4) "(73062966) We still don't have a good way ..." is stale; we fixed
   this bug and added the appropriate mechanism.

Test: n/a
Change-Id: I23991692cdeb81ad00844a6a1680900ff384208b
2020-04-10 11:46:03 -07:00
Christopher Ferris
bb9fcb4636 Update to v5.6 kernel headers.
Kernel headers coming from:

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

Add a new method for removing structures. This is to deal with the kernel
headers changing some definitions of timeval to __kernel_old_timeval
and itimerval to __kernel_old_itimerval. Remove the __kernel_old_XX
strutures and change the other structures to the previous definitions.

This only works so long as these structures stay the same, if they
diverge, then a different strategy will need to be implemented.

Test: Booted cuttlefish/walleye.
Test: Ran bionic-unit-tests on cuttlefish/walleye.
Change-Id: I0a61f4fa6e4155c602e0414d9b38c2e1637829af
2020-04-10 10:53:48 -07:00
Dan Albert
14dcbf89ce Add API constant for S.
Test: treehugger
Bug: http://b/152037166
Change-Id: I9039377e80574cd59e13726a12072fe3002df67d
2020-04-09 12:38:53 -07:00
Jooyung Han
dbfa074a76 libc: Add stubs.versions=R
Add version R to libc so that APEXes can rely on version R stubs of
libc.

Bug: 152655956
Test: m
Merged-In: I70d17702d9885760af658e23ac6e3106405ff3bc
Change-Id: I70d17702d9885760af658e23ac6e3106405ff3bc
(cherry picked from commit 75e79c92dc)
2020-04-09 16:03:33 +09:00