Commit graph

26154 commits

Author SHA1 Message Date
android-build-team Robot
b7dcc08e92 Snap for 4728508 from 9302cf2526 to pi-release
Change-Id: I713b6fc698af14a79ec2db841662fb565622b7bd
2018-04-18 07:27:55 +00:00
Andreas Gampe
9302cf2526 Bionic: Always use fortified versions of FD_X macros
When compiling on/for at least Lollipop, always use the fortified
versions of FD_X macros. This works around side-effect issues (which
are explicitly called out in the specification) and generally
increases robustness of code.

(cherry picked from commit 00a6d5fe0a)

Bug: 77986327
Test: mmma bionic
Test: m
Test: bionic_unit_tests
Merged-In: I9096c6872770e46ba5ab64e7375ff83fc0518e07
Change-Id: I9096c6872770e46ba5ab64e7375ff83fc0518e07
2018-04-16 11:06:27 -07:00
android-build-team Robot
038059d235 Snap for 4713750 from 5a0fe3e8bf to pi-release
Change-Id: I39ff678543b66c3d424b29e3a3a392c292812c5b
2018-04-11 07:24:18 +00:00
Ryan Prichard
5a0fe3e8bf spawn.signal_stress: reap spawned children on exit
Test: adb shell \
  /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static \
  --gtest_filter=spawn.signal_stress
Bug: b/77824306
Change-Id: I970d1a4d0f8ac9621e676f32f838fc2f638d9750
(cherry picked from commit 344969c849)
2018-04-10 14:42:46 -07:00
android-build-team Robot
5c7940533a Snap for 4706961 from 45cd095f9d to pi-release
Change-Id: I0de97cbe3bdb00d909fb60f9fd7b41b2d23fb3ce
2018-04-08 07:26:16 +00:00
TreeHugger Robot
45cd095f9d Merge "Do not check user/group names in pwd/grp tests for OEM uid/gids" into pi-dev 2018-04-05 18:49:21 +00:00
Tom Cherry
4b30f14b33 Do not check user/group names in pwd/grp tests for OEM uid/gids
Vendors that use config.fs will have their own uniquely named
user/group names for uids/gids that fall in the OEM ranges.  We
continue to allow lookup via oem_## for these values, however the
returned structs will always include the name from config.fs, so we do
not check it for anything in the tests.

Bug: 77549259
Test: bionic unit tests with uid 5000 as AID_CRAS
Merged-In: I27fc1fdd0e22063fea82b4c9d2a6fb8b865c5d7b
Change-Id: I27fc1fdd0e22063fea82b4c9d2a6fb8b865c5d7b
(cherry picked from commit b4c25c882e)
2018-04-05 09:52:40 -07:00
Luis Hector Chavez
51b867612e Make sys_ptrace_test.cpp Yama LSM-aware
This change enables the tracer process to be able to call ptrace(2) on
the worker process, which is does not have a direct-ancestor dependency.

Bug: 77146512
Test: adb shell \
      /data/nativetest{,64}/bionic-unit-tests{,-static}/bionic-unit-tests-{,-static} \
      --gtest_filter='spawn*'  # aosp_sailfish and Chrome OS
Test: cts-tradefed run singleCommand cts --skip-preconditions \
      -m CtsBionicTestCases --test 'PtraceResumptionTest*'  # aosp_sailfish
                                                            # and Chrome OS
Change-Id: I9e41b3ddde64c0623ba9299cede9d5b2001c8e30
Merged-In: I9e41b3ddde64c0623ba9299cede9d5b2001c8e30
(cherry picked from commit 7300d83b2e)
2018-04-05 09:23:35 -07:00
android-build-team Robot
b00182ab18 Snap for 4701683 from ffaeac104a to pi-release
Change-Id: I6f8f0b4fd3bdcac6a0e10d453395ff719176e36a
2018-04-05 07:21:55 +00:00
TreeHugger Robot
ffaeac104a Merge changes Ib44cbea8,I9763caa0 into pi-dev
* changes:
  Fix race in spawn.signal_stress test
  Fix race in ld.config.txt tests
2018-04-05 02:35:31 +00:00
Ryan Prichard
ef53e759cc Fix race in spawn.signal_stress test
The default behavior for a real-time signal is to terminate the process.
If the child we fork sends a SIGRTMIN signal before we've set up the
ScopedSignalHandler for it, then the parent is terminated.

Test: adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static --gtest_filter=spawn.signal_stress --gtest_repeat=1000
Bug: b/77554047
Change-Id: Ib44cbea8ccf506644405d8f426d9ad24e77cfa33
(cherry picked from commit a1bc826c37)
2018-04-04 16:10:57 -07:00
Ryan Prichard
0044cd188e Fix race in ld.config.txt tests
The tests can run in parallel, and if they do, one test can truncate
ld.config.txt while another test is reading it (via the loader). Fix the
issue by using a TemporaryFile as the LD_CONFIG_FILE.

Test: adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests  --gtest_filter=dl.exec_with_ld_config_file:dl.exec_with_ld_config_file_with_ld_preload:dl.disable_ld_config_file --gtest_repeat=1000
Bug: b/77555708
Change-Id: I9763caa076ece30d1a0eb9c8892a310ac51543b6
(cherry picked from commit 6c3f97d236)
2018-04-04 16:10:37 -07:00
Ryan Prichard
9dac3e9efd Break libdl.so and ld-android.so's dependency on libc.so.
* Specify "nocrt: true" to avoid calling __cxa_finalize.

 * Define a dummy __aeabi_unwind_cpp_pr0 for arm32.

Bug: b/62815515
Bug: b/73873002
Test: boot AOSP hikey960-userdebug
Test: run ndk_cxa_example in special /system/bin/debug namespace
Test: run Bionic unit tests
Change-Id: I59bcb100a2753286b59c51a47d7a183507219a07
(cherry picked from commit 470b66644b)
2018-04-04 15:56:02 -07:00
Ryan Prichard
075f77d6d6 Fix build failure with dlext_testzip Bionic tests
Other build rules create and use a test config file in the intermediate
directory containing $(LOCAL_BUILT_MODULE). Currently, this makefile
deletes $(dir $(LOCAL_BUILT_MODULE)) (aka $(dir $@)), so it can delete
the config file after it's created and before it's used. Avoid this
issue by using $(dir $@)/zipdir as the working directory for
constructing a zip file.

Bug: b/74524170
Test: mmma bionic
Test: run Bionic unit tests
Change-Id: Icee4d7bc72ba1c136385a0cb2c28491649598e7c
(cherry picked from commit ef59154d41)
2018-04-04 15:55:56 -07:00
android-build-team Robot
39cc4b0b0e Snap for 4698807 from 8b70a0266d to pi-release
Change-Id: Ie7349a82e1d5e720a788898f3fe650af278e3895
2018-04-04 07:27:26 +00:00
Christopher Ferris
8b70a0266d Refactor malloc debug.
Changes
- Refactor the code so that only guards require creating a special header
  for every pointer allocated.
- Store only a single copy of every backtrace. This saves memory so that
  turning on the backtrace option doesn't result in 10X memory usage.
- Added new option track_allocs that only verifies pointers are valid for
  free/malloc_usable_size/realloc.
- Remove suffix from test names.
- Add the TRACK_ALLOCS options to all guard options.
- Add new option verify_pointers that is a lightweight way to verify
  pointers that are passed to allocation routines.
- Do auto-formatting of the code.
- Updated documentation for all of these changes.

Bug: 74361929

Test: Ran unit tests.
Test: Ran libmemunreachable unit tests.
Test: Ran an app with backtrace enabled.

Change-Id: I3246c48ae4f9811f64622d90d0a9b4d9d818702c
(cherry picked from commit 4da2503d70)
2018-04-03 13:13:53 -07:00
android-build-team Robot
a35418a1f5 Snap for 4696032 from 622a36923e to pi-release
Change-Id: Icc3440bdf3739eefa23de80cd32c813efc2d4ebd
2018-04-03 07:26:19 +00:00
Ben Schwartz
622a36923e Pad queries when EDNS0 is enabled.
Behavior is compliant with
https://tools.ietf.org/html/draft-ietf-dprive-padding-policy-04

EDNS0 is only enabled when the netcontext requests it, i.e. in DNS-over-TLS
mode.

Bug: 69623036
Bug: 64133961
Test: Wireshark verified. Integration tests echo padding and pass.
Merged-In: Ie5439b0ad505ebf393a83c87845fd02549afc4a2
Merged-In: I274d659782870818274526d23d3a3c4640cad92d
Change-Id: I5ef600e02a572d281441e890cc981614f150629b
(cherry picked from commit 23e4081009bb58d9c09e615186208b77749e72de)
2018-04-02 15:31:30 -07:00
android-build-team Robot
4f21afb229 Snap for 4693621 from d65576d406 to pi-release
Change-Id: I165c87670ea2936ee4feb29c96ffc2bef270c17c
2018-04-01 07:27:32 +00:00
TreeHugger Robot
d65576d406 Merge "Add libtest_missing_symbol_child_private." into pi-dev 2018-03-30 01:51:12 +00:00
TreeHugger Robot
5ec355926f Merge "Fix -/_ typo." into pi-dev 2018-03-29 23:40:23 +00:00
Elliott Hughes
e1b1b8387e Add libtest_missing_symbol_child_private.
Bug: http://b/77236525
Bug: http://b/77276121
Test: builds

(cherry picked from commit 06d31c94c2)

Change-Id: I6f4b6d2527c8146a252aaa935a46d09632c44a5f
2018-03-29 16:34:33 -07:00
TreeHugger Robot
6df2dc1675 Merge "Allow several syscalls to app process" into pi-dev 2018-03-29 23:21:50 +00:00
Elliott Hughes
34b18c0189 Fix -/_ typo.
Bug: http://b/77236525
Bug: http://b/77276121
Test: builds

(cherry picked from commit 51466528cd)

Change-Id: I6c892a2714760ccce4da1d71a02c08e3ec990223
2018-03-29 13:58:38 -07:00
Victor Hsieh
bbfcf78804 Allow several syscalls to app process
Several privileged syscalls are still needed before a zygote-fork hangs
over the execution to the apps.

Test: system starts, different apps run
Bug: 63944145
Bug: 76461821
Change-Id: I78da54dac509eb073bc2aa7b820a1f6b0c39a775
Merged-In: I78da54dac509eb073bc2aa7b820a1f6b0c39a775
2018-03-29 13:41:37 -07:00
Jiyong Park
d8dcb55693 Add missing shared library dependencies to bionic-unit-tests
Bug: 77236525

Test: 'make tests dist' and verify that these libraries are in the
*-continuous_native_tests-*.zip

(cherry picked from commit ce10b16294)

Change-Id: I85c2476e4523fd3cb0fbc1bf7845ca5f042ba7e0
2018-03-29 17:55:01 +00:00
Pirama Arumuga Nainar
d65f209ad1 Add missed shared library dependency to bionic-unit-tests
Test: N/A

(cherry picked from commit 1395f70f6c)

Bug: http://b/77276121
Change-Id: I1ea52e5624e741f6fb7bf6c11b0a520d02835278
2018-03-29 17:54:41 +00:00
Pirama Arumuga Nainar
744fe65dd1 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

(cherry picked from commit c53e8b88d5)

Bug: http://b/77276121
Change-Id: I310f999c6cf2ef2d53b37bc7c53590fe9e0e2fe3
2018-03-29 17:53:59 +00:00
android-build-team Robot
6e5f030cd7 Snap for 4683893 from 5a6b9565c0 to pi-release
Change-Id: Id16c42126160b15d11ae56617915857d40231f4e
2018-03-28 07:23:45 +00:00
Victor Khimenko
5a6b9565c0 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
(cherry picked from commit 5956847acc)
2018-03-27 17:32:38 +02:00
Elliott Hughes
16eeaab659 Merge "Reject .so files using ELF TLS." into pi-dev 2018-03-27 14:26:48 +00:00
android-build-team Robot
a5fad2e282 Snap for 4680594 from 0d5906594d to pi-release
Change-Id: I75fe503c343676ad6d5beaaeb0b7cfee9b8d6ce2
2018-03-27 07:23:04 +00:00
Tom Cherry
0d5906594d Create PTHREAD_COND_INITIALIZER_MONOTONIC_NP
Needed for std::condition_variable to wait on CLOCK_MONOTONIC.

Bug: 35756266
Bug: 73951740
Test: boot bullhead
Change-Id: I32a30817f0ec2190393fcc6faec45b40822cba32
(cherry picked from commit f0f3d2f002)
2018-03-26 16:20:47 -07:00
Elliott Hughes
45a93c13bf Reject .so files using ELF TLS.
Bug: http://b/74361956
Test: ran tests

(cherry picked from commit 9724e93c19)

Change-Id: I287c926951c337aacd2246940a1e6474e4c661e1
2018-03-26 11:09:40 -07:00
android-build-team Robot
4b94b82f5c Snap for 4670666 from 1142f7e70d to pi-release
Change-Id: I56d6e75298e7fefd91953756d1e3b0db3abb5936
2018-03-22 07:24:19 +00:00
Tom Cherry
1142f7e70d Merge "Add _monotonic_np versions of timed wait functions" into pi-dev 2018-03-21 19:41:25 +00:00
Tom Cherry
76f78fc709 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-21 08:43:09 -07:00
Ben Schwartz
a56793c238 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
Bug: 64133961
Merged-In: Idbfbc0343e21ad713d9b4204fc48d63fb5b8dcd4
Merged-In: Ie3ae2390f01dbdcccf55fdd4e87b8a258702cfbc
Change-Id: I153a259b0c07717f664ee268b43da867a9b42152
(cherry picked from commit e7190ce3f2)
2018-03-21 07:57:14 -07:00
android-build-team Robot
0078d8a73e Snap for 4665332 from 9864564fca to pi-release
Change-Id: Idddabab918ca696d30804ef4077674cc90bf7e24
2018-03-20 07:24:21 +00:00
Ben Schwartz
9864564fca Lay the groundwork for enabling EDNS0 in queries.
This change does not enable EDNS0, so it should not
result in any behavior change.  However, enabling EDNS0
should now be possible with only a small additional change
to "flip the switch".

This change has also landed in NetBSD upstream
(http://gnats.netbsd.org/52578) so this change reduces
divergence from upstream.

Most of the code in this change is for caching of queries that contain
an additional section.

Bug: 15132200
Bug: 64133961
Test: Added integration tests for fallback to the netd suite.
Merged-In: I9b0abc6e4f3ff7f9c23a5cb921d392d2d3065d99
Merged-In: I9c06bbaf1883de4bdebd822f9a052901bf3efc04
Merged-In: Ie438b77bc1aeea0b0c700a90998cec31ac9a0015
Change-Id: Ic64bed0754e1d529dc0c0ab6a5e2f1ea201ff0d5
(cherry picked from commit 6eed8e1bb6)
2018-03-19 08:22:07 -07:00
android-build-team Robot
f81ed1d5b8 Snap for 4662252 from 9e989f12d1 to pi-release
Change-Id: I1f72ccf98ae810443a9c014ba2e07b17cd2e2d09
2018-03-18 07:26:33 +00:00
Yabin Cui
9e989f12d1 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
(cherry picked from commit 9651fdf93a)
2018-03-15 17:42:27 -07:00
android-build-team Robot
9bec34030b Snap for 4656203 from b85d0bd2b9 to pi-release
Change-Id: I1b3a47952c71792f900f80ce2fcfca5fdd62073c
2018-03-15 07:21:08 +00:00
Erik Kline
b85d0bd2b9 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: 64133961
Bug: 70694619
Bug: 72345192
Merged-In: I81c49586d675160b66dc2c51b76ad183cc418213
Merged-In: Ie8a8ee5784407d4ec304b3f40a6b234ebeaf6376
Merged-In: Icdec53cf5b210db5ad833dd3b64fa3d8ae74100a
Change-Id: I5a86cc5192e6cfa09c375ac9f5810102da3aba20
(cherry picked from commit 391143e51b)
2018-03-14 16:18:25 +09:00
android-build-team Robot
36928820ca Snap for 4641295 from ed1b4547df to pi-release
Change-Id: I8cd163278f8e6f0683924c7f4c5421d8dfec37cf
2018-03-08 08:27:10 +00:00
Jerry Zhang
ed1b4547df 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

(cherry picked from commit f55dbc0516)

Change-Id: Ie81d29a37cf4e99c9279cffc89f4fa1b4da9a898
2018-03-07 10:31:00 -08:00
android-build-team Robot
660676217f Snap for 4632767 from 49b4fce967 to pi-release
Change-Id: I57d3f03b93ff451143d53b8aae3099af29e075b6
2018-03-04 08:25:21 +00:00
Elliott Hughes
49b4fce967 Merge "clang-format local.h." am: 0a8d5f3eb8 am: 9d47ff97e0
am: a8ad2e2e96

Change-Id: I83fd10e67c3684a6fe39b40968710abe501ad50b
2018-03-02 08:44:16 +00:00
Elliott Hughes
a8ad2e2e96 Merge "clang-format local.h." am: 0a8d5f3eb8
am: 9d47ff97e0

Change-Id: Ib2f9d6ead64145846cb0f0c4889d0277db0a377a
2018-03-02 08:38:40 +00:00
Elliott Hughes
9d47ff97e0 Merge "clang-format local.h."
am: 0a8d5f3eb8

Change-Id: I24f53d545306bb8574ea466ae8aa4711b07747da
2018-03-02 08:33:36 +00:00