Commit graph

28597 commits

Author SHA1 Message Date
Tom Cherry
76e2b15ad4 Change stdatomic.h check from defined(_USING_LIBCXX) to __has_include(<atomic>)
The previous check was causing some problems with platform builds
using the NDK.  The new check is more accurate.

Move the C definitions from stdatomic.h to bits/stdatomic.h since
with the new check, we no longer can use the #undef trick to test
them.

Test: build platform NDK with stdatomic.h in pthread.h header
Test: stdatomic bionic-unit-tests
Change-Id: Ia0bc3cc8344f2ba4e6e55a52248fb6efee799d1d
2019-07-18 13:57:39 -07:00
Tom Cherry
9cf76012aa Merge "Update notice" 2019-07-17 21:11:15 +00:00
Tom Cherry
09ecb00b86 Merge "Fix pthread_cond_clockwait() when cond is initialized with CLOCK_MONOTONIC" 2019-07-17 20:57:37 +00:00
Tom Cherry
40f69aefb2 Update notice
4ed2f475d8 added new items for NOTICE,
but didn't update the NOTICE file.

Test: none
Change-Id: I558271dc4520d9685dd164ba9f0b6db13d125014
2019-07-17 10:56:16 -07:00
Tom Cherry
800c1a9707 Fix pthread_cond_clockwait() when cond is initialized with CLOCK_MONOTONIC
A bit of over-reliance on implementing pthread_cond_clockwait() in
terms of existing functions ended up with a bug that if the condition
variable was initialized to use CLOCK_MONOTONIC, then
pthread_cond_clockwait() would do the wrong thing.

This change corrects that and adds a test for this case.

Test: new and existing tests pthread_cond unit tests
Change-Id: I708d5dfbef95a67678db56dceda011f2f8fd1c5c
2019-07-17 10:46:47 -07:00
Treehugger Robot
59cc0b3142 Merge "Clear pointer tags as required for HWASAN for globals." 2019-07-17 01:03:48 +00:00
Elliott Hughes
f99fc25482 Merge "SSE4.1 is part of the Android x86/x86-64 ABI." 2019-07-16 23:24:22 +00:00
Elliott Hughes
3975431aba Merge "Add avx2 version of wmemset in binoic" 2019-07-16 23:00:24 +00:00
Peter Collingbourne
45f0a3b642 Clear pointer tags as required for HWASAN for globals.
A future version of HWASAN will set pointer tags when taking the address of
a global. This means that we need to untag pointers in a couple of cases
where potential global pointers are passed to an interface that expects
untagged pointers:

- The WriteProtected class, whose only instances are globals, passes its
  own address to mprotect. However, our device kernels do not currently
  untag pointers passed to mprotect (the proposed upstream kernel patches
  do, however, untag these pointers), so once HWASAN starts tagging global
  pointers, this will start failing.
- The shadow_load function loads from a shadow that corresponds to the
  address space bounds of loaded binaries. Since these address space
  bounds are untagged, the pointer needs to be untagged to match.

Test: boots
Change-Id: I3f11ce6eb7261752e5ff6d039d04dd45516b236f
2019-07-16 13:38:38 -07:00
Shalini Salomi Bodapati
4ed2f475d8 Add avx2 version of wmemset in binoic
Test: ./tests/run-on-host.sh 64
Change-Id: Id2f696cc60a10c01846ca3fe0d3a5d513020afe3
Signed-off-by: Shalini Salomi Bodapati <shalini.salomi.bodapati@intel.com>
2019-07-16 18:06:57 +05:30
Tom Cherry
7e958d0ce0 Merge "Implement new clock wait functions" 2019-07-15 23:19:57 +00:00
Elliott Hughes
8947972afd SSE4.1 is part of the Android x86/x86-64 ABI.
We shouldn't be treating this as a special variant.

Test: builds
Change-Id: I80722f941b5aefe34d777db329453cbedf249620
2019-07-15 10:17:16 -07:00
Tom Cherry
69010802d0 Implement new clock wait functions
pthread_cond_clockwait
pthread_mutex_clocklock
pthread_rwlock_clockrdlock
pthread_rwlock_clockwrlock
sem_clockwait

Bug: 35756266
Test: new unit tests
Change-Id: I71bd25eeec6476134b368d5bdf2f729d0bba595e
2019-07-15 09:06:19 -07:00
Elliott Hughes
c80af7f146 Merge "Explicitly add open/stat64 to the seccomp common whitelist." 2019-07-12 16:25:17 +00:00
Treehugger Robot
34d11e52af Merge "Avoid calling snprintf in bionic_trace_begin." 2019-07-11 23:39:38 +00:00
Elliott Hughes
33e079900d Explicitly add open/stat64 to the seccomp common whitelist.
They're used by 32-bit sanitizers. We used to get these for free (as the
comment says), but the place we got them from changed. Just be explicit.

Longer-term we should fix how we build the sanitizers to only use the
canonical system calls, like they already do for arm64.

Bug: https://issuetracker.google.com/136777266
Test: builds
Change-Id: If80a8d47aa345aaaa8bed32b44f020e06e504d49
2019-07-11 14:59:12 -07:00
Josh Gao
e1d121bef6 Avoid calling snprintf in bionic_trace_begin.
snprintf always calls free (on a null pointer) in its epilogue, which
results in infinite recursion if free calls a function that calls
bionic_trace_begin (e.g. when perfetto attempts to lock a mutex in
RecordFree).

Bug: http://b/137284735
Test: treehugger
Change-Id: I51c5b32e8f4e394be4602e06c7b94797df73c37b
2019-07-11 13:00:26 -07:00
Treehugger Robot
7d961a16e9 Merge "Remove unused dependency to libandoridicu" 2019-07-10 16:46:40 +00:00
dimitry
29fbf6fdd2 Remove unused dependency to libandoridicu
Test: mmma -j42 bionic/
Change-Id: I6049dbea5a55523758649370396a6a5bfb09462f
2019-07-10 15:50:29 +02:00
Christopher Ferris
78977053a7 Merge "Update to kernel headers v5.2." 2019-07-09 17:16:53 +00:00
Elliott Hughes
7d10422499 Merge "Stop using grep -P." 2019-07-09 15:30:07 +00:00
Christopher Ferris
f5019d85bd Merge "Do not check tcache clear when doing a purge." 2019-07-09 01:24:39 +00:00
Christopher Ferris
3d0bafb945 Do not check tcache clear when doing a purge.
On systems where the tcache is disabled, the tcache clear option will
fail, and not really do a purge.

Bug: 137037462
Bug: 136236080

Test: Built taimen as malloc svelte and verified the M_PURGE mallopt
Test: call failed before this fix and passes afterwards.
Change-Id: Ib30e5f3e083a9c6d046adff30f2aa7eacaf6df10
2019-07-08 15:15:01 -07:00
Elliott Hughes
165a8c6653 Stop using grep -P.
This might let us get to using toybox grep for the build faster than if
we have to implement PCRE support.

Test: builds
Change-Id: Idaf24cfefbf18fdc442871f24fe4fe9b2152359a
2019-07-08 15:03:19 -07:00
Christopher Ferris
aeddbcfb2c Update to kernel headers v5.2.
Test: Booted a taimen, ran unit bionic unit tests.
Change-Id: I3522c59793bbcef98ea515996a481d92f14b8816
2019-07-08 13:54:11 -07:00
Roland Levillain
7b85fb0d39 Merge "Use an APEX's linker configuration for any executable under its bin directory." 2019-07-03 10:51:02 +00:00
Roland Levillain
dc25f6c717 Use an APEX's linker configuration for any executable under its bin directory.
Previously, the linker configuration of an APEX would only be used for
executables located exactly in its `bin` directory. This change
relaxes this condition to also include executables located in any
directory under the APEX's `bin` directory.

This change is needed to support APEX binaries located in directories
under the APEX's `bin` directory that need to use the APEX's linker
configuration (e.g. ART gtests located in
`bin/art/{arm,arm64,x86,x86-64}` in the Testing Runtime APEX).

Test: Run ART gtests on device using the Testing Runtime APEX
Bug: 129534335
Change-Id: I0eac317eba856211a344fa00e66640aae10816ea
2019-07-02 16:58:02 +01:00
Christopher Ferris
afce4e897f Merge "Add doc describing native allocator." 2019-06-28 19:55:31 +00:00
Treehugger Robot
25f0e8ad2d Merge "ldd: slightly improve error message." 2019-06-28 17:37:26 +00:00
Christopher Ferris
4316d43f4d Add doc describing native allocator.
This includes tests that a native allocator has to pass, and the ways
to benchmark a native allocator on Android.

Test: NA
Change-Id: I5e1f4b3eea46ee2240e63a487ca3dfabecff81c0
2019-06-28 10:33:53 -07:00
Christopher Ferris
4c29be9a01 Merge "Fix usage of () and []." 2019-06-28 16:59:53 +00:00
Christopher Ferris
2671de2896 Fix usage of () and [].
The usage was reversed, [] is used for the name and () is used for the
link destination.

Test: NA
Change-Id: I07bf8645a888d5690d6c3d58edc3899b3e287df4
2019-06-27 20:42:38 -07:00
Elliott Hughes
3a1936c62e ldd: slightly improve error message.
Before:

  $ ldd toybox
  toybox: not an ELF file

After

  $ ldd toybox
  toybox: cannot open

I've also sent a toybox patch upstream to make that:

  $ ldd toybox
  toybox: cannot open: No such file or directory

Test: manual
Change-Id: If961cdf6f2f2f8d4f6cdfcade9061e49a09d1f01
2019-06-27 13:50:31 -07:00
Elliott Hughes
b2bd7c575e Merge "libnetd_client: support hooking sendto/sendmsg/sendmmsg too." 2019-06-24 15:04:25 +00:00
Treehugger Robot
05407d81f8 Merge "The time#clock test has been a bit flaky." 2019-06-21 08:06:28 +00:00
George Burgess IV
36bc922772 Merge changes I33957ad4,I02f8f87d,Iba04e486
* changes:
  fortify: replace bzero/bcmp defines
  fortify: add __mempcpy_chk
  fortify: fix overflow checks in unistd
2019-06-21 00:18:44 +00:00
Elliott Hughes
5ae1628455 The time#clock test has been a bit flaky.
Bump our expectation up to <5ms.

Test: treehugger
Change-Id: Ic1a704043efb55fc295482583fc7cc23d18cfbf4
2019-06-20 14:35:49 -07:00
George Burgess IV
261b7f4867 fortify: replace bzero/bcmp defines
__builtin_*_chk will emit warnings when things are trivially broken.
Emitting errors instead is probably better (and we can be a bit smarter
about how we emit code for trivially safe cases.)

Bug: 131861088
Test: checkbuild + bionic-unit-tests on blueline
Change-Id: I33957ad419922d0760304758ecb9bc8ad33e0b64
2019-06-20 13:05:23 -07:00
Christopher Ferris
b42a488512 Merge "Run pvalloc/valloc tests in unsupported envs." 2019-06-20 19:04:51 +00:00
George Burgess IV
3bdeae781f Merge changes I557309b3,If5f47e0e
* changes:
  fortify: add even more warnings
  fortify: fix up a few diagnostics; add __wur to realpath
2019-06-20 17:20:52 +00:00
Elliott Hughes
b8b79b75ef Merge "Remove the ___ hack." 2019-06-20 16:35:01 +00:00
Christopher Ferris
804cebe1c6 Run pvalloc/valloc tests in unsupported envs.
In order for cts to enumerate tests, even tests that are not supported
need to run and be skipped. Make this true for pvalloc/valloc
tests.

Change-Id: I863a179ee6810824a7117f44cc9aa3f86d01eb5b
Test: Ran tests in 32 bit and 64 bit and verified tests are skipped in
Test: 64 bit and run properly in 32 bit.
2019-06-20 08:57:07 -07:00
Elliott Hughes
5c6a3f9fbc libnetd_client: support hooking sendto/sendmsg/sendmmsg too.
Samsung has asked for this for KNOX.

Test: treehugger
Change-Id: Iffaace9f8cb265ce8c911472989c9829cbf91a42
2019-06-20 08:32:24 -07:00
Christopher Ferris
8fef03f609 Merge "Change pvalloc call to valloc in test." 2019-06-20 15:01:51 +00:00
Elliott Hughes
50080a29f7 Remove the ___ hack.
Plain __ for generated syscalls didn't mean it was a hidden symbol, it
just meant "please don't use this". We added ___ to signify that a
hidden symbol should be generated, but then we added the map files
anyway so you now have to explicitly export symbols. Given that, this
convention serves no particular purpose so we may as well just use the
nicer names have everything look the same.

Test: treehugger
Change-Id: If424e17a49c36f4be545f5d283c4561a6ea9c7ea
2019-06-19 15:38:42 -07:00
Christopher Ferris
d5ab0a5706 Change pvalloc call to valloc in test.
Found by kostyak, the call should have been valloc, not pvalloc.

Test: Ran unit tests on taimen.
Change-Id: I676b8f3f8051be6768e2ad87b579844560b4f619
2019-06-19 12:03:57 -07:00
Marco Nelissen
745137c827 Merge "Fix overflow check in malloc_limit" 2019-06-18 20:10:01 +00:00
George Burgess IV
1b297b9e5a Merge changes I80475ff4,I894aec99
* changes:
  fortify: add bit checking for open(at)?64 functions
  fortify: add diagnostics for str* functions
2019-06-18 17:58:08 +00:00
Marco Nelissen
323431bc27 Fix overflow check in malloc_limit
Bug: 135201859

Change-Id: I78dcc497cb100ab1d5f4144e2774437891719ca3
2019-06-18 10:15:28 -07:00
Treehugger Robot
5c0d6677ee Merge "Remove reference to obsolete script." 2019-06-18 16:12:19 +00:00