Commit graph

30975 commits

Author SHA1 Message Date
Automerger Merge Worker
85ff79fa9b Merge "[malloc dispatch] Install dispatch over the top of GWP-ASan." am: 18b2891cd2
Change-Id: Idd0e9707448292dc98890220abdf2b92295cc1e2
2020-02-12 03:36:48 +00:00
Treehugger Robot
18b2891cd2 Merge "[malloc dispatch] Install dispatch over the top of GWP-ASan." 2020-02-12 03:23:21 +00:00
Automerger Merge Worker
740ed23141 Merge "[GWP-ASan] [malloc-tests] Scan GWP-ASan regions in maps." am: 549a60aa7d
Change-Id: I8461be7476fd65726241cada466bf4bc0b4b2d15
2020-02-12 03:12:55 +00:00
Treehugger Robot
549a60aa7d Merge "[GWP-ASan] [malloc-tests] Scan GWP-ASan regions in maps." 2020-02-12 02:58:43 +00:00
Automerger Merge Worker
a4d44d1f3c Merge "Clean up the math headers." am: 419ffcd827
Change-Id: I1a337039851b03553c4c3cc8da100a6722709ca4
2020-02-12 01:09:56 +00:00
Elliott Hughes
419ffcd827 Merge "Clean up the math headers." 2020-02-12 00:56:48 +00:00
Mitch Phillips
242387d0cf [GWP-ASan] [malloc-tests] Scan GWP-ASan regions in maps.
GWP-ASan is part of the native allocator, and may allocate some memory.
When GWP-ASan is enabled, the malloc tests need to look inside of
GWP-ASan regions as well for native allocations.

Bug: 135634846
Test: atest bionic-unit-tests
Change-Id: Ibb78f9c9e7e96a437cffce013facd18708799b0e
2020-02-11 16:08:17 -08:00
Mitch Phillips
3083cc9479 [malloc dispatch] Install dispatch over the top of GWP-ASan.
When enabled, GWP-ASan sets the current dispatch table. Then, when a
shim layer (malloc_debug, malloc_hooks, heapprofd) comes along, they
should (by design) overwrite the current dispatch table.

Currently, these shim layers check to see whether malloc_limit is
installed by checking the current dispatch table against nullptr.
Because GWP-ASan owns the current dispatch table, the shim thinks that
malloc_limit is installed and falls back to only use the default
dispatch, thinking that malloc_limit will call them. This is not the
case, and they should take over the current dispatch pointer.

Bug: 135634846
Test: atest bionic

Change-Id: Ifb6f8864a15af9ac7f20d9364c40f73c5dd9d870
2020-02-11 15:29:21 -08:00
Automerger Merge Worker
780ff608e7 Merge "Use "com.android.runtime" for its link namespace" am: 65cbad1ffa
Change-Id: I7f357d9332b24a42f3c76b6aff805978830b0f9b
2020-02-11 19:16:38 +00:00
Treehugger Robot
65cbad1ffa Merge "Use "com.android.runtime" for its link namespace" 2020-02-11 19:00:40 +00:00
Elliott Hughes
44c01c77d3 Clean up the math headers.
I had hoped that this would then let us remove more of the "introduced
in" annotations, but it looks like that's not really going to happen
until the NDK's minimum supported API is 21.

Also remove a .c file that wasn't referenced anywhere.

Test: treehugger
Change-Id: I8b4a61c082293f8445195a4fa5ee30595d70444e
2020-02-11 08:46:29 -08:00
Automerger Merge Worker
0422a2900c Merge "[GWP-ASan] Integrate GWP-ASan into bionc's malloc() (using hooks)." am: d129786e12
Change-Id: I111c814306fc73e775c111459b8b4bdaae16f5ec
2020-02-10 23:44:28 +00:00
Automerger Merge Worker
454abda2fa Merge "[Elf TLS] [GWP-ASan] Update ELF TLS test." am: 21192ad26f
Change-Id: Ic81011a03dc4f6bf8583b7c1634086e0affa5f63
2020-02-10 23:44:25 +00:00
Mitch Phillips
d129786e12 Merge "[GWP-ASan] Integrate GWP-ASan into bionc's malloc() (using hooks)." 2020-02-10 23:35:26 +00:00
Mitch Phillips
21192ad26f Merge "[Elf TLS] [GWP-ASan] Update ELF TLS test." 2020-02-10 23:35:26 +00:00
Automerger Merge Worker
07b226ff58 Merge "Update a few comments." am: 20b45958c3
Change-Id: Ib1ed0eb338e2a7d7119ea9d7e88c3742e5ee077b
2020-02-10 20:14:56 +00:00
Treehugger Robot
20b45958c3 Merge "Update a few comments." 2020-02-10 20:00:45 +00:00
Mitch Phillips
f3968e89cb [GWP-ASan] Integrate GWP-ASan into bionc's malloc() (using hooks).
This patch introduces GWP-ASan - a sampled allocator framework that
finds use-after-free and heap-buffer-overflow bugs in production
environments.

GWP-ASan is being introduced in an always-disabled mode. This means that
GWP-ASan will be permanently disabled until a further patch turns on
support. As such, there should be no visible functional change for the
time being.

GWP-ASan requires -fno-emulated-tls wherever it's linked from. We
intentionally link GWP-ASan into libc so that it's part of the initial
set of libraries, and thus has static TLS storage (so we can use
Initial-Exec TLS instead of Global-Dynamic). As a benefit, this reduces
overhead for a sampled process.

GWP-ASan is always initialised via. a call to
mallopt(M_INITIALIZE_GWP_ASAN, which must be done before a process is
multithreaded).

More information about GWP-ASan can be found in the upstream
documentation: http://llvm.org/docs/GwpAsan.html

Bug: 135634846
Test: atest bionic
Change-Id: Ib9bd33337d17dab39ac32f4536bff71bd23498b0
2020-02-10 10:51:23 -08:00
Elliott Hughes
f9930b765c Update a few comments.
Test: N/A
Change-Id: Id5e21eaff9bc43256b8f54e708dfc862ee7e763a
2020-02-10 10:30:38 -08:00
Automerger Merge Worker
657cfdd14b Merge "bionic: Check /sys/kernel/tracing for tracefs" am: 4537cf868b
Change-Id: I9e6c830c330d1e023d1969a8158d84e42b3d473e
2020-02-10 16:56:08 +00:00
Treehugger Robot
4537cf868b Merge "bionic: Check /sys/kernel/tracing for tracefs" 2020-02-10 16:40:50 +00:00
Automerger Merge Worker
de4c31a22a Merge "Update to v5.5 kernel headers." am: 6ab6025981
Change-Id: I55f1d5592b23a9ee70045f17b2e10235366184bd
2020-02-07 22:18:13 +00:00
Christopher Ferris
6ab6025981 Merge "Update to v5.5 kernel headers." 2020-02-07 22:04:23 +00:00
Christopher Ferris
d32ca14ea3 Update to v5.5 kernel headers.
Kernel headers coming from:

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

Test: Boots on walleye.
Test: Ran bionic-unit-tests on walleye.
Test: Boots on cuttlefish.
Test: Ran bionic-unit-tests on cuttlefish.
Change-Id: I57387d3c31e0ba5ad125ffe291cecf365c7b374e
Merged-In: I57387d3c31e0ba5ad125ffe291cecf365c7b374e
2020-02-07 20:14:42 +00:00
Hridya Valsaraju
ad5f772dba bionic: Check /sys/kernel/tracing for tracefs
tracefs will be mounted at /sys/kernel/tracing when debugfs
is not mounted.

Bug: 134669095
Test: atest bionic-unit-tests-static
Change-Id: Ic224cf13500efc570da8b6a27ce925bbcf068fdd
2020-02-07 11:54:28 -08:00
Jooyung Han
d55689bb99 Use "com.android.runtime" for its link namespace
For consistency, linker namespace for apex modules use its apex name
instead of hard-coded short name.

Bug: 148826508
Test: m / boot
Change-Id: I4bf565cd528d744fc42841fd2d9f8bf652d4d346
2020-02-08 03:49:22 +09:00
Automerger Merge Worker
cb1d238dd8 Merge "Use generated linker config for APEX binaries" am: a399ede44e
Change-Id: Ifb9fbfe8f6fb831aaa9c1118aaaa94ac70660f2d
2020-02-07 03:47:15 +00:00
Kiyoung Kim
a399ede44e Merge "Use generated linker config for APEX binaries" 2020-02-07 03:25:42 +00:00
Mitch Phillips
892d0286c4 [Elf TLS] [GWP-ASan] Update ELF TLS test.
GWP-ASan introduces two Initial-Exec thread-local variables into
libc.so. This causes the ELF TLS test to understandably fail, and needs
to be patched up.

Bug: 148606979
Test: atest bionic-unit-test
Change-Id: I77500a00edb55cb7bcd3cd3faffb76d2339ab42c
2020-02-07 01:40:05 +00:00
Automerger Merge Worker
88e638fc59 Merge "docs/status.md: link to github." am: 6fa2f4f2ff
Change-Id: Id0dd89c810729b68334fbce1a0cb3787a98d978b
2020-02-06 21:18:59 +00:00
Elliott Hughes
6fa2f4f2ff Merge "docs/status.md: link to github." 2020-02-06 21:02:00 +00:00
Automerger Merge Worker
7c316939ad Merge "Remove bionic's internal ctype-like inlines." am: 33822d6161
Change-Id: If1d439ecfa55f33773ac85f3f726575a670bea09
2020-02-06 05:26:21 +00:00
Treehugger Robot
33822d6161 Merge "Remove bionic's internal ctype-like inlines." 2020-02-06 05:11:54 +00:00
Elliott Hughes
9c381b046f docs/status.md: link to github.
We've had discussions about <monetary.h> (which wasn't previously
mentioned here at all, an oversight) and robust mutexes on github that
are worth linking to.

Bug: https://github.com/android/ndk/issues/1181
Bug: https://github.com/android/ndk/issues/1182
Test: N/A
Change-Id: If0d2c28757a3cbfffc358e8847dc4de1a67d9001
2020-02-05 16:04:57 -08:00
Automerger Merge Worker
de411846dd Merge "<ctype.h>: inline the ASCII functions." am: fd2eb42006
Change-Id: I37d8be113ed5d82b6c1bd151228b63b9dafe1705
2020-02-05 19:54:08 +00:00
Elliott Hughes
bf03c01b38 Remove bionic's internal ctype-like inlines.
Bug: http://b/144165498
Test: treehugger
Change-Id: Ifcf352525abc74850053a1a019f90c72e488b71c
2020-02-05 11:39:35 -08:00
Elliott Hughes
fd2eb42006 Merge "<ctype.h>: inline the ASCII functions." 2020-02-05 19:37:18 +00:00
Automerger Merge Worker
1362f6165e Merge "fortify: remove 'optimizations' for functions that LLVM knows about" am: 3f41e145f2
Change-Id: I47dc662643b8a1d0b9f8e82b2c81456d58585117
2020-02-05 18:14:26 +00:00
George Burgess IV
3f41e145f2 Merge "fortify: remove 'optimizations' for functions that LLVM knows about" 2020-02-05 18:02:08 +00:00
Elliott Hughes
026d3a8fa5 <ctype.h>: inline the ASCII functions.
We've optimized the ctype functions to the point where they're pretty
much all down to one instruction. This change takes the obvious next
step of just inlining them.

On Android these function have only ever been for ASCII. You need the
<wctype.h> functions for non-ASCII.

libc++ currently has its own inlines for the _l variants, so if we want
to just inline them in bionic directly, we'll need to coordinate that.

Bug: http://b/144165498
Test: treehugger plus benchmarks
Change-Id: I4cc8aa96f7994ae710a562cfc9d4f220ab7babd6
2020-02-05 08:18:51 -08:00
George Burgess IV
2f7876596e fortify: remove 'optimizations' for functions that LLVM knows about
Over the last year, LLVM apparently learned how to optimize many
FORTIFY'ed functions. I went through the list of functions it optimizes,
and simplified their implementations here.

This is more than a code health thing; __bos_trivially_ge expands to a
branch that's not eliminated until after inlining, so it can actually
cause some functions (like one of std::string's ctors) to become
uninlineable.

Bug: 148189733
Test: hand-checked the IR we get for each of the changed functions. Many
      get optimized to their non-_chk variant when appropriate. Others
      will get optimized to non-_chk versions when bos == -1. Bug repro
      also now shows all 'inline's.

Change-Id: Ic360818ad9daaeda3958e1282af41087f85122a3
2020-02-04 21:52:36 -08:00
Automerger Merge Worker
54797192c1 Merge changes from topic "import-lib-access" am: f7c40da307
Change-Id: Iff2cfb66068ab5d1cc5dcfe203f7cf2f2f9b78b7
2020-02-04 21:56:45 +00:00
Automerger Merge Worker
95fb2cfe6e Comment two linker namespace functions am: e503383c92
Change-Id: I6f6dbd7703725a67ee3f1bdfb9459463a81827ba
2020-02-04 21:56:44 +00:00
Automerger Merge Worker
1fee23eaac Rename dlsym_handle_lookup:6 to dlsym_handle_lookup_impl am: 272458ee9f
Change-Id: Ia830d004498ed7bf3530570f86aa7d38aa2f420c
2020-02-04 21:56:42 +00:00
Ryan Prichard
f7c40da307 Merge changes from topic "import-lib-access"
* changes:
  Ignore symbols of imported libs' dependencies
  Comment two linker namespace functions
  Rename dlsym_handle_lookup:6 to dlsym_handle_lookup_impl
2020-02-04 21:46:15 +00:00
Automerger Merge Worker
a107c6a10a Merge "Stop generating unused headers." am: 2968695188
Change-Id: I05bf8320339df0664b388e2e4ecd7ef8310f2bfd
2020-02-04 16:14:29 +00:00
Elliott Hughes
2968695188 Merge "Stop generating unused headers." 2020-02-04 15:56:44 +00:00
Elliott Hughes
c2faf235c0 Stop generating unused headers.
These just cause confusion because they often have different
values/layouts, but they're never actually used.

Test: treehugger
Change-Id: I424034088e017c919f62fcefa7d6d3f903f31cfb
2020-02-03 17:56:06 -08:00
Automerger Merge Worker
825ef686cb Merge "fdtrack: add a test." am: 22dc7df80e
Change-Id: Ia76125662ca2728dfcfcb9a07bf59852a7ad673c
2020-02-04 00:33:45 +00:00
Josh Gao
22dc7df80e Merge "fdtrack: add a test." 2020-02-04 00:22:13 +00:00