Commit graph

27843 commits

Author SHA1 Message Date
Treehugger Robot
fe88d26aca Merge "Typo fix in comment. O_CLOEXEC is e, not x." 2019-03-26 22:00:31 +00:00
Elliott Hughes
8ceb95c506 Fix running the tests on the host again.
Bug: N/A
Test: ran the tests on the host under glibc
Change-Id: Id05a896bdd11b231304ed1a08ef24e1a661ee20d
2019-03-26 14:47:08 -07:00
Dan Albert
ba1151c761 Typo fix in comment. O_CLOEXEC is e, not x.
Test: None
Bug: None
Change-Id: I061fe1d3cac6307d878155f1fabdba70da8e9fd5
2019-03-26 13:01:22 -07:00
Treehugger Robot
2059021322 Merge "docs: mention the fact that bionic now uses ifuncs." 2019-03-26 17:32:12 +00:00
Elliott Hughes
3770d93263 docs: mention the fact that bionic now uses ifuncs.
Bug: http://b/123296740
Test: N/A
Change-Id: I2cdc575270ebf32fd8ac1de21182150f5222cf9f
2019-03-26 08:52:07 -07:00
Treehugger Robot
b1ddbfdcdc Merge "Fix internal uses of _PATH_BSHELL." 2019-03-26 09:32:16 +00:00
Pirama Arumuga Nainar
ebe1ae7747 Reserve realtime signal for libprofile-extras
Bug: http://b/128524141

This signal is used by libprofile-extras to trigger flush of gcov
coverage data.

Test: libprofile-extras in system/extras/toolchain-extras
Change-Id: I77dd5b1d67371a9cfaad54ad60254bfb2dd18ba9
2019-03-25 22:09:19 -07:00
Treehugger Robot
1b6517b601 Merge "Make powerof2 macro ubsan safe" 2019-03-26 03:43:23 +00:00
Elliott Hughes
886370c240 Fix internal uses of _PATH_BSHELL.
We regressed on this recently: code under the upstream-* directories has
_PATH_BSHELL defined as a call to __bionic_get_shell_path(). In our own
code, we may as well just call it directly.

Bug: https://issuetracker.google.com/129030706
Test: ran tests
Change-Id: Ic2423f521272be95e67f94771772fe8072636ef0
2019-03-25 17:28:22 -07:00
Elliott Hughes
49e7b68ac2 Merge "popen: stop using _fwalk." 2019-03-25 23:48:47 +00:00
Nick Kralevich
c50b6a2b89 Make powerof2 macro ubsan safe
Subtracting one from the smallest value expressable by the provided
variable could cause an underflow operation. In particular, this is
problematic when code similar to:

  uint64_t foo = 0;
  if (powerof2(foo)) {
    ...;
  }

is run with integer sanitization enabled. The macro would subtract one
from zero, underflowing and triggering the sanitizer.

Make the powerof2() macro ubsan safe, by explicitly handling underflows.

Note: This change DOES NOT make powerof2() accurate. We continue to
falsely return "true" for 0 and negative numbers (see attached tests).

Found while investigating Bug: 122975762
Test: see added testcase
Test: atest ziparchive-tests

Change-Id: I5408ce5c18868d797bcae8f115ddb7c4c1ced81e
2019-03-25 13:51:33 -07:00
Elliott Hughes
137b6f36ef popen: stop using _fwalk.
We don't need this now that popen always uses O_CLOEXEC, and it's unsafe
because _fwalk takes a lock. (In <= P, the equivalent code walked the
list without a lock in the child.)

Bug: http://b/129156634
Test: ran tests
Change-Id: Ic9cee7eb59cfc9397f370d1dc47ea3d3326179ca
2019-03-25 11:18:36 -07:00
Treehugger Robot
e187d92062 Merge "Disable malloc_info test under HWASan." 2019-03-22 22:24:11 +00:00
Evgenii Stepanov
8de6b46ad8 Disable malloc_info test under HWASan.
HWASan does not implement malloc_info.

Test: bionic-unit-tests with SANITIZE_TARGET=hwaddress
Change-Id: I61d50d9110fbca1784ed39950ed6c5540ca0c9a7
2019-03-22 13:23:18 -07:00
Steven Moreland
118ab10d75 Merge "Add /product/bin to path" 2019-03-22 19:59:55 +00:00
Vic Yang
4848b6d7c3 Merge "Use std::move() for rvalue-reference setters and ctors" 2019-03-21 19:00:25 +00:00
Christopher Ferris
d992e1e9fa Merge "Update kernel headers to v5.0.3." 2019-03-21 18:34:35 +00:00
Neil Fuller
11f0d71836 Merge "Use the ANDROID_TZDATA_ROOT environment variable" 2019-03-21 17:43:45 +00:00
Christopher Ferris
e6be532ed6 Update kernel headers to v5.0.3.
Test: Build and boot taimen.
Change-Id: I6ed881b5dc6dc7d0a6cc56edcd09b42ddd185b62
Merged-In: I6ed881b5dc6dc7d0a6cc56edcd09b42ddd185b62
2019-03-21 15:31:06 +00:00
Vic Yang
6b330ac55d Merge "linker: Add support for "whitelisted" property in linker config files" 2019-03-21 04:30:47 +00:00
Logan Chien
e6b6640042 Merge changes Ie7bf555b,Ia7d5fbdc,I3f05ba19
* changes:
  Add introduced-in annotation to fdsan
  Fix get_device_api_level_inlines.h in versioner
  Suppress warnings on pthread_create
2019-03-21 01:50:30 +00:00
Elliott Hughes
4486e57c7d Merge "Document various libc behavior changes." 2019-03-21 00:46:51 +00:00
Elliott Hughes
b282a6d4d3 Document various libc behavior changes.
Test: N/A
Change-Id: I3044c394180058ba500762239b16a4c740caca44
2019-03-20 11:23:53 -07:00
Haibo Huang
b2a29cb95b Merge "Remove workaround for x86 ifunc" 2019-03-20 17:41:43 +00:00
Vic Yang
976d4b4634 Use std::move() for rvalue-reference setters and ctors
Also update an rvalue reference to lvalue reference where it's
unnecessary to make it clearer.

Test: Build and boot cuttlefish.
Change-Id: Ib799666ab075523e6446f34c7da2b1eb311f98ab
2019-03-20 10:20:49 -07:00
Vic Yang
2d020e43fb linker: Add support for "whitelisted" property in linker config files
In order to enable no-vendor-variant VNDK, we need a way to restrict a
namespace to only a list of whitelisted libraries.  We add a new
"whitelisted" property for this.  If the property is not set, all
libraries in the search paths are available in a namespace.  If the
property is set, only the libraries named are available.

Bug: 119423884
Test: Boot with no-vendor-variant VNDK enabled using the new property.
Change-Id: Id808c1733c8e2c2c3462b04c72461f9698403571
2019-03-20 10:20:49 -07:00
Logan Chien
c9e70181ad Add introduced-in annotation to fdsan
This commit adds missing INTRODUCTED_IN(29) annotations to fdsan.h.

Note: This is not revealed until recently because API level 29 is added
in Mar 14 and the prebuilt binary for versioner hasn't been updated.

Test: ./bionic/tools/versioner/run_tests.py
Change-Id: Ie7bf555bb47c97d15f0c5fa36a76bc6cd64e206b
2019-03-20 22:52:34 +08:00
Logan Chien
73d1fb9579 Fix get_device_api_level_inlines.h in versioner
This commit fixes an inline and non-inline mismatch error caused by
`get_device_api_level_inlines.h`.

Versioner includes both `android/api-level.h` and
`bits/get_device_api_level_inlines.h` in the test.  When __ANDROID_API__
is greater than or equal to __ANDROID_API_Q__, `android/api-level.h`
declares a non-inline `android_get_device_api_level()`.  On the
contrary, `bits/get_device_api_level_inlines.h` defines a static inline
`android_get_device_api_level()` function.  These conflicting
declarations result in compilation error.

This commit fixes the problem by guarding full
`get_device_api_level_inline.h` with
`#if defined(__BIONIC_GET_DEVICE_API_LEVEL_INLINE)` so that
`get_device_api_level_inline.h` can be no-op when it is not properly
included.

Note: This is not revealed until recently because API level 29 is added
in Mar 14 and the prebuilt binary for versioner hasn't been updated.

Test: ./bionic/tools/versioner/run_tests.py
Change-Id: Ia7d5fbdcaf3d98787e60780f6cff2a24016324f5
2019-03-20 22:49:38 +08:00
Logan Chien
3f68efc9b1 Suppress warnings on pthread_create
This commit suppress warnings on pthread_create because clang-r353983
would check the function declaration against the built-in function
defined in llvm/tools/clang/include/clang/Basic/Builtins.def and find a
mismatch.

Note: This is only found by versioner because these files are not system
headers from the perspective of versioner.  This warning is ignored in
normal builds because bionic headers are system headers in normal
builds.

Bug: 126457671
Test: lunch walleye-userdebug && make
Change-Id: I3f05ba19861f1b9db55c7c55c4496a845802e831
2019-03-20 22:49:03 +08:00
Haibo Huang
021d522471 Remove workaround for x86 ifunc
Test: bionic unit test
Change-Id: I539a42b01fac705aa342a8d1d79d3607c06fef68
2019-03-20 05:37:41 +00:00
Peter Collingbourne
ebdf4c19f9 Merge "Call __hwasan_init_static() during libc startup in statically linked executables." 2019-03-20 05:00:57 +00:00
Peter Collingbourne
d75e308e61 Call __hwasan_init_static() during libc startup in statically linked executables.
__hwasan_init() was segfaulting when called from here because it
was calling into libc functions which required more of libc to be
initialized. Instead, call __hwasan_init_static(), which does a
minimal amount of initialization for statically linked executables,
just enough that we can run instrumented code. __hwasan_init() itself
will end up being called later (most likely from a global ctor)
after libc is fully initialized.

We'll need to wait for LLVM r352816+r352823 to land in our toolchain
before landing this.

Change-Id: I12ffc7e08f6dd161e4ff2088f8d56265af7baedf
2019-03-19 21:56:17 -07:00
Evgenii Stepanov
8b8e7d0461 Merge "Annotate vfork for hwasan." 2019-03-20 02:53:39 +00:00
Evgenii Stepanov
505168e530 Annotate vfork for hwasan.
Call a hwasan hook in the parent return path for vfork() to let hwasan
update its shadow. See https://github.com/google/sanitizers/issues/925
for more details.

Bug: 112438058
Test: bionic-unit-tests
Change-Id: I9a06800962913e822bd66e072012d0a2c5be453d
2019-03-19 23:36:44 +00:00
Peter Collingbourne
b62888b709 Merge "Increase the size of the shadow call stack guard region to 16MB." 2019-03-19 23:29:05 +00:00
Christopher Ferris
4a8b288704 Merge "Increase num tries before failing." 2019-03-19 15:27:52 +00:00
Martin Stjernholm
60916654cc Merge "Add more linker debug." 2019-03-19 14:08:10 +00:00
Martin Stjernholm
95252eedf3 Add more linker debug.
- Show which executable is being linked, which linker config file is
  being read, and which section in it is being used with, enabled on
  $LD_DEBUG>=1.

- Show more info to follow the dlopen() process, enabled with "dlopen"
  in the debug.ld.xxx property.

Test: Flash, boot, and look at logcat after "adb shell setprop debug.ld.all dlopen"
Bug: 120430775
Change-Id: I5441c8ced26ec0e2f04620c3d2a1ae860b792154
2019-03-19 14:03:18 +00:00
Christopher Ferris
9b78aa3529 Increase num tries before failing.
Bug: 128872105

Test: Ran the android_mallopt.set_allocation_limit_multiple_threads test
Test: a thousand times on taimen.
Change-Id: I67a474c53cd6eda8106feac99aee8e7b0bee1254
2019-03-18 21:45:36 -07:00
Treehugger Robot
f3df0dae0b Merge "Add missing #include." 2019-03-16 06:56:14 +00:00
Peter Collingbourne
149ce93056 Add missing #include.
Fixes sanitizer build.

Test: walleye_hwasan-userdebug builds
Change-Id: If7890dbf2e715ca89b68f5c39c6ffbd24f15f2c2
2019-03-15 22:45:06 -07:00
Peter Collingbourne
9d69d4ccae Merge "Add a platform API for setting an allocation limit." 2019-03-15 21:51:46 +00:00
Elliott Hughes
ea6c19a44b Merge "Remove __INTRODUCED_IN_FUTURE." 2019-03-15 19:54:57 +00:00
Christopher Ferris
1fc5ccfe76 Add a platform API for setting an allocation limit.
Introduce an M_SET_ALLOCATION_LIMIT enumerator for android_mallopt(),
which can be used to set an upper bound on the total size of all
allocations made using the memory allocation APIs.

This is useful for programs such as audioextractor and mediaserver
which need to set such a limit as a security mitigation. Currently
these programs are using setrlimit(RLIMIT_AS) which isn't exactly
what these programs want to control. RLIMIT_AS is also problematic
under sanitizers which allocate large amounts of address space as
shadow memory, and is especially problematic under shadow call stack,
which requires 16MB of address space per thread.

Add new unit tests for bionic.

Add new unit tests for malloc debug that verify that when the limit
is enabled, malloc debug still functions for nearly every allocation
function.

Bug: 118642754
Test: Ran bionic-unit-tests/bionic-unit-tests-static.
Test: Ran malloc debug tests and perfetto integration tests.
Change-Id: I735403c4d2c87f00fb2cdef81d00af0af446b2bb
2019-03-15 10:54:55 -07:00
Jiyong Park
ac74615c1c Merge "Clean /bionic" 2019-03-15 16:41:13 +00:00
Jiyong Park
80c5e623f7 Clean /bionic
The path has gone

Test: m
Change-Id: Iecbde545f84357706da55e4fdb7b421433f945d0
2019-03-16 01:27:07 +09:00
Treehugger Robot
412d49349e Merge "Don't install *.mountpoint targets" 2019-03-15 09:02:18 +00:00
Treehugger Robot
4c95542fdf Merge "Reduce reserved size for DlExtTest.ReservedRecursiveTooSmall test" 2019-03-15 02:49:15 +00:00
Yi Kong
1e7a150339 Reduce reserved size for DlExtTest.ReservedRecursiveTooSmall test
When built with clang-r353983, the ReservedRecursiveTooSmall test fail
due to the reserved memory is now large enough for android_dlopen_ext.
Reduce the reserved memory size to agree with ReservedTooSmall test.

Test: bionic-unit-tests
Bug: 126457671
Change-Id: I3e311a3f35b0de5d028fa1b9b3681d5ec32faee8
2019-03-14 16:25:45 -07:00
Elliott Hughes
5270017ab3 Remove __INTRODUCED_IN_FUTURE.
This hasn't been particularly useful, we haven't used it consistently,
and it has caused trouble.

Test: builds
Change-Id: Ic5b5b5124af98aa8301e602fd75b0eb72a5fc7f6
2019-03-14 13:34:21 -07:00