Commit graph

2162 commits

Author SHA1 Message Date
Elliott Hughes
cf3a3e6774 Fix unistd.sysconf test.
A previous change added new assertions about these, but didn't remove
these old now-invalid assertions.

Bug: http://b/68133223
Test: ran tests
Change-Id: Ib6ce6e5f7abe143f2c871e074e7fd51faaf452ac
2017-10-23 17:10:53 +00:00
dimitry
8db36a51ff linker: fix error message for inaccessible libs
Added a test to make sure linker produces correct error message
when user attempts to load a library in a linked namespace and fails.

Bug: http://b/67866190
Bug: http://b/64950640
Bug: http://b/64888291
Test: bionic-unit-test --gtest_filter=dlext*
Change-Id: I5b5c2070d1388eff123118350b2b5c8fc7571a29
2017-10-23 15:14:01 +02:00
Treehugger Robot
8f348a0cce Merge "Remove some legacy declarations from <math.h>." 2017-10-20 18:40:17 +00:00
Treehugger Robot
619df557c0 Merge "Fix: linker segfault on dlopen of a DF_1_GLOBAL so" 2017-10-20 00:55:59 +00:00
Treehugger Robot
ac29d9f3b9 Merge "Add POSIX swab." 2017-10-19 21:49:29 +00:00
Elliott Hughes
5c6a7bf0dc Remove some legacy declarations from <math.h>.
These are still needed for backwards compatibility with code built by old
versions of the NDK, but we don't need to pollute the headers with them.

Also lose the hand-written code for these. The compiler-generated code
is either the same or better, and no new code is calling these functions
anyway.

Bug: N/A
Test: ran tests
Change-Id: Ib01ad9805034433e0105aec882608cc8e6526f78
2017-10-19 14:15:31 -07:00
Elliott Hughes
a1c30b98e9 Merge "Add POSIX fexecve." 2017-10-19 15:42:56 +00:00
Dimitry Ivanov
d6084a764e Merge "Use ro.debuggable property instead of checking build type" 2017-10-19 06:51:21 +00:00
Jiyong Park
01162f2469 Fix: linker segfault on dlopen of a DF_1_GLOBAL so
Added the missing null check routine.

Bug: 67755729
Test: dlfcn.dlopen_df_1_global added and it passes
Change-Id: Ibe8db18b0b5a481e2e9937041abef6d6b179dd87
2017-10-19 15:13:54 +09:00
Elliott Hughes
e3d21c84af Merge "More <limits.h> fixes." am: 8f57fd4179 am: 4dd32e00f7
am: 47ffbcad0f

Change-Id: Ia75335d51f86594d2c828e0b6c5fa492b675c6df
2017-10-18 23:35:03 +00:00
Elliott Hughes
4d215aad85 Add POSIX fexecve.
I'm skeptical about the usefulness of this, but it's in POSIX, it's
in glibc (but not iOS), and it is used in some internal source (test
runners and container code).

Bug: N/A
Test: ran tests
Change-Id: I92c5398f2a679b21a33fba92bc8e67e3ae2eb76f
2017-10-18 16:26:17 -07:00
Elliott Hughes
fa386e0d1e Add POSIX swab.
Surprisingly to me, there are actual uses of `swab` in the codebases
I have available to search, including one with a #ifndef __ANDROID__
around it.

Bug: N/A
Test: ran tests
Change-Id: Ic91b78ae22bb65c346cb46dd38916f48d979abe0
2017-10-18 13:34:32 -07:00
Elliott Hughes
19d7685982 More <limits.h> fixes.
Went through the POSIX spec for the _POSIX* and _XOPEN* constants.

Bug: http://b/32776472
Test: ran tests
Change-Id: I389100dbc7de354eae9056e44b0a7fa8c37374e3
2017-10-18 13:27:01 -07:00
dimitry
59d3062f51 Use ro.debuggable property instead of checking build type
Test: make
Change-Id: I094663c20721f345cd6684e06fcef38f300790be
2017-10-18 13:23:08 +02:00
Elliott Hughes
9793ea25c4 Merge "Add pthread_setschedprio." am: 435e6384de am: 0cf1a3699b
am: 463ab4b0f5

Change-Id: If6f7adf5f9c824e24309682309762e9ed40ab83b
2017-10-17 18:08:58 +00:00
Elliott Hughes
dff08ced56 Add pthread_setschedprio.
Bug: http://b/26204555
Test: ran tests
Change-Id: Ic34062b9b6036a1ce2642a069514bab48a893338
2017-10-17 09:14:05 -07:00
Elliott Hughes
f22fd343d7 Merge "Complete <netdb.h>." am: bf886f621b am: 8b9405e779
am: c7a36acf91

Change-Id: Idb39ed2af66acd1db2268833845d1143b02c3747
2017-10-17 16:12:23 +00:00
Elliott Hughes
bf886f621b Merge "Complete <netdb.h>." 2017-10-17 16:03:54 +00:00
Josh Gao
11e18a31dc Merge changes I93dc3811,I710d2929,I6ae029ed am: d4b4f06cad am: 9a0a7b3f5c
am: a29ad1565c

Change-Id: I35c66a1394f4d9201aea78d3ddadcc4c91e90143
2017-10-17 06:39:16 +00:00
Josh Gao
084f6ec9af Don't use PR_SET_DUMPABLE to prevent crash dumping in death tests.
Bug: http://b/27833000
Test: bionic-unit-tests are way faster
Change-Id: I6ae029edcd4c4b4b0dfaf613fc17c208d3cb24d1
2017-10-16 21:31:37 -07:00
Elliott Hughes
5033918092 Complete <netdb.h>.
Add all the missing <netdb.h> functions.

Also fix getservbyport to handle a null protocol correctly.

Also fix getservbyname/getservbyport to not interfere with getservent.

Also fix endservent to reset getservent iteration.

Also reduce unnecessary differences from upstream NetBSD sethostent.c.

The servent implementation is still horrific, and we should
probably support protoent too so that debugging tools can use
getprotobyname/getprotobynumber.

Bug: N/A
Test: ran tests
Change-Id: I639108c46df0a768af297cf3bbce857cb1bef9d9
2017-10-15 10:37:51 -07:00
Elliott Hughes
bea6a12ee0 Merge "Implement <spawn.h>." am: 01bb7bf6fb am: 1f1c3a8b80
am: bb5e49fcde

Change-Id: I44b79c654dcda78ce45239bd2a1051cfd0c9c285
2017-10-12 21:31:46 +00:00
Elliott Hughes
01bb7bf6fb Merge "Implement <spawn.h>." 2017-10-12 21:02:54 +00:00
dimitry
b48bb2dae3 Merge "ns_anonymous test: Make it work for natively bridged environment" am: b49ac81c8e am: 1ac327aed7
am: 24837ada27

Change-Id: I3525fdbfff4ae1b41ef9525a1a742a1304016221
2017-10-12 17:42:32 +00:00
Treehugger Robot
b49ac81c8e Merge "ns_anonymous test: Make it work for natively bridged environment" 2017-10-12 17:26:32 +00:00
dimitry
8eaf28dc42 ns_anonymous test: Make it work for natively bridged environment
The executable flag might not be present for the executable segment
if the code is being handled by native bridge implementation. This
commit changes the test to restore executable flag for first segment
if it was removed.

Test: bionic-unit-tests
Change-Id: Ie930539135edc4db3245574b5cbe476aa1ad49c7
2017-10-12 15:02:16 +02:00
Tom Cherry
b02df314d3 Merge "Allow read-only system properties to have arbitrary lengths" am: a08f704e2a am: 127c1f940e
am: 4735c9291f

Change-Id: I2b7983aca2a54cd2119b0efb35b21b7f3e534939
2017-10-12 00:50:14 +00:00
Tom Cherry
a08f704e2a Merge "Allow read-only system properties to have arbitrary lengths" 2017-10-12 00:22:57 +00:00
Elliott Hughes
14e3ff9f09 Implement <spawn.h>.
As described here:

  http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html

And here:

  http://man7.org/linux/man-pages/man3/posix_spawn.3.html

Bug: N/A (but mentioned in my inbox since 2013)
Test: ran tests
Change-Id: I0b27b2919b660779e3bd8a25fb429527c16dc621
2017-10-11 14:57:49 -07:00
dimitry
9bff7d8814 Merge "Fix dlopen_vdso test" am: 1d297d2654 am: c46b602403
am: ab0a1d5cd6

Change-Id: I5fb27cd474afc34f6736aef8b227121f0cdf7260
2017-10-11 19:40:04 +00:00
Treehugger Robot
1d297d2654 Merge "Fix dlopen_vdso test" 2017-10-11 19:17:10 +00:00
dimitry
b9555a9251 Fix dlopen_vdso test
arm32 is still missing vdso (at least on some kernels).
This commit adds explicit check for it and skip the test
if AT_SYSINFO_EHDR is not set.

Test: run 32bit bionic-unit-tests --gtest_filter=dlfcn.dlopen_vdso on angler
Change-Id: I7fae78c6a4f819601a4ac9e8e1da53ff07c833ff
2017-10-11 18:04:05 +02:00
Kazuhiro Inaba
8bffeaba27 Merge "Fix fcntrl#tee test to use the same expected/actual buffer size." am: a52555d356 am: 67c73cde0b
am: a1933210ef

Change-Id: I0b77906eaa0b3019b7f8170d4199595918213a24
2017-10-10 23:56:08 +00:00
Treehugger Robot
a52555d356 Merge "Fix fcntrl#tee test to use the same expected/actual buffer size." 2017-10-10 23:32:52 +00:00
Tom Cherry
8a311631ed Allow read-only system properties to have arbitrary lengths
We need to be able to store build fingerprints that are over 92 characters
long, which is the current restriction for system property value
length.

Increasing the value maximum across the board has plenty of caveats,
particularly that an allocator would be required to handle
deallocation when replacing long property values with short values.
There is also no compelling reasons to do this.

But, increasing the length of simply read-only properties, such as the
build fingerprint, has less caveats as there will never be a
deallocation of these strings.

This change uses spare bits in the top of serial (only spare for
read-only properties) to indicate if a property is 'long' or not.  The
information required to access these 'long' properties is stored in a
union where the legacy property value is located.  An error message is
retained for legacy callers.

The new property is readable via __system_property_read_callback() and
most importantly android::base::GetProperty and higher level (Java,
`getprop`) callers.  All code should move to these higher level
functions as much as possible.

Bug: 23102347
Bug: 34954705
Test: bionic unit tests
Change-Id: Ia85e0d979b92afff601cc52b39114379617a0c64
2017-10-10 15:52:25 -07:00
Elliott Hughes
731bb0f4c4 Merge "More POSIX limits cleanup." am: 7181e53cfe am: 0b071dfeed
am: f19357a158

Change-Id: I3b87e39007f2aeafc468876046da9578885734c1
2017-10-06 02:29:41 +00:00
Elliott Hughes
aaf83e8051 More POSIX limits cleanup.
http://man7.org/linux/man-pages/man7/posixoptions.7.html is a very useful
quick reference to what these are supposed to mean.

Bug: http://b/32776472
Test: ran tests
Change-Id: Icea6812d6075e663885844d7424aa6cf73d6284a
2017-10-05 16:18:10 -07:00
Elliott Hughes
86ea76009a Merge "POSIX clock cleanup." am: 0a451314b0 am: 71830bea01
am: 4fc3146765

Change-Id: I5d05f3d6cc6d52100d6a816d27a3ed696c77e772
2017-10-05 21:02:05 +00:00
Elliott Hughes
0a451314b0 Merge "POSIX clock cleanup." 2017-10-05 20:45:39 +00:00
Elliott Hughes
3a8f75d8b0 POSIX clock cleanup.
The newest of these clocks was added in Linux 2.6.12, so no need for runtime
checks.

Add CTS tests that we can actually use the various clocks.

Bug: http://b/67458266
Test: ran tests
Change-Id: I3cfd7982043d6f8d4ebdc2b29e8722334f443ce5
2017-10-05 10:33:18 -07:00
Dan Willemsen
ebf1259a2a Merge "Make bionic tests build for linux_bionic" am: 7c6784061d am: 0b537c2773
am: ce5514d287

Change-Id: I30f5ef5add1058f391a83d2a196b730be9fbdf0b
2017-10-04 21:03:58 +00:00
Treehugger Robot
7c6784061d Merge "Make bionic tests build for linux_bionic" 2017-10-04 20:13:33 +00:00
Elliott Hughes
98b03efe12 Merge "Fix pthread_leak test flakiness." am: 11dfca4c4a am: 8863421ad1
am: fb88ac00df

Change-Id: If07a27a269d2cc90c8f624c5d3065ec9fac1de2f
2017-10-04 00:34:06 +00:00
Treehugger Robot
42f3bd0ffc Merge "Sync internal and external master." 2017-10-04 00:10:31 +00:00
Elliott Hughes
11dfca4c4a Merge "Fix pthread_leak test flakiness." 2017-10-04 00:04:59 +00:00
Dan Willemsen
268ae362cd Make bionic tests build for linux_bionic
Adds a necessary library, and disables the glibc host tests when
building for bionic host.

Bug: 31559095
Test: mmma bionic
Change-Id: Ie825db59a21bf8e9b4dbdadc63ff14bf8da23087
2017-10-03 16:30:21 -07:00
Elliott Hughes
6a571e7b19 Merge "Pre-size the vector in the pthread_create ENOMEM test." am: 48fbf91672 am: c56d884b97
am: 71fb19589b

Change-Id: Ib55c1f3dee0ed9988afbb87b79b936501028fc17
2017-10-03 22:39:30 +00:00
Elliott Hughes
5a7c950909 Sync internal and external master.
Not sure how this managed to cling on in AOSP master, but all the other
mentions of this constant in AOSP master are already expecting the new
value anyway.

Bug: N/A
Test: ran tests
Change-Id: I8b6b4b320eeb1c4cea1c06bea4c1e8e314ee344d
2017-10-03 15:19:02 -07:00
Jiyong Park
41704cdf61 Don't run exec_with_ld_config_file* tests on non-production devices
The tests that use LD_CONFIG_FILE environment variable shouldn't be run
on non-production devices because LD_CONFIG_FILE is only for debuggable
builds. We have used the build-time flag USE_LD_CONFIG_FILE, which is
set for the debuggable builds, to conditionally include or exclude the
tests. However, this can be a problem when 1) the device is not
debuggable but 2) the CTS itself is built with debuggable target. So,
instead of relying on the build-time flag USE_LD_CONFIG_FILE, the tests
now check the debuggability of the device and skip the tests when it
isn't debuggable.

Bug: 65842135
Test: 1) flash user build image to a 2017 pixel device.
2) build cts with 'userdebug' build target
3) CtsBionicTestCases pass on the device

(cherrypick of 5e3d44100be32fd5efffd0c309bd90c04cc9620c.)

Change-Id: Ib88e3b26d093e5479d52cd87db47dee5e108cac2
2017-10-03 15:03:44 -07:00
Elliott Hughes
a838490101 Fix pthread_leak test flakiness.
Stop allocating and deallocating memory as part of the test itself.

There's still the fopen, but since our stdio reuses existing structs,
that doesn't seem to be a problem in practice.

Bug: http://b/67077411
Test: ran tests with --gtest_repeat=1000
Change-Id: I99de5de0911161ec04afe75653075f1ccefb01a5
2017-10-03 13:51:45 -07:00
Elliott Hughes
575129886c Pre-size the vector in the pthread_create ENOMEM test.
Just to avoid the possibility of an unfortunate mmap occurring in order to
grow the vector.

Bug: N/A
Test: ran tests
Change-Id: I850740461d761916a0377272664159d010da7b84
2017-10-03 12:20:07 -07:00
Chih-Hung Hsieh
dfbff07c92 Merge "Use -Werror in bionic" am: 9385d778fd am: 7887421aed
am: a4fcd22ffd

Change-Id: I40302d02f9f70c2d020d029336c4c73816636de8
2017-10-02 22:28:38 +00:00
Treehugger Robot
9385d778fd Merge "Use -Werror in bionic" 2017-10-02 22:04:48 +00:00
Chih-Hung Hsieh
84f0dcd59e Use -Werror in bionic
Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: Ic68141a5c50880c485646e38349f94b866267bd9
2017-10-02 13:21:22 -07:00
dimitry
0de4982099 Merge "Replace abort with exit(1) in __linker_cannot_link" am: 95f90784ea am: 2161b032e0
am: 4eae0fc50a

Change-Id: I3ffe725ed2977cb211ba96d02dca03e7d4046547
2017-09-29 20:05:17 +00:00
Treehugger Robot
95f90784ea Merge "Replace abort with exit(1) in __linker_cannot_link" 2017-09-29 19:53:17 +00:00
Elliott Hughes
fa1d5e473b Merge "Require getrandom(2)." am: b93f2631e4 am: 3e6a64901a
am: b1fbb46d00

Change-Id: I5eb10e80c40fb838df97a9263d90151aa8e6d8fc
2017-09-29 19:12:39 +00:00
dimitry
04f7a798cf Replace abort with exit(1) in __linker_cannot_link
Bug: http://b/67038409
Test: bionic-unit-tests
Change-Id: I7d39b44f2da8c5111ac8a9faf3416f19d5a35c05
2017-09-29 19:48:46 +02:00
Elliott Hughes
89794c4239 Merge changes I76dde1e3,I54fec461 am: b3639adf9c am: a76e668634
am: 5f3eb36898

Change-Id: Ifed38d4fa8c7835b3771ea8112ea8270bb5c31e5
2017-09-29 17:10:58 +00:00
Elliott Hughes
6a5dfebd41 Require getrandom(2).
It's almost 2018, Linux 3.17 -- the first kernel with getrandom(2) --
was released in October 2014, and being able to assume getrandom lets
us simplify and improve some security-related code in libc, and revert a
hack to getentropy that's been necessary in the meantime. Only the fugu
kernel doesn't have getrandom(2) at this point, and that's EOL.

Bug: http://b/67014255
Test: ran tests
Change-Id: I1736f4dd33d50fe99e7a524851180989f4c85a33
2017-09-29 09:01:01 -07:00
Elliott Hughes
b3639adf9c Merge changes I76dde1e3,I54fec461
* changes:
  Add <sys/random.h>.
  Run other maintenance scripts as part of the preupload hooks.
2017-09-29 15:39:29 +00:00
Dan Willemsen
48343a80a7 Merge "Remove default libraries" am: bd2754177f am: 19e2c5b81b
am: 719ba0c39d

Change-Id: I2ce8a61f8d57fff26d1cb3255c5db6a4fb07cd8e
2017-09-29 09:55:27 +00:00
Elliott Hughes
8465e968a8 Add <sys/random.h>.
iOS 10 has <sys/random.h> with getentropy, glibc >= 2.25 has
<sys/random.h> with getentropy and getrandom. (glibc also pollutes
<unistd.h>, but that seems like a bad idea.)

Also, all supported devices now have kernels with the getrandom system
call.

We've had these available internally for a while, but it seems like the
time is ripe to expose them.

Bug: http://b/67014255
Test: ran tests
Change-Id: I76dde1e3a2d0bc82777eea437ac193f96964f138
2017-09-29 05:31:35 +00:00
Dan Willemsen
ae407e522a Remove default libraries
libdl is part of system_shared_libs now. -ldl -lpthread -lm are now defaults
for host_ldlibs on Linux and Darwin. -lrt is a default for host_ldlibs on
Linux.

Test: m host
Test: mmma bionic
Change-Id: I966e2f88c24fba5e412bee6b6382045a2026a8e4
2017-09-28 16:16:14 -07:00
Elliott Hughes
f43c91a035 Merge "Add <glob.h>." am: b736c41ffe am: a9b9b12728
am: 6122258c90

Change-Id: I6a7d5cd1610b779c4dc91b7f376947804a6c4cc1
2017-09-28 17:27:38 +00:00
Elliott Hughes
b736c41ffe Merge "Add <glob.h>." 2017-09-28 17:01:06 +00:00
Elliott Hughes
f1c568d1ea Add <glob.h>.
This is the FreeBSD implementation, plus some tests. The FreeBSD
implementation includes the GNU extensions and seems to be what
iOS is using too, which should provide bug compatibility for app
developers.

The code unfortunately uses a lot of stack, and uses FreeBSD locale
implementation that we don't have, but it does seem better maintained
than the other BSDs.

Bug: http://b/29251134
Test: ran tests
Change-Id: Ie477b45e42a6df1319b25712098519d2b33adf67
2017-09-26 18:46:09 -07:00
dimitry
df775eda92 Merge "Link vdso before linking the main executable" am: 62767bc31d am: 348161ed3c
am: ce97d243f1

Change-Id: Ic65207315cd9cb03d77f305428d73d6cb0936bac
2017-09-26 17:20:29 +00:00
dimitry
c18de1bd47 Link vdso before linking the main executable
Also set linked flag after it is linked and
call constructors. Set RTLD_NODELETE flag to
prevent accidental unloads.

Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Test: bionic-unit-tests-glibc --gtest_filter=dl*
Change-Id: Ib2178849b918cbefd6f8fcfe6d1f78889fe0bf76
2017-09-26 14:34:18 +02:00
Kazuhiro Inaba
f7a8e95fe8 Fix fcntrl#tee test to use the same expected/actual buffer size.
Previously the test compared /proc/version read into expected[256]
with actual[BUFSIZ]. This CL aligns the both of the buffer sizes to
the same BUFSIZ, so that /proc/version longer than 256 bytes won't
result in a test failure.

Bug: 66872345
Test: fcntl#tee on a device with long /proc/version (Chromebook Plus)
Change-Id: I004dd2189565b0bdde1aa22a2f25fafe74560180
(cherry picked from commit 85a08ae9fead3f24daf108108257e4793a192e5f)
2017-09-25 23:34:19 +00:00
Jiyong Park
84bc230f27 Merge "Don't run exec_with_ld_config_file* tests on non-production devices" into oc-mr1-dev
am: 146fa6b458

Change-Id: Ife179503595f1652e3eaa0bc395e0a03bc1ffca5
2017-09-21 05:24:26 +00:00
TreeHugger Robot
146fa6b458 Merge "Don't run exec_with_ld_config_file* tests on non-production devices" into oc-mr1-dev 2017-09-21 05:17:21 +00:00
Jiyong Park
5e3d44100b Don't run exec_with_ld_config_file* tests on non-production devices
The tests that use LD_CONFIG_FILE environment variable shouldn't be run
on non-production devices because LD_CONFIG_FILE is only for debuggable
builds. We have used the build-time flag USE_LD_CONFIG_FILE, which is
set for the debuggable builds, to conditionally include or exclude the
tests. However, this can be a problem when 1) the device is not
debuggable but 2) the CTS itself is built with debuggable target. So,
instead of relying on the build-time flag USE_LD_CONFIG_FILE, the tests
now check the debuggability of the device and skip the tests when it
isn't debuggable.

Bug: 65842135
Test: 1) flash user build image to a 2017 pixel device.
2) build cts with 'userdebug' build target
3) CtsBionicTestCases pass on the device

Change-Id: Ib88e3b26d093e5479d52cd87db47dee5e108cac2
2017-09-21 11:57:38 +09:00
Elliott Hughes
bd8391f80d Merge "Improve pthread_create failure handling." am: e27d29cfaf am: 87c0bddba9
am: 30c907352c

Change-Id: I37cb864fbfae7ced32ef020816f03fc484fee4f5
2017-09-19 23:57:30 +00:00
Treehugger Robot
e27d29cfaf Merge "Improve pthread_create failure handling." 2017-09-19 23:44:23 +00:00
Evgenii Stepanov
4994552198 Extend cfi test to verify a range of target pointers.
Test: bionic device tests
Bug: 63400743
Bug: 65590288

(cherry picked from commit 1dfd76ac2c)

Change-Id: I33832ef9ab98baf52afe969ea7a03fe419f93cb2
2017-09-19 16:21:22 -07:00
Evgenii Stepanov
6b230cd2de Merge "Extend cfi test to verify a range of target pointers." am: 1ec162d392 am: 8f9268c0f3
am: 86abadb822

Change-Id: Ic676701b948b04b9d8afd07b785cf1a14f2249e2
2017-09-19 22:54:00 +00:00
Elliott Hughes
53dc9dd701 Improve pthread_create failure handling.
Return EAGAIN rather than aborting if we fail to set up the TLS for a new
thread.

Add a test that uses all the VMAs so we can properly test these edge cases.

Add an explicit test for pthread_attr_setdetachstate, which we use in the
previous test, but other than that has no tests.

Remove support for ro.logd.timestamp/persist.logd.timestamp, which doesn't
seem to be used, and which prevents us from logging failures in cases where
mmap fails (because we need to mmap in the system property implementation).

Bug: http://b/65608572
Test: ran tests
Change-Id: I9009f06546e1c2cc55eff996d08b55eff3482343
2017-09-19 14:02:50 -07:00
Evgenii Stepanov
1dfd76ac2c Extend cfi test to verify a range of target pointers.
Test: bionic device tests
Bug: 63400743
Bug: 65590288
Change-Id: Ic4ef9630a2db709cf4edcc7f76c791df3f349192
2017-09-19 13:59:34 -07:00
Elliott Hughes
1deb26e6ff Merge "Support larger guard regions." am: dacbb04cde am: 951f4af9ce
am: eadf51ccbe

Change-Id: Ib4e8e1d35be5fad89deb25ff284939dddb94dd01
2017-09-19 01:17:55 +00:00
Treehugger Robot
dacbb04cde Merge "Support larger guard regions." 2017-09-19 01:08:25 +00:00
Elliott Hughes
d6c678ca90 Support larger guard regions.
This also fixes a long-standing bug where the guard region would be taken
out of the stack itself, rather than being -- as POSIX demands -- additional
space after the stack. Historically a 128KiB stack with a 256KiB guard would
have given you an immediate crash.

Bug: http://b/38413813
Test: builds, boots
Change-Id: Idd12a3899be1d92fea3d3e0fa6882ca2216bd79c
2017-09-18 16:09:43 -07:00
Elliott Hughes
f810219ce7 Merge "Always log errno when aborting." am: 0c9ea17e0c am: 002b30843b
am: 5d1cf56ce5

Change-Id: I1999c656307aea0a0a0372248d65a05657546e59
2017-09-18 21:44:57 +00:00
Elliott Hughes
b89260790d Merge "Use __RENAME for long double functions." am: df862454b6 am: c4287cec82
am: 79dd9b7c0e

Change-Id: Icc362b01d39427f79cbea235cc54a14274df560e
2017-09-18 21:44:38 +00:00
Treehugger Robot
0c9ea17e0c Merge "Always log errno when aborting." 2017-09-18 21:33:54 +00:00
Elliott Hughes
df862454b6 Merge "Use __RENAME for long double functions." 2017-09-18 21:33:06 +00:00
Elliott Hughes
7b0af7ad82 Always log errno when aborting.
(Where errno is relevant.)

Also consistently use -1 as the fd for anonymous mmaps. (It doesn't matter,
but it's more common, and potentially more intention-revealing.)

Bug: http://b/65608572
Test: ran tests
Change-Id: Ie9a207632d8242f42086ba3ca862519014c3c102
2017-09-15 16:18:49 -07:00
Bill Yi
5828840e72 Merge remote-tracking branch 'aosp/oreo-cts-dev' into HEAD 2017-09-15 13:44:31 -07:00
Elliott Hughes
50cda38f1d Use __RENAME for long double functions.
We can cut a lot of stuff out of the NDK's libandroid_support with this,
and reduce unnecessary relocations for all LP32 code. LP64 code should
be unaffected.

Bug: https://issuetracker.google.com/64450768
Bug: https://github.com/android-ndk/ndk/issues/507
Test: ran tests, plus manual readelf on the _test.o files
Change-Id: I3de6015921195304ea9c829ef31665cd34664066
2017-09-14 16:10:43 -07:00
Lennart Wieboldt
9deb345edd Merge "Remove clang: true" am: 7e6f98b93d am: af4de40428
am: fbf0f50632

Change-Id: I9b11125cf544029b93f28e943a1b0ddfa0fb6bc4
2017-09-11 22:04:13 +00:00
Lennart Wieboldt
af4de40428 Merge "Remove clang: true"
am: 7e6f98b93d

Change-Id: Ib97ff76648505fa29d7e764ecaeabe2a1ea84906
2017-09-11 21:48:09 +00:00
Treehugger Robot
7e6f98b93d Merge "Remove clang: true" 2017-09-11 21:39:41 +00:00
Lennart Wieboldt
2286b9f5ae Remove clang: true
clang is the default compiler since Android nougat

Test: mma & verified it´s still build with clang
Change-Id: Id8b5361d18c1b2febb2dc6cc44502feaa08f605c
Signed-off-by: Lennart Wieboldt <lennart.1997@gmx.de>
2017-09-11 21:43:58 +02:00
Elliott Hughes
3cf002aef5 Merge "Finish <search.h>." am: 4c9d528a25 am: 9b0889c7bd
am: 886d1b5b63

Change-Id: I1d74385fe8f6a09b621097dd92c21b3daee79a6d
2017-09-11 18:50:51 +00:00
Elliott Hughes
9b0889c7bd Merge "Finish <search.h>."
am: 4c9d528a25

Change-Id: I39f10ca14b88d4c9075e83105f3b7101da610269
2017-09-11 18:40:59 +00:00
Elliott Hughes
4c9d528a25 Merge "Finish <search.h>." 2017-09-11 18:39:30 +00:00
Elliott Hughes
df71545eba Merge "Trivial tests for <inttypes.h>/<stdlib.h> *abs and *div functions." am: 60103831eb am: 5398ead784
am: c7ad49251e

Change-Id: Ib7cdf6e0671ed4966b62611f9368ac22dd05ab52
2017-09-08 20:03:07 +00:00
Elliott Hughes
5398ead784 Merge "Trivial tests for <inttypes.h>/<stdlib.h> *abs and *div functions."
am: 60103831eb

Change-Id: I5542305cc9142072613267346f4bdfad8748a2a0
2017-09-08 19:43:06 +00:00
Elliott Hughes
00d8a8b779 Trivial tests for <inttypes.h>/<stdlib.h> *abs and *div functions.
Because I want something to copy & paste into the NDK support library test
that's slightly better than taking the address of the function...

Bug: https://github.com/android-ndk/ndk/issues/502
Test: ran tests
Change-Id: If43089d16691d6a4dcf5d972450b14ed85bbca81
2017-09-07 17:01:37 -07:00
Elliott Hughes
5702c6ff45 Finish <search.h>.
I'm unable to find a bug, but we've had requests for this internally
once or twice (though I pointed those folks at the STL), and there's
code we build for the host or in our bootloaders that would use this,
and there's reasonable-looking FreeBSD implementation ready and waiting.

Bug: N/A
Test: ran tests
Change-Id: I6ddee4b71bea4c22ed015debd31d3eaac4fcdd35
2017-08-31 17:38:51 -07:00
Elliott Hughes
cfffa48498 Merge "Add an extra test for a POSIX iconv requirement." am: b20c246fc9 am: 44022d3d1d
am: eee0f02f11

Change-Id: Ide2dd71edc5d0e2869e3b95c76c23bbfdfc12d8c
2017-09-01 00:00:03 +00:00
Elliott Hughes
44022d3d1d Merge "Add an extra test for a POSIX iconv requirement."
am: b20c246fc9

Change-Id: Iec293ed1cc9b0b7611f76f02839a69ba6495787f
2017-08-31 23:52:35 +00:00
Treehugger Robot
b20c246fc9 Merge "Add an extra test for a POSIX iconv requirement." 2017-08-31 23:45:27 +00:00
Elliott Hughes
d40a833ab0 Add an extra test for a POSIX iconv requirement.
Bug: N/A
Test: ran tests
Change-Id: If211bf2a74ac3a6e8e84375c88f6c2580c392d50
2017-08-31 14:14:16 -07:00
Jiyong Park
7f1e941ab6 Make dlext.ns_shared be independent of default namespace config
am: 917d34a84f

Change-Id: I1b459654147912c5a8169126773e585bc5364f2a
2017-08-31 18:13:05 +00:00
Jiyong Park
917d34a84f Make dlext.ns_shared be independent of default namespace config
dlext.ns_shared creates a child namespace, which is isolated & shared,
from the default namespace. It then checks whether a lib that was loaded
in the parent(=default) namespace *after* the child namespace is created
is not accessible to the child namespace. Because this test is using the
default namespace as a parent namespace, the test result is dependent on
the specific configuration of the default namespace, which isn't
desirable.

Specifically, since ANDROID_NAMESPACE_TYPE_SHARED now copies search
paths and permitted paths of the parent namespace to the child namespace,
a lib that is accessible to the former is also accessible to the latter
even if the lib hasn't been shared when creating the latter. So, the
result of the test varies depending on whether the default namespace has
permitted paths or not. (if it is configured as an isolated namespace
and has permitted paths, then the test fails).

In order to make this test be independent from how the default namespace
is configured, a parent namespace is explicitly created and the child
namespaces are created from the parent namespace, not from the default
namespace.

Bug: 65189955
Test: bionic-unit-tests --gtest_filter=dlext.ns_shared successful
Test: the same test successful when the default namespace is configured
as follows
namespace.default.isolated = true
namespace.default.permitted_paths = ...:/data

Change-Id: Ifa33c6c42f8c327b2b1c380c7abba8e8f1afee82
2017-08-31 14:11:49 +09:00
Jiyong Park
e1c82be90b Merge "Don't run disable_ld_config_file test on non-production devices"
am: 7f9f1b6f91

Change-Id: I256ad6da2e890d4b50b5aaa9ae47a3e64253538e
2017-08-31 00:08:29 +00:00
Treehugger Robot
7f9f1b6f91 Merge "Don't run disable_ld_config_file test on non-production devices" 2017-08-30 23:57:40 +00:00
Jiyong Park
ac184dd383 Merge "Don't run disable_ld_config_file test on non-production devices" into oc-mr1-dev
am: 4ce79ba154

Change-Id: I517179e1b527dfe8d88f9048f6c9fcf6b7252b56
2017-08-30 19:06:53 +00:00
Elliott Hughes
f4eb1c7554 Merge "Use have_dl to guard all tests that rely on icu4c." am: b3aea2bb9a am: 6446acf814
am: b1958d2277

Change-Id: I94ffc7a1e4c1bb9b42359eec805a475618cc6749
2017-08-30 18:47:23 +00:00
Elliott Hughes
6446acf814 Merge "Use have_dl to guard all tests that rely on icu4c."
am: b3aea2bb9a

Change-Id: Ib5c30b73698e98e54fc4e2a9f0287683a2923caa
2017-08-30 18:33:33 +00:00
Treehugger Robot
b3aea2bb9a Merge "Use have_dl to guard all tests that rely on icu4c." 2017-08-30 18:22:37 +00:00
Jiyong Park
4945d8f121 Don't run disable_ld_config_file test on non-production devices
The test always fails when run on non-production devices. Silence the
expected failure.

Bug: 64908138
Test: run CtsBionicTestCases on userdebug device. disable_ld_config_file
test does not fail.

Merged-In: Icd24a356dfbc62f540e3263070434a4fd065bfbc
Change-Id: Icd24a356dfbc62f540e3263070434a4fd065bfbc
(cherry picked from commit 157655dc67)
2017-08-31 01:42:55 +09:00
Elliott Hughes
ded2e6c7bb Merge "Add tests for all C11 headers." am: 76a4bb980c am: ed7a15453d
am: 6b1f428dd3

Change-Id: I6b2e61a1f7776f83e7d4b21479df72dea2a160a8
2017-08-30 16:23:25 +00:00
Elliott Hughes
966d8a321e Use have_dl to guard all tests that rely on icu4c.
Bug: http://b/65138342
Test: ran tests
Change-Id: Iddded068a2481e8b15e102c8705545a886ae2772
2017-08-30 16:17:40 +00:00
Elliott Hughes
ed7a15453d Merge "Add tests for all C11 headers."
am: 76a4bb980c

Change-Id: I44c85180e90d5f635ecd2223a8de011a007d4214
2017-08-30 16:07:53 +00:00
Jiyong Park
157655dc67 Don't run disable_ld_config_file test on non-production devices
The test always fails when run on non-production devices. Silence the
expected failure.

Bug: 64908138
Test: run CtsBionicTestCases on userdebug device. disable_ld_config_file
test does not fail.

Change-Id: Icd24a356dfbc62f540e3263070434a4fd065bfbc
2017-08-30 11:30:53 +09:00
Elliott Hughes
45da326324 Add tests for all C11 headers.
Well, all except <threads.h> which we have no current plans to implement.

The only thing this turned up is that clang's <float.h> doesn't define
FLT_HAS_SUBNORM/DBL_HAS_SUBNORM/LDBL_HAS_SUBNORM, so for now we assert
that those are missing so that when we get a fixed clang, we notice.

Also the <tgmath.h> is utterly perfunctory, but seems like an appropriate
amount of effort to put in.

Bug: N/A
Test: ran tests
Change-Id: I7f7a7040b3271ceda625bee8a40a9d8cef52ee44
2017-08-29 15:32:18 -07:00
Elliott Hughes
0977c8baa1 Merge "Implement <iconv.h>." am: d615a06068 am: 94e366e616
am: 01987bfc77

Change-Id: I1c9a36ed0123db89aec989e74ddd40cd789760ab
2017-08-25 21:16:07 +00:00
Elliott Hughes
94e366e616 Merge "Implement <iconv.h>."
am: d615a06068

Change-Id: I22e3bf2d373c752115c27f0d5c9cb6a9b1ea3c76
2017-08-25 21:11:39 +00:00
Elliott Hughes
a648733cb7 Implement <iconv.h>.
Bug: http://b/32978596
Test: ran tests
Change-Id: I56b6ae3d9c5a3a56d2b4afba33fb8f9e964bf7b9
2017-08-25 08:47:41 -07:00
Elliott Hughes
1a61d3e26b Merge "Add syncfs(2)." am: fa3d3291e1 am: 1d1f15ab1b
am: cbea75b46b

Change-Id: Ic2a4c90bf1cfadc72cfba60558f751bc9604a2c5
2017-08-25 15:06:06 +00:00
Elliott Hughes
1d1f15ab1b Merge "Add syncfs(2)."
am: fa3d3291e1

Change-Id: I6ac91294e9cf5ff8d0b44fc3ddc46b6ee3fbd9bf
2017-08-25 14:56:34 +00:00
Elliott Hughes
896362eb0e Add syncfs(2).
GMM calls this system call directly at the moment. That's silly.

Bug: http://b/36405699
Test: ran tests
Change-Id: I1e14c0e5ce0bc2aa888d884845ac30dc20f13cd5
2017-08-24 16:31:49 -07:00
George Burgess IV
bc67a8422a Merge "tests: explain how to debug FileCheck failures" am: 96c577c482 am: 2b5441276c
am: 4c63cd1158

Change-Id: Icae45f024a1ad25b59c450ca6d9f4b0c41ec119e
2017-08-24 18:19:54 +00:00
George Burgess IV
2b5441276c Merge "tests: explain how to debug FileCheck failures"
am: 96c577c482

Change-Id: Ie7b823205860b047c36148fdf73434b3a8a4b58f
2017-08-24 18:10:24 +00:00
George Burgess IV
c7bd90ff6f tests: explain how to debug FileCheck failures
As requested by enh@ in Ie9ed1fbcc794e14a0c9bba13b5307ad677949613.

Bug: None
Test: mma
Change-Id: I3beb97fb500faa50d79f9355898bf778ab1184bd
2017-08-24 00:36:15 +00:00
Logan Chien
7b7eea1e3d Merge "Fix wchar.wcstold_hex_floats on arm64" am: 96ba713f73 am: dbe3d36999 am: afea670564
am: 07b15a3f74

Change-Id: I6abdedc7c77a3c3a0a0b2382742f5b7652b95492
2017-08-23 07:32:58 +00:00
Logan Chien
afea670564 Merge "Fix wchar.wcstold_hex_floats on arm64" am: 96ba713f73
am: dbe3d36999

Change-Id: I356c1475adf2950988fa238ae81b8b8b833720ba
2017-08-23 07:26:57 +00:00
Logan Chien
96ba713f73 Merge "Fix wchar.wcstold_hex_floats on arm64" 2017-08-23 07:16:34 +00:00
Christopher Ferris
1f17049808 Merge "Refactor BufferOutputStream." am: 1b3fe44e3d am: a3c50668cf am: 3884fe23ba
am: 476cff09e6

Change-Id: I3a53acc5bf834792c6ddc85658bf6dc903d59c6e
2017-08-22 23:40:09 +00:00
Christopher Ferris
3884fe23ba Merge "Refactor BufferOutputStream." am: 1b3fe44e3d
am: a3c50668cf

Change-Id: Ia6d7243f1791fb47e62e67044a068e48774c180a
2017-08-22 23:21:29 +00:00
Christopher Ferris
1b3fe44e3d Merge "Refactor BufferOutputStream." 2017-08-22 22:50:32 +00:00
Christopher Ferris
9247640711 Refactor BufferOutputStream.
- Rewrite BufferOutputStream to handle 0 sized buffers and to get rid
  of an unnecessary loop.
- Add tests to verify overflow corner cases.
- Implement async_safe_format_buffer to call async_safe_format_buffer_va_list
  instead of duplicate the code.

Test: Ran new unit tests, booted on angler.
Change-Id: I7fb13e209f5b7443d212f55aab4b05ff2e0e8219
2017-08-22 13:17:28 -07:00
Logan Chien
0288dbb739 Fix wchar.wcstold_hex_floats on arm64
This commit fixes wchar.wcstold_hex_floats on arm64.  On AArch64
(ARM64), the `long double` type has 128 bits and is more precise then
`double` type (64-bit).  As a result, `1e100L` is slightly different
from `static_cast<long double>(1e100)`.

This commit fixes the regression by adding 'L' after the floating point
literals.  This should work because casting from a higher precision
to lower precision won't lose any precisions.

Test: adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests \
  --gtest-filter=wchar.wcstold_hex_floats
Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Test: adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests

Change-Id: Ibd7b6a5d46c38338b4ca56838d9d272c710b32f6
2017-08-22 17:52:02 +08:00
George Burgess IV
d9e9dcc559 Merge "Disable FORTIFY on ASAN builds" am: 7ac99d3ff6 am: 411814e0a9 am: 8060209ab2
am: a07c6a9680

Change-Id: I6db0200a35221a24067780b38caead5f69060b5f
2017-08-18 23:05:11 +00:00
George Burgess IV
8060209ab2 Merge "Disable FORTIFY on ASAN builds" am: 7ac99d3ff6
am: 411814e0a9

Change-Id: Ia5ef40f1402fedb6946654033b5c2c4e8ef2c4e3
2017-08-18 23:00:10 +00:00
George Burgess IV
411814e0a9 Merge "Disable FORTIFY on ASAN builds"
am: 7ac99d3ff6

Change-Id: Ib469956edc364bd0d4af59dc5a79439528bf5efd
2017-08-18 22:58:12 +00:00
George Burgess IV
d9551db089 Disable FORTIFY on ASAN builds
FORTIFY's *_chk functions mess with ASAN's library function
interceptors, which can apparently result in false-positives.

Since adding even more complexity to every run-time check condition in
FORTIFY doesn't seem like a great idea, and the majority of our builds
will still use FORTIFY anyway, turning FORTIFY off here seems
reasonable.

Bug: 63104159
Test: checkbuild on internal master + CtsBionicTestCases. No new
failures.

Change-Id: Id32e551e28ee70a9815ad140c3253b86f03de63f
2017-08-18 13:33:45 -07:00
Evgenii Stepanov
115e0e785a [cfi] Export __cfi_shadow_size.
__cfi_shadow_size returns the size of the CFI shadow mapping, or 0 if
CFI is not (yet) used in this process. This can be used to adjust
RLIMIT_AS setting.

Test: device bionic tests
Bug: 64293803

(cherry picked from commit 97c16f8dca)

Change-Id: Ia82152f568e3a80deb902d02fa400e88e3f556bc
2017-08-17 17:34:52 -07:00
Evgenii Stepanov
fbf9c064ad Merge changes from topic "cfi-shadow-size" am: fc89237b77 am: 62adbbf5e8 am: b502d57d7f
am: 0730f0ce6d

Change-Id: Ib33ab43015edefb91c930b4a0a3453aeb905fe78
2017-08-17 00:54:07 +00:00
Evgenii Stepanov
b502d57d7f Merge changes from topic "cfi-shadow-size" am: fc89237b77
am: 62adbbf5e8

Change-Id: I8efeadc018b296b6875f3837e62bdbd8fab2f75d
2017-08-17 00:42:14 +00:00
Evgenii Stepanov
62adbbf5e8 Merge changes from topic "cfi-shadow-size"
am: fc89237b77

Change-Id: I34c706c542e338616d07035e5209d727a43c69bb
2017-08-17 00:37:59 +00:00
Treehugger Robot
fc89237b77 Merge changes from topic "cfi-shadow-size"
* changes:
  Revert "Revert "arm64: expand CFI shadow to cover 48-bit virtual addresses""
  [cfi] Export __cfi_shadow_size.
2017-08-17 00:16:56 +00:00
George Burgess IV
0f2f92c5c8 Merge "libc fortify: error on realpath(NULL, foo)" am: 6beab08440 am: 87fcfefe26 am: ff69b4fefc
am: fdc35cb9f4

Change-Id: I553b2237a1c4b949d9e4741506fdf4980776212c
2017-08-15 18:12:04 +00:00
George Burgess IV
ff69b4fefc Merge "libc fortify: error on realpath(NULL, foo)" am: 6beab08440
am: 87fcfefe26

Change-Id: I289b496e80533d3fe45781f9b86d000e25c5dfbd
2017-08-15 17:50:31 +00:00
George Burgess IV
87fcfefe26 Merge "libc fortify: error on realpath(NULL, foo)"
am: 6beab08440

Change-Id: I50cf25955d28df10661e08579fac001f7abdab5f
2017-08-15 17:45:01 +00:00
George Burgess IV
95bd4884b5 libc fortify: error on realpath(NULL, foo)
I've half a mind to make this a warning instead, since this sort of
call isn't UB. That said:
- if the user really wants this (I can't imagine why they would), they
  can just put NULL in a non-const variable,
- we're slowly moving to -Werror ~everywhere anyway, and
- it's presumably easier to change this from an error to a warning than
  the other way around

Bug: 12231437
Test: m checkbuild on bullhead internal master. No new
CtsBionicTestCases failures.

Change-Id: Ie8bf5a3455f663686fda4a7450fb35d147fa745e
2017-08-14 14:48:55 -07:00
Elliott Hughes
68ab54444a Fix the sysconf _SC_2_VERSION test.
Not sure how this ended up broken. Too many branches!

Bug: http://b/64565873
Test: ran tests

(cherry picked from commit 6c135f4c41)

Change-Id: Ie7078541d2a75fb2fbcf03e78a49707307b674c0
2017-08-10 14:33:15 -07:00
Dan Albert
f95cedade4 Merge changes I36924c4b,Ib6bdd09e am: 32f719ad1a am: 2104cf6795 am: 12dc66bceb
am: e5ba6f1adb

Change-Id: I3ef7554da3689455877a0f51e1bb92d73206bf06
2017-08-10 02:20:56 +00:00