Commit graph

20269 commits

Author SHA1 Message Date
Paul Lawrence
6a6d669bfc Expand whitelist
Bug: 36449658
Test: Builds
Change-Id: I610da03e7a3cede218d1657f53797ab72cbdf317
2017-03-23 12:21:29 -07:00
Treehugger Robot
4d099d1576 Merge "Fix problem that we don't block syscalls below min value" 2017-03-22 19:33:08 +00:00
Paul Lawrence
65b47c9fe0 Fix problem that we don't block syscalls below min value
The check that we are not below the lowest permitted syscall was
off by one, so we always allowed them, rather than always denying
them

Test: Check arm64 boots, chrome and maps work
      mips and mips64 emulators boot
      Note that arm, x86 and x86_64 already allow syscall 0 so there
      will be no functional change there

Change-Id: I85873f1d04124e634e648bd47c027f280f1d6dbd
2017-03-22 09:48:17 -07:00
Joachim Sauer
341bb25a19 Merge "Update timezone data to 2017b" 2017-03-22 13:11:46 +00:00
Treehugger Robot
5153938e9a Merge "Add systrace output for dlclose/dlsym calls" 2017-03-21 22:06:09 +00:00
Treehugger Robot
8ebfc0d3a3 Merge "POSIX support varies by API level." 2017-03-21 20:11:37 +00:00
Elliott Hughes
72b6f4fae2 Merge "pthread barrier and spinlock types should only appear at API level 24." 2017-03-21 19:14:05 +00:00
Elliott Hughes
06d7f2c789 POSIX support varies by API level.
Bug: https://github.com/android-ndk/ndk/issues/332
Test: builds
Change-Id: I249c214d34244a1149ba6b1160e8eafc2cdbcdea
2017-03-21 11:24:13 -07:00
Dimitry Ivanov
6705e8caf5 Add systrace output for dlclose/dlsym calls
Bug: http://b/27195126
Test: manual: adb shell atrace -t 5 bionic
      and run bionic-unit-tests --gtest_filter=dl*

Change-Id: I9e93a069dd440bb643890d9952913938442ac375
2017-03-21 10:38:23 -07:00
Elliott Hughes
468a5d2d83 pthread barrier and spinlock types should only appear at API level 24.
Bug: https://github.com/android-ndk/ndk/issues/336
Test: builds
Change-Id: I938d9d7ea879d1dbc355f14e100f1ea31a51a1f0
2017-03-21 09:55:32 -07:00
Joachim Sauer
45348f06a0 Update timezone data to 2017b
IANA changes:

  Briefly: Haiti has resumed DST.

  Changes to past and future time stamps

    Haiti resumed observance of DST in 2017.  (Thanks to Steffen Thorsen.)

  Changes to past time stamps

    Liberia changed from -004430 to +00 on 1972-01-07, not 1972-05-01.

    Use "MMT" to abbreviate Liberia's time zone before 1972, as "-004430"
    is one byte over the POSIX limit.  (Problem reported by Derick Rethans.)

Bug: 36470257
Test: CtsLibcoreTestCases / CtsBionicTestCases
Change-Id: I5a8ffb60232410d88ffa67c7702dd234ff05f61d
2017-03-21 15:37:37 +00:00
Dimitry Ivanov
e98d1e68ce Merge changes Ib2bad794,I82436292
* changes:
  Add systrace output for dlopen calls
  Add end() method to bionic's ScopedTrace class
2017-03-20 22:34:37 +00:00
Treehugger Robot
e36fb9ed9e Merge "Only rename mmap to mmap64 if we're L or newer." 2017-03-20 21:53:41 +00:00
Dimitry Ivanov
5c4a58072f Add systrace output for dlopen calls
Bug: http://b/27195126
Test: manual: adb shell atrace -t 5 bionic
      and run bionic-unit-tests --gtest_filter=dl*:Dl*

Change-Id: Ib2bad794e571b89bd1f52c9e0de642c2092e5c21
2017-03-20 13:34:52 -07:00
Elliott Hughes
8bd97b007e Merge "Only rename fgetpos/fsetpos/fseeko/ftello/funopen if we're N or newer." 2017-03-20 20:01:16 +00:00
Elliott Hughes
f12d719b01 Merge "Only rename sendfile to sendfile64 if we're L or newer." 2017-03-20 20:01:07 +00:00
Dan Albert
785b249df0 Only rename mmap to mmap64 if we're L or newer.
Without this, setting `__USE_FILE_OFFSET64` and targeting pre-L made
mmap entirely unavailable.

Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/332
Change-Id: I9f61c44f8d9ab5c7cae845c9f89a7d889c6df365
2017-03-20 12:57:13 -07:00
Treehugger Robot
b43a222ee7 Merge "Expand whitelist" 2017-03-20 19:52:13 +00:00
Dimitry Ivanov
2a4a5e72f1 Add end() method to bionic's ScopedTrace class
Bug: http://b/27195126
Test: make
Change-Id: I8243629200606ca87b11cbd479ca093add42eb56
2017-03-20 12:45:55 -07:00
Paul Lawrence
822ecece23 Expand whitelist
Bug: 36435222
Test: App starts, plays game
Change-Id: If21f59e4d218be64fdac46115d35dc1ffb6fe771
2017-03-20 11:03:19 -07:00
Elliott Hughes
79a3db0304 Only rename fgetpos/fsetpos/fseeko/ftello/funopen if we're N or newer.
Without this, setting __FILE_OFFSET_BITS to 64 and targeting pre-L
made these functions entirely unavailable.

Bug: https://github.com/android-ndk/ndk/issues/333
Test: builds
Change-Id: Id17ae3c070f8b2650a9bc9aa2aa2e92c5fcdf4ad
2017-03-17 18:56:08 -07:00
Elliott Hughes
3645e71a43 Only rename sendfile to sendfile64 if we're L or newer.
Without this, setting __FILE_OFFSET_BITS to 64 and targeting pre-L
made sendfile entirely unavailable.

Bug: https://github.com/android-ndk/ndk/issues/333
Test: builds
Change-Id: I82d326ff244473dd5443632ff6c19d726d5e29ee
2017-03-17 18:50:12 -07:00
Treehugger Robot
9cb82a2c6b Merge "Add libc optimizations to bionic for MIPS" 2017-03-17 15:29:14 +00:00
Treehugger Robot
e0561cb0c9 Merge "Use libbase for realpath and dirname" 2017-03-16 20:36:57 +00:00
Dimitry Ivanov
5b2cd3a358 Use libbase for realpath and dirname
Test: run bionic-unit-tests
Bug: http://b/31396973
Change-Id: Ie8dc60348b9c57892a77be6a24dadb42241f6b62
2017-03-16 11:47:08 -07:00
Prashant Patil
fcb877ac4b Add libc optimizations to bionic for MIPS
Test: Used bionic tests available under bionic/tests folder.
      Tested for mips32r1/mips32r2/mips64r6 on emulators.

Change-Id: I589415ddc496df3f6067ae34cb33ca58b3a1f276
Signed-off-by: Prashant Patil <prashant.patil@imgtec.com>
2017-03-16 10:26:24 -07:00
Josh Gao
b2882dd429 Merge "Split up the stack space tests into their own noinline functions." 2017-03-16 06:44:59 +00:00
Josh Gao
61db9ac8da Split up the stack space tests into their own noinline functions.
Prevent the compiler from being too smart and allocating a stack buffer
at the beginning of a function.

Bug: http://b/36206043
Test: 32/64-bit dynamic tests pass, static ones still don't
Change-Id: I90c575be43a9dd6c4fefc0d8b514f1ae0405b994
2017-03-15 19:53:17 -07:00
Treehugger Robot
2390f83da4 Merge "Enable ld-android on linux_bionic builds" 2017-03-15 23:18:18 +00:00
Treehugger Robot
a4db9d6f41 Merge "Add tests for pthread TLS leak." 2017-03-15 22:09:27 +00:00
Dan Willemsen
8229596d41 Enable ld-android on linux_bionic builds
Bug: 31559095
Test: Enable host bionic, run soong
Change-Id: If94927c66c0c2dc74c213ca403d45e73508b0025
2017-03-15 14:24:40 -07:00
Josh Gao
7d15dc388a Add tests for pthread TLS leak.
Add tests that ensure that threads don't leak memory mappings after
they exit.

Bug: http://b/36045112
Test: /data/nativetest/bionic-unit-tests/bionic-unit-tests --gtest_filter=*leak*
Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_filter=*leak*
Change-Id: Id0c1194b5d2bb7d89947b1ade16eb0d768d8c5b7
2017-03-15 13:30:05 -07:00
Treehugger Robot
616b2d87ea Merge "Extract format_string function." 2017-03-14 00:58:16 +00:00
Treehugger Robot
e5422d7d1f Merge "linker: add more directories to default lib paths" 2017-03-14 00:15:50 +00:00
Dimitry Ivanov
2a6d9b2543 Extract format_string function.
Extract format_string function and add a test.

Test: run linker-unit-tests
Change-Id: I794a29aaf62e184438ce1a9224b88aa0586c17b5
2017-03-13 16:25:51 -07:00
Treehugger Robot
b1fe870a36 Merge "Support all architectures in seccomp" 2017-03-13 20:10:49 +00:00
Treehugger Robot
b3473f20db Merge "Apply ASan linker path translation to subdirectories." 2017-03-13 18:37:30 +00:00
Paul Lawrence
89fa81fda3 Support all architectures in seccomp
Test: Make sure arm, x86, x86_64, mips, mips64 emulators boot
      Make sure sailfish still boots
      Ran CTS test from
      https://android-review.googlesource.com/#/c/348671/3 and it passed
      The instructions for how to run mips emulators above worked, but
      the CTS tests did not seem to actually run.

Change-Id: Iddee5acdb19ed32c7bd4657573313ca439cf6a49
2017-03-13 18:26:50 +00:00
Christopher Ferris
c0f275d028 Merge "Fix the way malloc debug returns info." 2017-03-13 17:47:32 +00:00
Evgenii Stepanov
5b71500301 Apply ASan linker path translation to subdirectories.
Specifically, this change would translate /system/lib/hw/foo.so to /data/lib/hw/foo.so.

Bug: 30320104
Test: in SANITIZE_TARGET=address build, /proc/$PID/maps for
  system_server show libraries from /data/lib64/hw and not from
  /system/lib64/hw.
Change-Id: Ia1fa22fa1ca088fe76e41308762efe037541fc74
2017-03-13 10:04:36 -07:00
Jiyong Park
1daa18e737 linker: add more directories to default lib paths
Due to b/33681361, libraries are now installed to different paths than
before. In order for linker to load libraries from the new paths, the
default lib paths are updated.

However, this patch is temporary; different paths must be used depending
on whether the process is executing vendor executable or framework
executable. For example, vendor executable should not be able to access
/system/lib/, which is for framework-internal libs. Similarly,
framework executables should not be able to access /vendor/lib.

We have several solutions (linker namespace and DT_RUNPATH) to support
the scenario, but haven't concluded which is better. Furthermore, if we
restrict the search path right now, it will break many parts of Android
that are not yet prepared for the restriction. So, until then, we
temporarily use the single search path for both framework/vendor
executables.

Test: build & run
Change-Id: I806e9b4379bce96653b1dd3354b9f4801abb0411
2017-03-13 08:55:23 +09:00
Josh Gao
cf96f35dd1 Merge changes from topic 'debuggerd_fallback'
* changes:
  linker_memory: allow fallback allocator to be turned on and off.
  Increase signal stack size on 32-bit to 16kB.
2017-03-09 22:03:31 +00:00
Christopher Ferris
426b00a29b Fix the way malloc debug returns info.
When I rewrote malloc debug, I accidentally thought that each
value returned in the info buffer contained the number of backtrace
frames in the backtrace. This was incorrect, it should have been
the total number of allocations with the same backtrace.

This is a temporary fix that sets that value to 1. The better fix is
to de-dupe backtraces and then return all allocations of the same size
with the same backtrace.

I updated the documents to describe this.

Bug: 31854476

Test: Unit tests pass.
Change-Id: Idf9efaa3d363923b5d7543d90dc7c65a0ed553d9
2017-03-09 13:47:37 -08:00
Treehugger Robot
b3b11edda1 Merge "Prefer property_contexts from /system & /vendor" 2017-03-09 19:20:55 +00:00
Josh Gao
222272ece9 linker_memory: allow fallback allocator to be turned on and off.
Let the fallback allocator be used on multiple threads (as long as only
one thread is using it at once).

Bug: http://b/35858739
Change-Id: Id3e2fc6b7c093c6e56870524ffda28946de09e29
2017-03-08 16:43:59 -08:00
Josh Gao
415daa8cca Increase signal stack size on 32-bit to 16kB.
snprintf to a buffer of length PATH_MAX consumes about 7kB of stack.

Bug: http://b/35858739
Test: bionic-unit-tests --gtest_filter="*big_enough*"
Change-Id: I34a7f42c1fd2582ca0d0a9b7e7a5290bc1cc19b1
2017-03-08 16:43:59 -08:00
Alex Klyubin
176cf1f65b Prefer property_contexts from /system & /vendor
This changes system_properties' initialize_properties to prefer
loading property_contexts from /system/etc/selinux &
/vendor/etc/selinux, while falling back to the pre-existing behavior
of loading from /.

Test: Device with *_property_contexts in / boots up fine, no denials
      to do with properties, getprop -Z lists correct labels.
Test: Device with *_property_contexts in /system & /vendor, but not
      in /, boots up fine, no denials to do with properties,
      getprop -Z lists correct labels.
Test: Device with *_property_contexts in /system & vendor and with
      empty *_property_contexts in / boots up fine, no denials to do
      with properties, getprop -Z lists correct labels.
Bug: 36002573

Change-Id: I15174acdf89ee8f5a96acf1e38a54d4214df51ef
2017-03-08 15:28:29 -08:00
Treehugger Robot
77258163a2 Merge "Fix leak of bionic TLS when threads are detached." 2017-03-08 23:13:14 +00:00
Joachim Sauer
e429bf2f69 Merge "Update timezone data to 2017a" 2017-03-08 11:53:22 +00:00
Josh Gao
5450f86b31 Fix leak of bionic TLS when threads are detached.
__pthread_internal_free doesn't happen on threads that are detached,
causing the bionic TLS allocation (and guard pages) to be leaked.

Fix the leak, and name the allocations to make things apparent if this
ever happens again.

Bug: http://b/36045112
Test: manually ran a program that detached empty threads
Change-Id: Id1c7852b7384474244f7bf5a0f7da54ff962e0a1
2017-03-07 23:24:50 -08:00