Commit graph

25295 commits

Author SHA1 Message Date
Pirama Arumuga Nainar
1395f70f6c Add missed shared library dependency to bionic-unit-tests
Test: N/A

Change-Id: I7b6cf631208a01f788760595f927aba669901350
2018-03-28 15:27:47 -07:00
Christopher Ferris
85f0542544 Merge "Use the ion.h from the kernel headers." 2018-03-28 19:18:52 +00:00
Treehugger Robot
8e3b6f45b1 Merge "Revert system seccomp filter changes" 2018-03-28 04:45:32 +00:00
Treehugger Robot
daa2a32894 Merge "Add missing shared library dependencies to bionic-unit-tests" 2018-03-27 23:30:31 +00:00
Victor Hsieh
040c28a023 Revert system seccomp filter changes
521b41 "Allow system processes to use vfork"
ed74ab "Move some syscalls in commmon whitelist to app"

An implementation bug actually assigns the system seccomp filter to all
processes after zygote forks.

Test: the apps in the bug no longer crashes.
Bug: 76461821
2018-03-27 13:43:24 -07:00
Pirama Arumuga Nainar
c53e8b88d5 Add missing shared library dependencies to bionic-unit-tests
Test: 'make tests dist' and verify that these libraries are in the
*-continuous_native_tests-*.zip

Change-Id: I2bd2ba9b44400804a125a8bc8ec49d84270d6361
2018-03-27 10:34:07 -07:00
Treehugger Robot
3bddbbe844 Merge "Fix an ifdef in a test" 2018-03-27 16:55:38 +00:00
George Burgess IV
e9c0e828de Fix an ifdef in a test
We don't support GCC here anymore. More importantly: `#ifdef foo &&
bar` is apparently parsed as `#ifdef foo` with extra tokens at the end.
Oops.

Bug: None
Test: Treehugger
Change-Id: I63d09b0fbad688d3b68a3327a52b3bb55627272f
2018-03-26 18:03:16 -07:00
Tom Cherry
60fd72e8a3 Merge "Create PTHREAD_COND_INITIALIZER_MONOTONIC_NP" 2018-03-26 23:15:11 +00:00
Elliott Hughes
8bd8121204 Merge "Reject .so files using ELF TLS." 2018-03-26 18:07:09 +00:00
Tom Cherry
f0f3d2f002 Create PTHREAD_COND_INITIALIZER_MONOTONIC_NP
Needed for std::condition_variable to wait on CLOCK_MONOTONIC.

Test: boot bullhead
Change-Id: I32a30817f0ec2190393fcc6faec45b40822cba32
2018-03-26 09:00:51 -07:00
Elliott Hughes
9724e93c19 Reject .so files using ELF TLS.
Bug: http://b/74361956
Test: ran tests
Change-Id: I53e71252eb08c607c2c436dcba433374c8c53887
2018-03-23 18:46:07 -07:00
Treehugger Robot
4d33928708 Merge "Exit gracefully on invalid --gtest_* flag." 2018-03-23 19:20:29 +00:00
Tao Bao
9932789996 Exit gracefully on invalid --gtest_* flag.
My gtest run crashed when I provided wrong flag (e.g. --gtest_list),
because it tried to call std::vector::back() on empty testcase_list.

Test: /data/nativetest/bionic-unit-tests/bionic-unit-tests works.
Test: `/d/n/b/bionic-unit-tests --gtest_invalid` dumps the gtest help
      message.
Change-Id: I5f63c7fa6476d8749248c9b54d3023446f3e0e77
2018-03-23 09:40:21 -07:00
Elliott Hughes
90234e5748 Merge "Fortify ppoll64." 2018-03-22 23:49:40 +00:00
Elliott Hughes
b83bf14a35 Fortify ppoll64.
I've deliberately not bothered with the GCC implementation because we'll
have removed GCC from the NDK before anyone gets to use this.

Bug: http://b/72493232
Test: ran tests
Change-Id: Icfc2a3b214739ab53aa41bacacc11b5c67498fb4
2018-03-22 13:59:02 -07:00
Treehugger Robot
1315e3ef85 Merge "libc: silence unsigned->signed warnings with ioctl" 2018-03-22 02:06:34 +00:00
Elliott Hughes
1423bb8498 Merge "timer_create: use SIG_SETMASK restore the signal mask." 2018-03-21 17:01:41 +00:00
Tom Cherry
861ff85a19 Merge "Add _monotonic_np versions of timed wait functions" 2018-03-21 15:29:02 +00:00
Treehugger Robot
b80b9955b9 Merge "Enable EDNS and the DO-bit if the netcontext asks" 2018-03-21 03:02:51 +00:00
Tom Cherry
c6b5bcd182 Add _monotonic_np versions of timed wait functions
As a follow up to Ibba98f5d88be1c306d14e9b9366302ecbef6d534, where we
added a work around to convert the CLOCK_REALTIME timeouts to
CLOCK_MONOTONIC for pthread and semaphore timed wait functions, we're
introducing a set of _monotonic_np versions of each of these functions
that wait on CLOCK_MONOTONIC directly.

The primary motivation here is that while the above work around helps
for 3rd party code, it creates a dilemma when implementing new code
that would use these functions: either one implements code with these
functions knowing there is a race condition possible or one avoids
these functions and reinvent their own waiting/signaling mechanisms.
Neither are satisfactory, so we create a third option to use these
Android specific _monotonic_np functions that completely remove the
race condition while keeping the rest of the interface.

Specifically this adds the below functions:
pthread_mutex_timedlock_monotonic_np()
pthread_cond_timedwait_monotonic_np()
pthread_rwlock_timedrdlock_monotonic_np()
pthread_rwlock_timedwrlock_monotonic_np()
sem_timedwait_monotonic_np()

Note that pthread_cond_timedwait_monotonic_np() previously existed and
was removed since it's possible to initialize a condition variable to
use CLOCK_MONOTONIC.  It is added back for a mix of reasons,
1) Symmetry with the rest of the functions we're adding
2) libc++ cannot easily take advantage of the new initializer, but
   will be able to use this function in order to wait on
   std::steady_clock
3) Frankly, it's a better API to specify the clock in the waiter function
   than to specify the clock when the condition variable is
   initialized.

Bug: 73951740
Test: new unit tests
Change-Id: I23aa5c204e36a194237d41e064c5c8ccaa4204e3
2018-03-20 18:41:22 -07:00
Ben Schwartz
e7190ce3f2 Enable EDNS and the DO-bit if the netcontext asks
This effectively enables these features only in TLS mode
Test: Integration tests pass
Bug:69623036

Change-Id: I153a259b0c07717f664ee268b43da867a9b42152
2018-03-21 01:01:29 +00:00
Elliott Hughes
48a69742fe timer_create: use SIG_SETMASK restore the signal mask.
Bug: http://b/73144101
Test: ran tests
Change-Id: I9adf3a512c120ef2280ad469ad11366222d61463
2018-03-20 17:58:11 -07:00
George Burgess IV
de45dcbbab libc: silence unsigned->signed warnings with ioctl
This also tweaks cdefs to make __overloadable usable outside of
FORTIFY. It had to be FORTIFY-only before we had unmarked overload
support in clang+Bionic.

Bug: https://github.com/android-ndk/ndk/issues/402
Test: Internal master builds + `mma`. `mma` in Bionic fails if the
change to ioctl is undone.

Change-Id: Ib386b1786e1dca625e6d5a18682005adc734d9c1
2018-03-20 15:59:46 -07:00
Treehugger Robot
0bc4772ee5 Merge "Remove -Wno-uninitialized from libm Android.bp." 2018-03-16 20:17:38 +00:00
Treehugger Robot
7ba06d85f2 Merge "Remove -Wno-uninitialized for libc." 2018-03-16 20:17:34 +00:00
Narayan Kamath
5e3eb0d4e4 Merge "bionic_fortify: clarify error message for an out of bounds FD." 2018-03-16 10:09:38 +00:00
Yabin Cui
41328eb827 Merge "Check using destroyed mutexes." 2018-03-16 00:15:14 +00:00
Elliott Hughes
0b66dd4413 Remove -Wno-uninitialized for libc.
Bug: N/A
Test: builds
Change-Id: I79e66374b4eeba671705fdc7728f19f3a5c1fa64
2018-03-15 14:17:55 -07:00
Elliott Hughes
589592cb7c Remove -Wno-uninitialized from libm Android.bp.
We can turn on -Wall too, if we turn off const-unused-variable and
unused-variable.

Bug: N/A
Test: builds
Change-Id: I8d889ea0acd334fbacbf7e707bcc2d0be633e4d5
2018-03-15 13:52:22 -07:00
Yabin Cui
9651fdf93a Check using destroyed mutexes.
For apps built for Android < P, return EBUSY.
For apps built for Android >= P, abort.

This is to keep old apps work, and help debugging
apps built for >= P.

Bug: http://b/74632097
Test: run bionic-unit-tests.
Test: run bionic-benchmark.

Change-Id: I5271565a1a6ad12678f85d558a7f862a2b7aab4b
2018-03-15 10:44:30 -07:00
Victor Khimenko
9d641d5186 Merge "Mark getaddrinfo functions with __BIONIC_WEAK_FOR_NATIVE_BRIDGE mark" 2018-03-14 23:21:33 +00:00
Victor Khimenko
5956847acc Mark getaddrinfo functions with __BIONIC_WEAK_FOR_NATIVE_BRIDGE mark
System libc talks to out-of-process daemon thus it's better to not
duplicate that functionality in native bridge.

Bug: 67993967

Test: make

Change-Id: Iabc887a94082806d048bc98bf8d3b21c7531d60d
2018-03-14 17:42:15 +01:00
Narayan Kamath
38e960b7aa bionic_fortify: clarify error message for an out of bounds FD.
It seems clearer to include FD_SETSIZE in the message. set_size
is sizeof(fd_set) so there's an extra mental hoop to jump if that's
in the error message.

Test: make
Change-Id: I5cdb62465b658ac0eaeccbfb826d135820cf613a
2018-03-14 12:37:25 +00:00
Treehugger Robot
35e620cf98 Merge "Lay the groundwork for enabling EDNS0 in queries." 2018-03-13 20:48:34 +00:00
Treehugger Robot
6655ba1c32 Merge "Add flags field to struct android_net_context" 2018-03-13 02:06:39 +00:00
Erik Kline
391143e51b Add flags field to struct android_net_context
This is for passing additional instructions through stages of the
DNS resolution pipeling.

Test: as follows
    - builds, flashes, boots
    - system/netd/tests/runtests.sh passes
Bug: 34953048
Bug: 70694619
Bug: 72345192
Change-Id: I5a86cc5192e6cfa09c375ac9f5810102da3aba20
2018-03-12 16:34:56 +09:00
Treehugger Robot
860d27bd88 Merge "Allow system processes to use vfork" 2018-03-09 22:14:46 +00:00
Victor Hsieh
521b412aa1 Allow system processes to use vfork
java.lang.ProcessBuilder is internally using vfork in the current
configuration (see UNIXProcess_md.c in libcore).

Test: On an x86 Chromebook, trigger dropbox error event (1. settings
      put global logcat_for_system_app_anr 50; 2. kill -19 `pidof
      com.android.settings'; touch Settings).  Saw seccomp error in
      logcat but only without this fix.
Test: fyi, not reproducible on walleye (arm64)
Bug: 74441404

Change-Id: I1f40ae0fe0607c5834ecbe040ed31c4c0e42131d
2018-03-09 11:52:32 -08:00
Elliott Hughes
398c5ee6fc Merge "Call __fortify_fatal if printf sees %n." 2018-03-09 18:23:38 +00:00
Elliott Hughes
435e669776 Merge "Rewrite system(3) to use posix_spawn(3)." 2018-03-09 18:08:00 +00:00
Treehugger Robot
0a2060c090 Merge "Move some syscalls in commmon whitelist to app" 2018-03-07 23:14:25 +00:00
Elliott Hughes
41398d03b7 Call __fortify_fatal if printf sees %n.
We've ignored %n for a long time, but that's dangerous too because it
makes it unclear whether the corresponding pointer argument should be
supplied or not.

Remove the ambiguity by just rejecting %n outright.

Bug: http://b/31832608
Test: ran tests
Change-Id: Ic046ad3436a30c6f8f580ea738bdcaeb01c858f8
2018-03-07 13:32:58 -08:00
Jerry Zhang
832f4907f0 Merge "Sign extend offset for pwritev/preadv." 2018-03-07 01:28:26 +00:00
Jerry Zhang
f55dbc0516 Sign extend offset for pwritev/preadv.
Kernel expects a 64 bit offset, so if a
user's offset is 32 bit, the wrapper will
drop the sign. To fix, sign extend the
32 bit value before doing the syscall.

Bug: 31225071
Test: pwritev02 32 bit passes
Change-Id: Ie272601662c2c35b0e8d8fc3823c9063c2f73e64
2018-03-06 15:39:44 -08:00
Elliott Hughes
71ba5899ae Rewrite system(3) to use posix_spawn(3).
We saw crashes from pthread_exit+debuggerd on LP32
(https://issuetracker.google.com/72291624), and it seems like the
equivalent problem should exist with system(3). I fixed posix_spawn(3)
as part of that bug, so the easiest fix is probably to reuse that.

Bug: http://b/72470344
Test: ran tests
Change-Id: I05f838706f2b4a14ac3ee21292833e6c8579b0d4
2018-03-05 17:20:12 -08:00
Treehugger Robot
0a8d5f3eb8 Merge "clang-format local.h." 2018-03-02 08:23:34 +00:00
Treehugger Robot
2cb18c3460 Merge "Separate the new P functions from the new P behavior in the docs." 2018-03-02 06:59:26 +00:00
Elliott Hughes
3040a7a08c Merge "Merge stdio/local.h and stdio/wcio.h." 2018-03-02 03:48:53 +00:00
Treehugger Robot
66e49c0503 Merge "Document the strptime %s change." 2018-03-02 01:24:47 +00:00