Commit graph

2428 commits

Author SHA1 Message Date
Elliott Hughes
c0f4656452 Make android_get_application_target_sdk_version available to the NDK.
Also move this and android_get_device_api_level into <android/api-level.h>
so that they're always available.

This involves cleaning up <sys/cdefs.h> slightly.

Bug: N/A
Test: builds
Change-Id: I25435c55f3549cd0d827a7581bee75ea8228028b
2018-11-15 11:07:30 -08:00
Mark Salyzyn
ba1a723ad1 switch to using android-base/file.h instead of android-base/test_utils.h
Test: compile
Bug: 119313545
Change-Id: I664fb32522d01909c603d7b903475c4e9aea9223
2018-11-14 15:46:49 -08:00
Elliott Hughes
8359068064 Merge "Move API levels from uint32_t to int." 2018-11-14 19:50:59 +00:00
Elliott Hughes
ff1428a48e Move API levels from uint32_t to int.
(cherrypick of a6c71a09670ca636cca5cfea9d74b03a951e2b5e.)

Bug: N/A
Test: builds
Change-Id: I9c414e30e3c4fe2a4e16a2fe4ce18eae85fe4844
2018-11-13 21:25:07 -08:00
Mark Salyzyn
68a3bcc249 bionic tests: switch to using android-base/file.h for TemporaryFile
A matching definition of TemporaryFile exists in libbase now.

Test: compile
Bug: 119313545
Change-Id: I6f84dbf3af9a9c4b270a2532a36c9cb4c0f6bb8f
2018-11-13 10:57:28 -08:00
Yi Kong
d495e0b777 Merge "Don't build bionic-unit-tests-static with libcrt_builtins" 2018-11-08 18:23:56 +00:00
Yi Kong
b011d59a7f Don't build bionic-unit-tests-static with libcrt_builtins
libcrt_builtins does not work with libm, which is statically linked in
bionic-unit-tests-static. Opt it out of libcrt_builtins for now.

Bug: 119207651
Bug: 117167374
Test: run bionic-unit-test-static
Change-Id: I20067c9841beb9de2b73342847aaa945dbadbff8
2018-11-08 05:33:15 +00:00
Elliott Hughes
52d7749335 Merge "ART isn't using the ART-specific linker features any more." 2018-11-08 03:09:53 +00:00
Christopher Ferris
6689b4f258 Merge "Add a force fail for non-bionic xfail test." 2018-11-08 03:01:34 +00:00
Christopher Ferris
af1b8ddaa9 Add smoke tests for mallopt options.
Test: Unit tests pass.
Change-Id: If213f4338078011ff12996c1b2a6f6858b51d824
2018-11-07 17:11:42 -08:00
Christopher Ferris
01db9bde05 Add a force fail for non-bionic xfail test.
Test: xfail test passes on host.
Change-Id: I6c4ddd3f3dc5541b126d9dd31b1fcff9d34819e6
2018-11-07 14:39:43 -08:00
Treehugger Robot
5e099173da Merge "Revert "Do not use clang lld with -z,global"" 2018-11-07 21:43:24 +00:00
Evgenii Stepanov
acd6f4f9f5 Disable a few bionic tests under HWASan.
* HWASan report invalid use of the allocator api (like alignment not
being power of two, or allocation size too large) in a way tests do not
expect.
* Code in .preinit_array runs before HWASan shadow is initialized and
needs to be excluded from instrumentation.
* It looks that mm system calls (mmap/mprotect/etc) will not allow
tagged pointers. In fact, the use of mprotect on malloc()ed memory is
doubtful - one can imagine some kind of speculative load from such
memory, as compiler knows that it is addressable.

Bug: 114279110
Test: bionic-unit-tests with hwasan

Change-Id: I6ba4b46a0d554de77c923ad134cf156ce4ddba1b
2018-11-06 16:59:25 -08:00
Evgenii Stepanov
96bd339c51 Remove timer_delete_multiple test.
According to posix, this test invokes undefined behavior by deleting
a timer twice.

According to hwasan, the second call to timer_delete loads
kernel_timer_id from previously deallocated PosixTimer (i.e.
heap-use-after-free).

Bug: 114279110
Test: bionic-unit-tests with hwasan

Change-Id: Ic54579e3bb41d3f38282b8822dafaba51efd003a
2018-11-06 16:59:21 -08:00
Chih-hung Hsieh
08a0cd082f Revert "Do not use clang lld with -z,global"
This reverts commit 8e462d411a.

Reason for revert: this lld bug has been fixed upstream and in AOSP prebuilts

Bug: 80109858
Change-Id: Ied600324201e1a014a1d4e6742767e2ddd94999a
2018-11-07 00:12:56 +00:00
Elliott Hughes
8178c417f6 ART isn't using the ART-specific linker features any more.
Bug: N/A
Test: ran tests
Change-Id: Ide3c295035687019608a2c4716a4a21cb889d121
2018-11-06 11:15:17 -08:00
Christopher Ferris
9ffd39cdea Merge "Add test for malloc_iterate." 2018-11-02 15:20:54 +00:00
Josh Gao
6f3a56bb18 Merge "Revert "bionic: Allocate a shadow call stack for each thread."" 2018-11-01 01:32:00 +00:00
Christopher Ferris
bfd3dc497c Add test for malloc_iterate.
Bug: 62621531

Test: New unit tests pass.
Change-Id: Icc50f5b19642225c8f812844d42c904babde8acf
2018-10-30 18:38:39 -07:00
Christopher Ferris
9ce28844db Update to v4.19 kernel headers.
Test: Builds and boots.
Change-Id: I99a9ed79666e143b47f02ca4e59eed94f69b7e4a
(cherry picked from commit a981e2e52e)
2018-10-30 09:21:16 -07:00
Peter Collingbourne
7b13dd918e Revert "bionic: Allocate a shadow call stack for each thread."
This reverts commit da1bc79f93.

Reason for revert: Caused OOM in media process

Bug: 112907825
Bug: 118593766
Change-Id: I545663871d75889b209b9fd2131cdaa97166478f
2018-10-29 21:48:59 +00:00
Peter Collingbourne
f284a47544 Merge "bionic: Allocate a shadow call stack for each thread." 2018-10-29 21:05:25 +00:00
Peter Collingbourne
da1bc79f93 bionic: Allocate a shadow call stack for each thread.
Bug: 112907825
Change-Id: I7c1479a0cd68696739bf6aa5e0700ba4f2a137ec
Merged-In: I7c1479a0cd68696739bf6aa5e0700ba4f2a137ec
2018-10-29 19:55:18 +00:00
Elliott Hughes
5e62b34c0d Clean up bionic_macros.h a bit.
Use <android-base/macros.h> instead where possible, and move the bionic
macros out of the way of the libbase ones. Yes, there are folks who manage
to end up with both included at once (thanks OpenGL!), and cleaning that
up doesn't seem nearly as practical as just making this change.

Bug: N/A
Test: builds
Change-Id: I23fc544f39d5addf81dc61471771a5438778895b
2018-10-25 11:00:00 -07:00
Elliott Hughes
6032c38fb3 Merge "Add getloadavg(3)." 2018-10-24 16:31:21 +00:00
Elliott Hughes
2d0b28bc0d Add getloadavg(3).
Lets us build ninja with bionic.

Bug: N/A
Test: ran tests
Change-Id: I97eef1247d794b58a2b9aee4851551632e5a4e48
2018-10-23 11:23:00 -07:00
Chuwei Xu
5d9312bb13 CTS: allow continue to use the old AIDs on devices launch with P
Some vendors may have been using the AIDs outside the oem ranges
for long that those aids need continue to be maitained for the
existing devices. We allow them countinue to use the old AID names
and values on device launch with P and before, to give them the
period of time to adopt the new AID scheme.

Bug: 116405200
Change-Id: I0453ed14df4c0855575ef1404c596ddc6ded681b
2018-10-23 13:50:04 +08:00
Josh Gao
7ff7d03286 Merge "Properly fail with ESRCH when pthread_killing an exited thread." 2018-10-18 17:47:17 +00:00
Josh Gao
ddf757e35e Properly fail with ESRCH when pthread_killing an exited thread.
Previously, we were callign tgkill(pid, 0, signal) instead, which would
fail with EINVAL instead.

Test: bionic-unit-tests
Change-Id: I25b127dcf347e0223274502b0516a950b6c2093e
2018-10-17 17:35:56 -07:00
Tom Cherry
4e29cdec23 Merge "Waive AID Range check for upgrading devices launched before P" 2018-10-15 17:59:59 +00:00
Tom Cherry
5c941435ac Waive AID Range check for upgrading devices launched before P
We added a check in P that ensures all vendor provided AIDs only
appear in the carved out ranges for vendors to use.  However,
upgrading devices may be using AIDs outside of this range and it is
very difficult to change these AIDs, so we waive this test for them.

Bug: 116830906
Test: test succeeds on upgrading devices
Change-Id: Iddcacb1dce77a150d5138e7b3115abf25bf60a6e
2018-10-11 11:57:13 -07:00
Treehugger Robot
391af2cefe Merge "Allow invoking the linker on an executable." 2018-10-11 01:04:57 +00:00
Ryan Prichard
8f639a4096 Allow invoking the linker on an executable.
The executable can be inside a zip file using the same syntax used for
shared objects: path.zip!/libentry.so.

The linker currently requires an absolute path. This restriction could be
loosened, but it didn't seem important? If it allowed non-absolute paths,
we'd need to decide how to handle:
 - foo/bar      (relative to CWD?)
 - foo          (search PATH / LD_LIBRARY_PATH, or also relative to CWD?)
 - foo.zip!/bar (normalize_path() requires an absolute path)

The linker adjusts the argc/argv passed to main() and to constructor
functions to hide the initial linker argument, but doesn't adjust the auxv
vector or files like /proc/self/{exe,cmdline,auxv,stat}. Those files will
report that the kernel loaded the linker as an executable.

I think the linker_logger.cpp change guarding against (g_argv == NULL)
isn't actually necessary, but it seemed like a good idea given that I'm
delaying initialization of g_argv until after C++ constructors have run.

Bug: http://b/112050209
Test: bionic unit tests
Change-Id: I846faf98b16fd34218946f6167e8b451897debe5
2018-10-10 14:31:06 -07:00
Josh Gao
069d5aef90 Merge "Block TIMER_SIGNAL in sigprocmask(SIG_SETMASK, ...)." 2018-10-10 20:38:46 +00:00
Josh Gao
baf20fc912 Block TIMER_SIGNAL in sigprocmask(SIG_SETMASK, ...).
Previously, we were zeroing out the reserved signals, when we actually
wanted to have TIMER_SIGNAL always be blocked, and the other signals
always be unblocked. This resulted in process termination when a
SIGEV_THREAD timer callback calls sigprocmask(SIG_SETMASK, ...) with
any signal mask value, and then subsequently fails to complete its
callback and reach the sigtimedwait in bionic before the next timer
iteration triggers.

Add a how argument to filter_reserved_signals to appropriately
block/unblock our reserved signals.

Bug: http://b/116783733
Test: bionic-unit-tests32/64
Change-Id: Ie5339682cdeb914711cd4089cd26ee395704d0df
2018-10-09 16:27:22 -07:00
Elliott Hughes
82ab481123 Add _SC_UIO_MAXIOV as a synonym for _SC_IOV_MAX.
glibc and musl both have these as synonyms for one another, so we may
as well do the same and get backwards compatibility on old OS releases.

Bug: N/A
Test: ran tests
Change-Id: I6bf38ea446560e1b11022ff539f07eb67c157049
2018-10-09 13:56:06 -07:00
Christopher Ferris
928ce8eb64 Merge "Move isolated test runner out of bionic." 2018-10-01 23:07:31 +00:00
Stephen Hines
05ba56d6c0 Merge "Fix up a few bionic tests for the clang-r339409 update." 2018-10-01 15:57:35 +00:00
Christopher Ferris
6d2c0bdf6e Move isolated test runner out of bionic.
Use a global gtest isolation runner rather than the custom one in
bionic.

Test: Ran all unit tests and verified same behavior before and after.

Change-Id: I24a7cf17cf8e018d0f51969c64b53ce9059cc779
2018-09-27 22:22:17 -07:00
Christopher Ferris
f3ff8dc6f4 Merge "Ignore output to stderr while enumerating tests" 2018-09-27 23:23:36 +00:00
Treehugger Robot
ddf92a1ba5 Merge "Always return /vendor/bin/sh as shell for OEM ids in getpwnam() etc." 2018-09-27 23:23:34 +00:00
Tom Cherry
fa5f61c8d9 Always return /vendor/bin/sh as shell for OEM ids in getpwnam() etc.
During the review of the script that generates /vendor/etc/passwd, it
was suggested that the shell be /vendor/bin/sh instead of the typical
/system/bin/sh.  This has subsequently caused bionic unit tests to
fail, since they always check that the shell is set to /system/bin/sh.

In the spirit of that review, libc is modified to return
/vendor/bin/sh for the OEM AID ranges and the test is updated to
expect this.

Test: bionic unit tests
Change-Id: Ie7c1c48fde8a71b3df1aa0ef112d42ab7bd3baec
2018-09-27 20:29:49 +00:00
Elliott Hughes
b177085ce7 Add reallocarray(3).
Originally a BSD extension, now in glibc too. We've used it internally
for a while.

(cherry-pick of e4b13f7e3ca68edfcc5faedc5e7d4e13c4e8edb9.)

Bug: http://b/112163459
Test: ran tests
Change-Id: I813c3a62b13ddb91ba41e32a5a853d09207ea6bc
Merged-In: I813c3a62b13ddb91ba41e32a5a853d09207ea6bc
2018-09-26 14:24:18 -07:00
dimitry
21557cdd2e Ignore output to stderr while enumerating tests
Bug: http://b/114304197
Test: adb unroot && run CtsBionicTestCases
Change-Id: I75880934fa1c25be6c76e866f97efc14d5ccd0a1
2018-09-25 12:23:33 +02:00
Stephen Hines
cd659d410a Fix up a few bionic tests for the clang-r339409 update.
Disable -Wmemset-transposed-args to ensure that FORTIFY still works
without it. Also, we can finally enable checking for
FLT_HAS_SUBNORM/DBL_HAS_SUBNORM/LDBL_HAS_SUBNORM now that those are
available in Clang.

Bug: http://b/110779387
Test: build and run bionic unit tests
Change-Id: I4bf19b870c44d981ecbd1089d0ae6a2496be5441
2018-09-24 16:59:08 -07:00
Orion Hodson
0c938550cf Update probing in membarrier_test
Updates HasMembarrier(cmd) to probe rather than execute command to fix
unintended test skipping.

Test: manual on OrangePi Zero running 4.17.4.
Change-Id: I33a6684a3662cae20cbedc52463b26ef299caf71
2018-09-10 10:21:40 +01:00
Christopher Ferris
795034cab8 Fix membarrier test.
Some older kernels do not support all membarrier commands. For example,
the 4.9.x kernel only supports MEMBARRIER_CMD_QUERY and MEMBARRIER_CMD_SHARED.

Test: Ran unit tests on hikey.
Change-Id: I5d4b93df6aa5f443c4700e8f7d33f46953f74e87
2018-09-07 14:11:28 -07:00
Elliott Hughes
431d2ff141 Merge "Add android_get_device_api_level." 2018-09-07 15:40:45 +00:00
Orion Hodson
dca7d3fae5 Merge "libc: Add membarrier to common seccomp allowed list" 2018-09-07 09:46:08 +00:00
Elliott Hughes
ce934e3d9b Add android_get_device_api_level.
Bug: http://b/113615412
Test: ran tests
Change-Id: I0a7ae336c96c9ed6543b6935cbc242d14d4a4a67
2018-09-06 14:19:46 -07:00
Elliott Hughes
f340a56d1c Use strerror_r(3) for the printf family %m.
There's TLS space used for unknown errno values, and a call to printf
shouldn't clobber that. No-one will ever hit this in real life, but
since it's easily fixed...

Bug: http://b/112776560
Test: ran tests
Change-Id: I8c2437f2e5214e652119791d4e162a197b049d5b
2018-09-06 10:42:40 -07:00
Orion Hodson
6ba6694ec2 libc: Add membarrier to common seccomp allowed list
Allows ART JIT use membarrier to invalidate instruction
pipelines.

Bug: 66095511
Test: bionic-unit-tests
Change-Id: I8cf83929f00baf5a3c440a899d2667a992bda8e2
2018-09-06 16:36:09 +01:00
Elliott Hughes
74934aaf10 Merge "Add the %m GNU extension to printf/wprintf." 2018-09-05 18:47:44 +00:00
Elliott Hughes
654cd8331b Add the %m GNU extension to printf/wprintf.
And remove the local hack from syslog(3).

Bug: http://b/112776560
Test: ran tests
Change-Id: I5807e729a978df26187ea0ee255bba4ca74220c8
2018-08-30 16:00:42 -07:00
Elliott Hughes
eab657248d Add a test for poll with null fds.
I don't think we want to *document* this, but since at least
external/curl/lib/select.c is relying on this, we should be careful not
to break it.

Bug: http://b/111850071
Test: ran tests
Change-Id: Ic877250d755a0cb59e77ae38ae5e3949f753dad6
2018-08-30 12:15:56 -07:00
Josh Gao
726b63f725 Implement pthread_sigqueue.
Bug: http://b/112770187
Test: bionic-unit-tests
Change-Id: I03382cd5df2490b2e87265dba9007e2cb1b14cd2
2018-08-27 16:48:17 -07:00
Christopher Ferris
2c4ec7e109 Fix uses of readlink in tests.
readlink does not append a terminator, and a few tests assumed it did.

Test: Unit tests pass.
Change-Id: I3ccea4e7895cd919b45e1ca0c90aa6f0031de320
2018-08-23 11:30:56 -07:00
Treehugger Robot
05ee196c0a Merge "Test that /dev/stdin, /dev/stdout, and /dev/stderr are all present." 2018-08-23 02:15:26 +00:00
Treehugger Robot
53b40de572 Merge "Test that the _r_debug list looks OK" 2018-08-22 23:46:30 +00:00
Elliott Hughes
f1a38386b7 Test that /dev/stdin, /dev/stdout, and /dev/stderr are all present.
Bug: http://b/31824379
Test: ran tests
Change-Id: I16034106eb61b9f32c9afef512c75f0b73c179b5
2018-08-22 15:38:07 -07:00
Ryan Prichard
c20f9a583a Test that the _r_debug list looks OK
Match it against the dl_iterate_phdr list. It should have the same entries,
but they could be in a different order.

Test that the dl_iterate_phdr callback always provides at least a PT_LOAD
segment.

Verify that the executable comes first in the _r_debug list.

Test: bionic-unit-tests
Bug: http://b/110967431
Change-Id: I9b6ec77d1205c4c45848adf65456bb7b3da4a3a1
2018-08-22 13:17:03 -07:00
Elliott Hughes
99d54656bd Add PR_SET_VMA and PR_SET_VMA_ANON_NAME to <sys/prctl.h>.
We've copied & pasted these to too many places. And if we're going to
have another go at upstreaming these, that's probably yet another reason
to have the *values* in just one place. (Even if upstream wants different
names, we'll likely keep the legacy names around for a while for source
compatibility.)

Bug: http://b/111903542
Test: ran tests
Change-Id: I8ccc557453d69530e5b74f865cbe0b458c84e3ba
2018-08-22 10:36:23 -07:00
Josh Gao
7266e91f62 Move unique_fd fdsan tests into bionic.
EXPECT_DEATH requires special handling to work with fdsan, because of
our fork detection. Instead of duplicating the EXPECT_FDSAN_DEATH macro
in the libbase tests as well, move the unique_fd fdsan tests here.

Test: bionic_unit_tests
Change-Id: Ia7b65d4560601d5a78d143aced887a6773b401c0
2018-08-09 01:09:08 +00:00
Elliott Hughes
b7b2884a21 Merge "Reland "Retire GCC FORTIFY."" 2018-08-08 15:26:37 +00:00
Josh Gao
08b7a4008f fdsan: improve errors some more.
Add handling for all 4 cases of failure of exchange_owner_tag. Also,
mask off and sign extend the type byte of the owner tag, and add a
test for that.

Test: bionic_unit_tests
Change-Id: Ic7c49f0ee5498623f05c49b5b4cd055db48a4b9f
2018-08-03 15:03:41 -07:00
Yi Kong
32bc0fcf69 Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.

Test: m
Bug: 68236239
Change-Id: I5b4123bc6709641315120a191e36cc57541349b2
2018-08-02 18:09:44 -07:00
Elliott Hughes
b652e9ab4d Our prebuilt host glibc is new enough to remove a workaround.
Bug: N/A
Test: builds
Change-Id: Ib91a106ddc15aa93f0dc3c85bc1a17eaeb49ab0f
2018-08-01 12:26:17 -07:00
Sajid Dalvi
6fc8dc203e remove bionic-compile-time-tests-g++
make checkbuild gives the following error:
bionic/tests/fortify_filecheck_diagnostics_test.cpp:1:0: error: unknown value 'cortex-a55' for -mcpu

The error is because we have a clang to support the new architecture,
but not a corresponding GCC. It is not trivial to filter out an invalid
CPU, and since there is no platform code built with GCC any more, its
better to remove bionic-compile-time-tests-g++

Bug: 74404306
Test: builds
Change-Id: I6aa181c652abeef782fec6380dfadd066140b8b9
2018-07-24 12:49:50 -07:00
Elliott Hughes
0d1a8a5b0b Reland "Retire GCC FORTIFY."
This reverts commit 4dbe8fc22f.

The angler/bullhead builds are now dead, so this can go in.

Bug: https://issuetracker.google.com/74404306
Change-Id: I130cdcd6375b6125cb8a1e63a4a540b0dbe41ceb
2018-07-24 19:36:51 +00:00
Elliott Hughes
4dbe8fc22f Revert "Retire GCC FORTIFY."
This reverts commit 067bdc9546.

The angler/bullhead builds still use GCC, so I'll wait until they're turned down.

Bug: https://issuetracker.google.com/74404306
Change-Id: I777b08dd6ab5250d532b4b5cc56e9a790c13db20
2018-07-24 18:54:16 +00:00
Elliott Hughes
067bdc9546 Retire GCC FORTIFY.
NDK r18 (which removes GCC) is about to ship. We don't need this any more.

The immediate motivation for removing this right now is that the test
fails whenever we add Clang-only flags to the build system.

While we're here, clean up <stdatomic.h> too.

Bug: https://issuetracker.google.com/74404306
Test: ran tests
Change-Id: Iaad5d634d1ba76f0b6f19ad32cc27b2533771a4a
2018-07-23 17:22:58 -07:00
Treehugger Robot
94ab04c17a Merge "libm: add tests that would have caught the recent regression." 2018-07-23 23:30:11 +00:00
Elliott Hughes
505ecd6909 libm: add tests that would have caught the recent regression.
Bug: http://b/111710419
Test: ran tests
Change-Id: I00ec8ef24fb4c2cfef7c9cef311bbd6c755993e1
2018-07-23 14:25:36 -07:00
Josh Gao
f6e5b58260 Introduce api to track fd ownership in libc.
Add two functions to allow objects that own a file descriptor to
enforce that only they can close their file descriptor.

Use them in FILE* and DIR*.

Bug: http://b/110100358
Test: bionic_unit_tests
Test: aosp/master boots without errors
Test: treehugger
Change-Id: Iecd6e8b26c62217271e0822dc3d2d7888b091a45
2018-07-19 14:28:54 -07:00
Treehugger Robot
ad596bf4fc Merge "setjmp is a macro." 2018-07-19 00:42:54 +00:00
Treehugger Robot
76221401ed Merge "Add C11 timespec_get." 2018-07-18 23:16:24 +00:00
Treehugger Robot
99a8caf2b8 Merge "Expose __res_randomid." 2018-07-18 17:06:28 +00:00
Tao Bao
afacaaba8c The --gtest_color flag should take a priority.
This along with commit c1ef5eb034 should
get back to the initial behavior prior to the change in commit
83b6379783.

Fixes: 111396376
Test: `adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_color=yes`
      shows colored output.
Test: `adb shell -t /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_color=no`
      doesn't add color escapes.
Change-Id: I88530e8b264cd0c259c16b09bdf867cdd2e88224
2018-07-17 19:08:13 -07:00
Elliott Hughes
bf74815b52 setjmp is a macro.
POSIX says it's unspecified whether setjmp is a macro or a function,
but C11 says it's a macro, and the C standard always wins.

Bug: https://github.com/android-ndk/ndk/issues/744
Test: ran tests
Change-Id: I4a1abc37724f8e9d9498f2093ef3c1f3b8253949
2018-07-17 13:55:36 -07:00
Elliott Hughes
f98d87b831 Add C11 timespec_get.
Bug: https://github.com/android-ndk/ndk/issues/744
Test: ran tests
Change-Id: Iad9514946e06d55b6a3aa0f945d9a63bff900881
2018-07-17 13:21:05 -07:00
Elliott Hughes
3a5fd0014c Expose __res_randomid.
I don't think this will help the original submitter, because <resolv.h>
is mostly useless on Android. One day we might have a deprecation and
removal policy for the NDK, but until then we should probably maintain
this header.

Bug: https://github.com/android-ndk/ndk/issues/739
Test: ran tests
Change-Id: I2db859abfdebc3824c997462fa6133d5b355a8dd
2018-07-17 13:02:52 -07:00
Haibo Huang
c1ef5eb034 Only use color in supported terminal.
Test: compile
Change-Id: Ibb962597e065ebb90a53dd8bc62c4b774a2e4f10
2018-07-16 22:53:49 +00:00
Treehugger Robot
06f217d399 Merge "Remove workarounds for old versions of clang and GCC." 2018-07-11 22:08:46 +00:00
Treehugger Robot
67267589ba Merge "Reimplement popen(3)/pclose(3)." 2018-07-11 22:02:13 +00:00
Elliott Hughes
3012b9636b Remove workarounds for old versions of clang and GCC.
Bug: N/A
Test: ran tests
Change-Id: I89d224c743f5113771de41c74161a7a5ccad05e4
2018-07-11 13:18:29 -07:00
Elliott Hughes
468efc80da Reimplement popen(3)/pclose(3).
pclose(3) is now an alias for fclose(3). We could add a FORTIFY check
that you use pclose(3) if and only if you used popen(3), but there seems
little value to that when we can just do the right thing.

This patch also adds the missing locking to _fwalk --- we need to lock
both the global list of FILE*s and also each FILE* we touch. POSIX says
that "The popen() function shall ensure that any streams from previous
popen() calls that remain open in the parent process are closed in the
new child process", which we implement via _fwalk(fclose) in the child,
but we might want to just make *all* popen(3) file descriptors O_CLOEXEC
in all cases.

Ignore fewer errors in popen(3) failure cases.

Improve popen(3) test coverage.

Bug: http://b/72470344
Test: ran tests
Change-Id: Ic937594bf28ec88b375f7e5825b9c05f500af438
2018-07-11 12:15:26 -07:00
Haibo Huang
83b6379783 Remove bionic test's dependency on gtest internal.
It is wrong to depend on internal ABI. And in the new version, they
explicitly disabled that.
b3d9be5c1d

Test: run test
Change-Id: I194a1e9417df2c52872b6eca6b61fb392e07cd29
2018-07-10 15:45:31 -07:00
Elliott Hughes
07a7c9b316 Merge "Fix some long-standing UTF-8 bugs." 2018-07-09 18:27:31 +00:00
Bernie Innocenti
57fe8130af Merge "bionic: Convert res_send.c to poll()" 2018-07-09 02:46:44 +00:00
Elliott Hughes
402c762fc9 Fix some long-standing UTF-8 bugs.
We we incorrectly rejecting U+fffe and U+ffff, and incorrectly accepting
characters above U+10ffff (see https://tools.ietf.org/html/rfc3629
section 12 for that restriction).

Bug: http://lists.landley.net/pipermail/toybox-landley.net/2017-September/009146.html
Test: ran tests
Test: also ran the exhaustive test from that email thread
Change-Id: I8ae8e41cef01b02933bd4f653ee07791932b79a5
2018-07-06 17:18:05 -07:00
Elliott Hughes
463faada00 pthread_barrier_init: add a test for the count == 0 EINVAL case.
The code was already correct, but we didn't have a test.

Bug: N/A
Test: ran tests
Change-Id: Ie63cbcfbfc2f2df6270aae98f0f4add484d210bc
2018-07-06 14:34:49 -07:00
Bernie Innocenti
b664724525 bionic: Convert res_send.c to poll()
Bug: 5854418
Test: adb shell /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static
Test: manually:
    - flash and boot device
    - connect to wifi
    - launch WebView and resolv a few domains
Change-Id: I7b488e6d061d99a8a3c4bba69c2ac8609257eb6a
2018-07-05 11:39:09 +09:00
Tom Cherry
50acae8f2a Merge "Reland "Remove a check for AIDs in the OEM range."" 2018-06-29 23:08:37 +00:00
Tom Cherry
4cddb00d6f Reland "Remove a check for AIDs in the OEM range."
There may be vendor extensions to the system image which would need to
use these IDs.

This reverts commit 41986a013a.

Bug: 110856218
Test: these tests
2018-06-29 10:39:43 -07:00
Treehugger Robot
363eac0bab Merge "linker: improve "bad ELF magic" error." 2018-06-28 01:03:11 +00:00
Elliott Hughes
a897151426 linker: improve "bad ELF magic" error.
Include what we actually saw.

Bug: http://b/79463184
Test: ran tests
Change-Id: Id5f8aa3ab94b411ea839b0a1ada9beda9053a10f
2018-06-27 14:39:06 -07:00
Elliott Hughes
e7d185f59e <sys/un.h>: add SUN_LEN.
Also used by lldb.

Bug: N/A
Test: ran tests
Change-Id: I4c2aa60e7a3d8c691742c12ebde142d9438bf60f
2018-06-27 14:08:48 -07:00
Elliott Hughes
e5a5eec5e5 <netinet/ip_icmp.h>: ensure struct icmphdr is available.
Needed to build toybox ping.

Bug: N/A
Test: ran tests
Change-Id: Ifd0f0ccbb8351c6a0ece526b050778fd02e984bf
2018-06-27 12:29:06 -07:00
Dan Willemsen
901055eec7 Mark bionic-loader-test-libs-target as a phony rule
This essentially was phony before, but it wasn't marked as such. Mark it
so that we can turn on some more sanity checks in the build.

Test: Fewer warnings when --warn_real_to_phony is enabled for kati
Change-Id: I5f02b291ca01141dea75977df8b5ef9630917eb2
2018-06-18 20:23:14 -07:00
dimitry
3b0a5b7347 Relax check on number of segments in a .so file
This check was not necessary since it is perfectly fine for a dso to
have any number of PT_LOAD segments, given that the number is > 0.

Bug: http://b/109747297
Test: make
Change-Id: I0e3b400fddf05ed7b9342bacbfffd3b578f26cf3
2018-06-06 11:22:20 +02:00