Commit graph

1789 commits

Author SHA1 Message Date
Victor Khimenko
1d7b359d50 Merge "Fix bionic-unit-tests in arch with binary translator" am: 3c0363d7fd am: cfe98d3195
am: 7d3fdfe4a6

Change-Id: If11ccbf9f02d6dfe51aac0c176e1402684622e52
2017-01-26 10:23:40 +00:00
Victor Khimenko
14b9d7199c Fix bionic-unit-tests in arch with binary translator
If binary translator is involved then libc is not place in /system/lib
or /system/lib64.  It's placed into /syste/lib/arm, /system/lib/arm64,
etc.  FUGU is an example of such an architecture.

Support both cases by picking right path at runtime.

Test: run bionic-unit-tests --gtest_filter=dlfcn.dladdr_libc
Change-Id: I8345c0f6c19376ebe5106f9670fd2addeb9b9080
2017-01-25 20:57:48 +01:00
Victor Khimenko
8fbdf994b0 Merge "Fix bionic-unit-tests in some non-standard builds" am: 18c009ca96 am: dc7ec2bb8a
am: 221eef03da

Change-Id: I102cc36b84f00038e3c0d65bf777be6e76bf01ee
2017-01-25 10:13:34 +00:00
Victor Khimenko
18c009ca96 Merge "Fix bionic-unit-tests in some non-standard builds" 2017-01-25 10:05:41 +00:00
Dimitry Ivanov
9ba0428a55 Do not send 0 byte string content. am: cafd355375 am: 6fd88344a5
am: 8dba8acd6e

Change-Id: Ida48c2f6dd8a9c65a87c13bff0f67f6b597ba7fa
2017-01-25 04:04:01 +00:00
Dimitry Ivanov
ac7fdd2121 Revert "Revert "Remove limit of system property name length"" am: 16b2a4de14 am: d91e7766ec
am: c809b7a43f

Change-Id: Ic91631717fae0dea66ae970a99e67e178ffedd4f
2017-01-25 04:03:51 +00:00
Dimitry Ivanov
cafd355375 Do not send 0 byte string content.
Trying to send even 0 bytes to closed socket leads to
broken pipe error. Sometimes property service is just
quick enough and closes the socket between send(valuelen)
and send(value) in the case where valuelen is 0.

Bug: http://b/34670529
Test: adb reboot 20 times and make sure phone service did not fail
Test: run bionic-unit-tests --gtest_filter=prop*
Change-Id: I96f90ca6fe1790614e7efd3015bffed1ef1e9040
2017-01-24 14:19:03 -08:00
Victor Khimenko
65273fb630 Fix bionic-unit-tests in some non-standard builds
The binary bionic-unit-tests is linked with some shared libraries
and these libraries are found in ${ORIGIN}/../bionic-loader-test-libs
directory specified by runpath.  This makes it higly unlikely that
anyone would be run these files when ${ORIGIN}/../bionic-loader-test-libs
does not include proper files.

Bug: http://b/34681268
Test: run bionic-unit-tests --gtest_filter=dl*:Dl*

Change-Id: I52fc31339fdfa232c0fdafa218eadaeaf5551a8d
2017-01-24 22:20:03 +01:00
Dimitry Ivanov
16b2a4de14 Revert "Revert "Remove limit of system property name length""
This reverts commit 489f58b5ea.
Bug: http://b/33926793
Bug: http://b/34670529
Test: Run bionic-unit-tests --gtest_filter=prop*

Change-Id: Id4e94652dc2310a21f5b7bd3af098bf79df3f380
2017-01-24 12:58:18 -08:00
Dimitry Ivanov
5313299f01 Merge "Revert "Remove limit of system property name length"" am: 40250bb683 am: e3a684f858
am: 205bb70df8

Change-Id: Ic33f6f20210fb37dde324b79a92bcd06caad9514
2017-01-24 20:09:08 +00:00
Dimitry Ivanov
40250bb683 Merge "Revert "Remove limit of system property name length"" 2017-01-24 20:00:44 +00:00
Dimitry Ivanov
489f58b5ea Revert "Remove limit of system property name length"
This reverts commit 5c1ce278f3.
Bug: http://b/33926793
Bug: http://b/34670529

Change-Id: I0dc4a8ae55576c69b34b2958d8e664f7066b9c54
2017-01-24 18:39:04 +00:00
Dimitry Ivanov
6b497a705e Merge "Remove limit of system property name length" am: 440d6c7644 am: 87190c845e
am: eda500fdf9

Change-Id: I15823d5f19f592465f17441429635d5085080060
2017-01-24 03:00:22 +00:00
Dimitry Ivanov
440d6c7644 Merge "Remove limit of system property name length" 2017-01-24 02:54:34 +00:00
Dimitry Ivanov
4da4cb0735 Merge "Remove libc++ dependency from prebuilt test-libs" am: 8bb01c0719 am: 865ceb0c1b
am: 633c9f6999

Change-Id: I8d3839e322dedfc36d57e1e25f4dd84dfb0db258
2017-01-24 00:46:43 +00:00
Dimitry Ivanov
985c05f956 Merge "Mark ifunc tests failing on arm as known failures" am: 3685e4515f am: c3f26cb41e
am: 0fd876c9c9

Change-Id: Ibc3cb3952258a4f75968cd41fb98773a395d2fa1
2017-01-24 00:46:33 +00:00
Treehugger Robot
8bb01c0719 Merge "Remove libc++ dependency from prebuilt test-libs" 2017-01-24 00:36:00 +00:00
Dimitry Ivanov
01c888c857 Mark ifunc tests failing on arm as known failures
Bug: http://b/27930475
Test: run bionic-unit-tests on arm and arm64
Change-Id: I5084b6a5ef4b56ca9985da63a5e6896f771810f0
2017-01-23 14:52:07 -08:00
Dimitry Ivanov
bfe8680564 Remove libc++ dependency from prebuilt test-libs
Bug: http://b/27549327
Test: run bionic-unit-tests --gtest_filter=dl*:Dl* on angler
Change-Id: Ia09ed2c00213bc07bf2a4c772e675419f7a30cb3
2017-01-23 14:47:45 -08:00
Dimitry Ivanov
5c1ce278f3 Remove limit of system property name length
This change introduces new __system_property_read_callback
method to use in place of deprecated __system_property_read
__system_property_set() and get() should just work but now
do not have limit on system property names.

Bug: http://b/33926793
Test: boot device, run adb shell propget
Test: boot device with old version of init (protocol v1)
Test: run bionic-unit-tests --gtest_filter=prop*
Change-Id: I619fb5a7e27a272aac30011579665f6160888bc7
2017-01-23 11:21:18 -08:00
Evgenii Stepanov
a6711474a1 Merge "Runtime support for CFI" am: 082bec5b41 am: adcec1585b
am: 992d012f80

Change-Id: I104ec5d0a128ddfba0033b3df882c7efcb158f2e
2017-01-19 00:02:15 +00:00
Josh Gao
ba2ab9e37e Rename libdebuggerd_client to libdebuggerd_handler. am: 2a3b4fa6ec am: 3560ff90f0
am: 4a5699ab52

Change-Id: I72a704e119361d579bd2fa774b74a9d5c78413b0
2017-01-18 23:55:14 +00:00
Evgenii Stepanov
082bec5b41 Merge "Runtime support for CFI" 2017-01-18 23:39:08 +00:00
Evgenii Stepanov
0a3637d3eb Runtime support for CFI
Control Flow Integrity support in bionic.

General design:
http://clang.llvm.org/docs/ControlFlowIntegrityDesign.html#shared-library-support

This CL implements subsections "CFI Shadow" and "CFI_SlowPath" in the above document.

Bug: 22033465
Test: bionic device tests
Change-Id: I14dfea630de468eb5620e7f55f92b1397ba06217
2017-01-18 13:13:52 -08:00
Josh Gao
2a3b4fa6ec Rename libdebuggerd_client to libdebuggerd_handler.
Bug: http://b/30705528
Test: debuggerd_test
Change-Id: I625a9a2e7304d172873ba9344b74efa57ad7bdad
2017-01-17 15:11:46 -08:00
Yabin Cui
203d0232db Merge "Switch bionic-unit-tests to libc++_static." am: 37f1d11482 am: 820c7fae07
am: 5ec22b1eed

Change-Id: Ib570bc2a2e59905e69a93e72ab61afd0f8e98bac
2017-01-14 02:30:05 +00:00
Yabin Cui
1f553ea5da Switch bionic-unit-tests to libc++_static.
Bug: http://b/27549327
Test: run bionic-unit-tests, bionic-unit-tests-glibc.
Change-Id: I719899624dec83728a3d5b8169079e5c91c63c04
2017-01-13 12:34:36 -08:00
Pavel Labath
2125377c98 Merge "Beef up process_vm_readv/writev tests" am: a970ac50d1 am: 8557ee78ec
am: d779d1c037

Change-Id: Ifedc2116503c8795d3f020e2142add03d937a372
2017-01-13 10:30:16 +00:00
Pavel Labath
cc441001c0 Beef up process_vm_readv/writev tests
LLDB uses process_vm_readv quite extensively (it's an order of
magnitude faster than PTRACE_PEEKDATA). Add a bit more tests of
the function to make sure it stays working.

Change-Id: I64e17e6d56842f118a9485e3a18f42ca5e1b7577
Test: run the new test
2017-01-13 10:21:19 +00:00
Elliott Hughes
3d64b02538 Merge "localtime_r(3) should act as if it calls tzset(3)." am: 1b2975d54b am: e767a92c57
am: c9e91d1a98

Change-Id: I3ba74be33afd1b452b11e9ee99bbc303903fa1a2
2017-01-12 23:33:04 +00:00
Elliott Hughes
1b2975d54b Merge "localtime_r(3) should act as if it calls tzset(3)." 2017-01-12 23:19:50 +00:00
Josh Gao
1ed866ba57 Merge "Improve fmemopen tests." am: 27fa754287 am: bbacec3f5d
am: ab5b3c26db

Change-Id: I8de2b09c4e41148b65add0f189a975f7fb90c06f
2017-01-12 00:20:40 +00:00
Josh Gao
27fa754287 Merge "Improve fmemopen tests." 2017-01-11 23:59:02 +00:00
Elliott Hughes
ea87716696 localtime_r(3) should act as if it calls tzset(3).
See code comment.

Bug: http://b/31339449
Test: ran tests & benchmarks
Change-Id: I6b6a63750ef41664dc4698207e6a53e77cc28cdf
2017-01-11 14:56:04 -08:00
Josh Gao
674cd55bff Merge "Add support for expected failures to gtest runner." am: 94ea19895c am: 6b767b91cc
am: 7290adbdcd

Change-Id: Ib14a678a56b1e71d0ad736d3f8560bf4f0078201
2017-01-11 22:48:59 +00:00
Treehugger Robot
94ea19895c Merge "Add support for expected failures to gtest runner." 2017-01-11 22:32:18 +00:00
Josh Gao
2f06e10280 Improve fmemopen tests.
Tag fmemopen_NULL as a known failure, and make it reliably fail by
memsetting the buffer we read to.

Bug: http://b/33251022
Test: bionic-unit-tests/bionic-unit-tests64 on bullhead
Test: bionic-unit-tests-glibc --gtest_filter="*memopen*"
Change-Id: I381783282359851c9de47146dafbb5a291960c2a
2017-01-11 13:00:15 -08:00
Dimitry Ivanov
6c375b907e Merge "Hide __system_property_add/update, deprecate find_nth" am: 907fcc98b2 am: ee062c3577
am: e24dc59591

Change-Id: I56a2a4e08342dacd7c447756f559f0ecbada67a0
2017-01-11 02:12:51 +00:00
Treehugger Robot
907fcc98b2 Merge "Hide __system_property_add/update, deprecate find_nth" 2017-01-11 01:57:56 +00:00
Dimitry Ivanov
581b9f661b Hide __system_property_add/update, deprecate find_nth
These functions are supposed to be used only by the
property service.

__system_property_find_nth is deprecated and no longer part
of NDK. Call to this function will result in abort for apps
targeting Android O.

Bug: http://b/34114501
Test: bionic-unit-tests --gtest_filter=prop*
Change-Id: I9846965bf248e2ddf45cd7b293618245bbd87145
2017-01-10 13:41:27 -08:00
Josh Gao
010522229c Add support for expected failures to gtest runner.
Bug: http://b/33251022
Test: manually added tests that unexpectedly failed
Test: bionic-unit-tests/bionic-unit-tests64 on bullhead
Change-Id: Ie9aef80014b9fd6512b68f0e42abc298732a9b6e
2017-01-10 12:56:25 -08:00
Elliott Hughes
affb322c73 Revert "Revert "move android_ids into bionic"" am: 3f6eee9793 am: 45be5dfe98
am: 80a477c4ea

Change-Id: I18423a5339e7d53c38555e1cedbf9dea09b59f55
2017-01-10 01:33:26 +00:00
Elliott Hughes
45be5dfe98 Revert "Revert "move android_ids into bionic""
am: 3f6eee9793

Change-Id: I6a65710f926a76e48705fa4594f479f5d48df068
2017-01-10 01:23:26 +00:00
Elliott Hughes
940d460f59 Merge "Revert "Revert "move android_ids into bionic""" 2017-01-10 01:15:30 +00:00
Elliott Hughes
b0e8c565a6 Remove the global thread list.
Another release, another attempt to fix this bug.

This change affects pthread_detach, pthread_getcpuclockid,
pthread_getschedparam/pthread_setschedparam, pthread_join, and pthread_kill:
instead of returning ESRCH when passed an invalid pthread_t, they'll now SEGV.

Note that this doesn't change behavior as much as you might think: the old
lookup only held the global thread list lock for the duration of the lookup,
so there was still a race between that and the dereference in the caller,
given that callers actually need the tid to pass to some syscall or other,
and sometimes update fields in the pthread_internal_t struct too.

We can't check thread->tid against 0 to see whether a pthread_t is still
valid because a dead thread gets its thread struct unmapped along with its
stack, so the dereference isn't safe.

Taking the affected functions one by one:

* pthread_getcpuclockid and pthread_getschedparam/pthread_setschedparam
  should be fine. Unsafe calls to those seem highly unlikely.

* Unsafe pthread_detach callers probably want to switch to
  pthread_attr_setdetachstate instead, or using pthread_detach(pthread_self())
  from the new thread's start routine rather than doing the detach in the
  parent.

* pthread_join calls should be safe anyway, because a joinable thread won't
  actually exit and unmap until it's joined. If you're joining an
  unjoinable thread, the fix is to stop marking it detached. If you're
  joining an already-joined thread, you need to rethink your design.

* Unsafe pthread_kill calls aren't portably fixable. (And are obviously
  inherently non-portable as-is.) The best alternative on Android is to
  use pthread_gettid_np at some point that you know the thread to be alive,
  and then call kill/tgkill directly. That's still not completely safe
  because if you're too late, the tid may have been reused, but then your
  code is inherently unsafe anyway.

If we find too much code is still broken, we can come back and disable
the global thread list lookups for anything targeting >= O and then have
another go at really removing this in P...

Bug: http://b/19636317
Test: N6P boots, bionic tests pass
Change-Id: Ia92641212f509344b99ee2a9bfab5383147fcba6
2017-01-07 14:16:46 -08:00
Dimitry Ivanov
52bfd3d548 Merge "Fix bionic-unit-tests-static crash" am: 500b9be411 am: 1cfb85c199
am: fe0a303a5a

Change-Id: I873f269dab7db1593c59a3a2da52b2ec873cdd52
2017-01-07 04:11:46 +00:00
Dimitry Ivanov
462ea664cf Fix bionic-unit-tests-static crash
The crash happens because for static executables call to dlopen
results in crash. This change moves dlopen() == nullptr check
from static variable to a functions so that the dlopen crash only
affects tests calling dlopen but not the whole executable.

Also make static tests report crashes to debugerd

Test: run bionic-unit-tests-static (for arm 32 and 64)
Bug: http://b/34129417
Change-Id: I7c4d8caf2a43250234fe24496b1c95eab572769f
2017-01-06 16:16:26 -08:00
Jeff Sharkey
0e6d4f5fec Merge "Define range of GIDs for cached app data." am: 54891837a0 am: ce7c613609
am: 3ef6bb6ff1

Change-Id: I08225c7054e23e715d199441b2a542bcad6dae0a
2016-12-15 23:31:05 +00:00
Jeff Sharkey
54891837a0 Merge "Define range of GIDs for cached app data." 2016-12-15 21:46:30 +00:00
Dimitry Ivanov
9ddb6f317e Merge "Add test for elf-hash and packed relocations" am: 59dd61573f am: 488eac109b
am: e66f6b8803

Change-Id: I5fea184c15d9876f6e43f1c37dbd958a9f1664a5
2016-12-15 18:49:42 +00:00
Dimitry Ivanov
a9cf16d1df Merge "Add test for empty symbol lookup" am: 22ef13ff9d am: c0c74cb7dd
am: b54a98abd2

Change-Id: I9ca795a81639ea0f070ec3a57a60a89a954c910c
2016-12-15 18:49:17 +00:00
Dimitry Ivanov
59dd61573f Merge "Add test for elf-hash and packed relocations" 2016-12-15 18:27:22 +00:00
Dimitry Ivanov
d5b578ac15 Add test for empty symbol lookup
Check that dlsym(handle, "") fails.

Bug: http://b/33530622
Test: bionic-unit-tests --gtest_filter=dlfcn*
Test: bionic-unit-tests-glibc --gtest_filter=dlfcn*
Change-Id: Iae572bd1d9b798be619c5018de2a5450bf37977e
2016-12-14 15:16:56 -08:00
Dimitry Ivanov
ac4bd2f793 Add test for elf-hash and packed relocations
This adds CTS test for system libraries to support
workaround for http://b/24465209: some apps require
a subset of system libs to have elf-hash and not to
use packed relocations.

Bug: http://b/32917341
Bug: http://b/24465209
Test: bionic-unit-tests --gtest_filter=Dl*:dl*
Change-Id: Ia0bc28506b1f1f97d4cf902d73b0769e2815fed3
2016-12-14 11:16:21 -08:00
Elliott Hughes
3f6eee9793 Revert "Revert "move android_ids into bionic""
This reverts commit 77cb68d9f2.

Change-Id: Ibc9f775c4cd418be90fd8a6f192dd72ca5dff09a
2016-12-13 23:47:25 +00:00
Elliott Hughes
ce67358f80 Merge "Rename <grp.h>/<pwd.h> tests to fit the usual pattern." am: 9f9c73bb2e am: 0d5910b1f2
am: e05059d457

Change-Id: I6ee6d93ff018afb71e04d0a8583d8efde98d6c0b
2016-12-13 23:15:09 +00:00
Elliott Hughes
9f9c73bb2e Merge "Rename <grp.h>/<pwd.h> tests to fit the usual pattern." 2016-12-13 22:53:25 +00:00
Jeff Sharkey
934bc86df3 Define range of GIDs for cached app data.
To support upcoming disk usage calculation optimizations, this change
creates a new GID for each app that will be used to mark its cached
data.  We're allocating these unique GIDs so that we can use
quotactl() to track cached data on a per-app basis.

Test: builds, boots, tests pass
Bug: 27948817
Change-Id: Ic00c39ccedc23d5d43988029e9921679126f8f2d
2016-12-13 14:22:55 -07:00
Kevin Brodsky
e1d9e1d914 Merge "bionic-unit-tests: Build host testlibs in bionic-loader-test-libs" am: 755ecdead5 am: 6e56470f77
am: 3c1e9fa73d

Change-Id: Id003c9447c0d69fb42659dc0fc5eeb6656f3feee
2016-12-13 19:50:56 +00:00
Treehugger Robot
755ecdead5 Merge "bionic-unit-tests: Build host testlibs in bionic-loader-test-libs" 2016-12-13 19:32:10 +00:00
Elliott Hughes
5367d1b9d9 Rename <grp.h>/<pwd.h> tests to fit the usual pattern.
Bug: N/A
Test: ran tests
Change-Id: I5ec30cc17f94e631f3376b671055a0e82fb472c3
2016-12-12 17:32:14 -08:00
Elliott Hughes
82787230cb Revert "move android_ids into bionic" am: 77cb68d9f2 am: 75b51ac14e
am: 2e2a6f5323

Change-Id: I5a32adb57d58108dc69a278f53a66ff2d97ac3d5
2016-12-13 01:00:31 +00:00
Elliott Hughes
75b51ac14e Revert "move android_ids into bionic"
am: 77cb68d9f2

Change-Id: I45d8098e38dd35fdf9b3d270ac4f26c3a7284971
2016-12-13 00:42:35 +00:00
Treehugger Robot
50ae6dde5b Merge "Revert "move android_ids into bionic"" 2016-12-13 00:31:25 +00:00
Yabin Cui
2fe22f981b Merge "Fix gtest_filter of bionic gtest runner." am: 901de13c37 am: ae3abaa8df
am: 0babaaf12e

Change-Id: Icb1a21dad3f9615201caadea8adfc5cea29e96b0
2016-12-13 00:17:21 +00:00
Yabin Cui
901de13c37 Merge "Fix gtest_filter of bionic gtest runner." 2016-12-12 23:59:06 +00:00
Elliott Hughes
77cb68d9f2 Revert "move android_ids into bionic"
This reverts commit 1a13db5b26.

Change-Id: I7f571b3a9d542694d16fb9cf1131ef9e59d330ea
2016-12-12 22:11:37 +00:00
Yabin Cui
c641a95834 Fix gtest_filter of bionic gtest runner.
Bug: http://b/29514723
Test: run bionic-unit-tests --gtest-filter='*grp*'
Change-Id: I45ed561702bd601bae84c8d77824aa5769dbfa9c
2016-12-12 13:34:05 -08:00
Yabin Cui
11549d0401 Merge "Fix the way to find negative filter pattern." am: 858ec7abec am: 5c726ec432
am: 5c1c971e87

Change-Id: Id3c1eb506d8b0e92eadc82da137c8ac196780a4f
2016-12-10 04:06:39 +00:00
Yabin Cui
858ec7abec Merge "Fix the way to find negative filter pattern." 2016-12-10 03:49:17 +00:00
William Roberts
bd3987bf36 move android_ids into bionic am: 1a13db5b26 am: f3def87a05
am: 00c5608a69

Change-Id: I6ae8f4f61f83cc8704014dd518efc2d7dd49b966
2016-12-10 00:35:28 +00:00
William Roberts
f3def87a05 move android_ids into bionic
am: 1a13db5b26

Change-Id: I12ac9a338503687fba3c43dcdd8a6c1a74cc99fe
2016-12-10 00:20:28 +00:00
Elliott Hughes
ded6c91acc Merge "move android_ids into bionic" 2016-12-10 00:13:05 +00:00
Yabin Cui
cf75462012 Fix the way to find negative filter pattern.
Bug: http://b/29514723
Test: run CtsBionicTestCases --gtest_filter=-Fortify2_clang.strncpy --gtest_list_tests
Change-Id: Ia3adec1fc03252adee4aed238b9c88508da17faf
2016-12-09 15:49:09 -08:00
Kevin Brodsky
ee2952e84f bionic-unit-tests: Build host testlibs in bionic-loader-test-libs
The target test libs are now all built in
nativetest/bionic-loader-test-libs. However, libs built using
libs/Android.build.testlib.mk are still put in lib/ on the host.

This commit refactors libs/Android.build.testlib*.mk so that all test
libs go into nativetest/bionic-loader-test-libs on the host; nothing
changes on the target. Android.build.mk now understands
*_install_to_native_tests_dir both for host and target builds.

Change-Id: I1022e9bab38bf53036c95fd39b3b240bcb31f23a
2016-12-09 17:26:11 +00:00
Elliott Hughes
146f3406ad Merge "Fix icu4c calling on x86." am: 227894a754 am: 5fb3a092d6
am: 940b4c521e

Change-Id: Iab9e004305e3e5f865ef59d82e8c9ba2e5e0c87f
2016-12-09 02:25:07 +00:00
Elliott Hughes
722d01a991 Fix icu4c calling on x86.
Some of the function pointer types were wrong, and x86 cares if you
say `int` when you meant `int8_t` (because it feels at liberty to
leave the top bits dirty and ignore them, both sides need to agree
which they're dealing with).

Also slightly improve the wcstoimax and wcstoumax tests, since my
investigation started there.

Bug: http://b/33451822
Test: tests pass on x86, arm, and arm64
Change-Id: I553193962f0cb993666f9f8e415990bba5b669e1
2016-12-08 15:16:37 -08:00
Greg Hackmann
0b9c5be152 Merge "Add test for ambient caps" am: 51366e9b16 am: a505507056
am: 56795edd77

Change-Id: I0a1c8212ec3d6a9b367d01a01f52325d5a96dd48
2016-12-07 16:30:07 +00:00
Treehugger Robot
51366e9b16 Merge "Add test for ambient caps" 2016-12-07 16:15:55 +00:00
Greg Hackmann
ba1f77d650 Add test for ambient caps
PR_CAP_AMBIENT landed in 4.3 and has been backported to earlier kernels
in kernel/common.

Test: bionic-unit-test --gtest_filter=sys_prctl.pr_cap_ambient
Change-Id: I632f6316ef1a4eb636d2bf7e07d541e400567ef4
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2016-12-06 15:33:27 -08:00
Dan Albert
124dd7dc2c Merge "Fix wcsto* where strings begin with whitespace." am: 297ad4cbb8 am: 0ee1546794
am: 80abd861bb

Change-Id: I52a8e23e9c020be89529b3a39a58f641b71a776a
2016-12-02 23:12:55 +00:00
Dan Albert
0ee1546794 Merge "Fix wcsto* where strings begin with whitespace."
am: 297ad4cbb8

Change-Id: Id431f98b267059daae5d2c8a7293205176f82be5
2016-12-02 23:09:24 +00:00
Treehugger Robot
297ad4cbb8 Merge "Fix wcsto* where strings begin with whitespace." 2016-12-02 23:04:04 +00:00
Dan Albert
f634655e64 Fix wcsto* where strings begin with whitespace.
The libc++ tests caught this.

Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Bug: None
Change-Id: I14864e006f6cf9de3f96acac6aa3eb235894f2b1
2016-12-02 13:03:30 -08:00
Elliott Hughes
968d9b43c6 Merge "Fix unistd.execvpe_ENOEXEC and unistd.execvpe_failure." am: b2d36b4ec7 am: f3d49a3bae
am: aaf6e1d590

Change-Id: I0f260043c3bea4eb230533cbb2d138e48008447e
2016-12-02 03:22:47 +00:00
Elliott Hughes
f3d49a3bae Merge "Fix unistd.execvpe_ENOEXEC and unistd.execvpe_failure."
am: b2d36b4ec7

Change-Id: I7d0051a13e5e2097e256afdfbbc580f6733fc523
2016-12-02 03:10:15 +00:00
Elliott Hughes
5965bf09d4 Fix unistd.execvpe_ENOEXEC and unistd.execvpe_failure.
These passed when run directly (as root) but failed in CTS' more restricted
environment.

Bug: http://b/33270012
Test: ran CTS tests
Change-Id: Iccb407769fe356c30d52a0a99fff11862134a250
2016-12-01 17:12:49 -08:00
William Roberts
1a13db5b26 move android_ids into bionic
Generate the android_ids array and include into the
build.

Test: The bionic is built and that core AIDs work as
expected with commands like chown, mkdir and init services
and builtins.
Bug: 27999086
Change-Id: Ib575bf85326c91801c5674db475dcb9cf44c00dc
Signed-off-by: William Roberts <william.c.roberts@intel.com>
2016-11-30 12:54:08 -08:00
Elliott Hughes
e6c3c270bd Merge "Use icu4c to implement <wctype.h>." am: bd734f0716 am: d3adf35e5b
am: d023a9a174

Change-Id: I960fecd166c338cf1281671c8c2d58dbf12c39ed
2016-11-29 23:25:33 +00:00
Elliott Hughes
d3adf35e5b Merge "Use icu4c to implement <wctype.h>."
am: bd734f0716

Change-Id: Id46c588eb1e3502d02f5b7e8bf6a46ad69047fe5
2016-11-29 23:15:02 +00:00
Elliott Hughes
bd734f0716 Merge "Use icu4c to implement <wctype.h>." 2016-11-29 23:05:31 +00:00
Elliott Hughes
dc8e0da511 Merge "Implement <langinfo.h>." am: 86841573ed am: 03b787262c
am: 1d414d1239

Change-Id: Ifc3dcde8da74c3aa8d3820eabb49c29539449335
2016-11-29 19:36:19 +00:00
Elliott Hughes
03b787262c Merge "Implement <langinfo.h>."
am: 86841573ed

Change-Id: I1897be912644f66f2c73865b4d93bf2d0beabf60
2016-11-29 19:25:48 +00:00
Elliott Hughes
a57ca0da69 Use icu4c to implement <wctype.h>.
Pretty useless, because the POSIX APIs are useless for actually
internationalization, but it lets us put this to bed for good.

Bug: http://b/18492914
Test: bionic tests
Change-Id: I4dd0aff66c44b5547039be3ffea806c865b9014a
2016-11-29 19:19:30 +00:00
Elliott Hughes
86841573ed Merge "Implement <langinfo.h>." 2016-11-29 19:16:09 +00:00
Dimitry Ivanov
6f2ad7b1df Merge "Fix bionic-unit-tests-glibc" am: 11b362d284 am: ead36866f4
am: e522ca11ef

Change-Id: I7b88ce2dc6e3063adcb0c5ff4fc1b43a72f98f8a
2016-11-28 23:18:11 +00:00
Dimitry Ivanov
ead36866f4 Merge "Fix bionic-unit-tests-glibc"
am: 11b362d284

Change-Id: I0d4ac9cbf001cbc49e35964a7ca607419283a0a4
2016-11-28 23:09:14 +00:00
Treehugger Robot
11b362d284 Merge "Fix bionic-unit-tests-glibc" 2016-11-28 23:01:54 +00:00
Dimitry Ivanov
d0b5c3ad65 Fix bionic-unit-tests-glibc
Also add another test for dlsym(RTLD_NEXT, ..)

Bug: http://b/33106624
Test: run bionic-unit-tests-glibc and bionic-unit-tests
Change-Id: I340165d66bf2360b0e3273d3561a08cb5e7bd025
2016-11-28 13:09:19 -08:00
Brian Carlstrom
b71d2f6cad Fix x86_64 build which uses g++ and hits -Werror=unused-but-set-variable
am: 2993aaa261

Change-Id: If389245812985975992b852cbadccfd84ea14fac
2016-11-24 04:12:56 +00:00
Brian Carlstrom
2993aaa261 Fix x86_64 build which uses g++ and hits -Werror=unused-but-set-variable
Bug: 32640542
Bug: 33078014
Change-Id: Id9d3b4e69ac909078b2ac5b81acf161debcefae3
2016-11-23 18:08:25 -08:00
Yabin Cui
d6e512ec00 Merge "Remove CLONE_NEWNS for gettid and getpid cache tests."
am: d39380cc4d

Change-Id: I1f6da5f7d6717e80c067828241723ba62465d6a6
2016-11-23 18:21:19 +00:00
Yabin Cui
fb5b9bb3bb Remove CLONE_NEWNS for gettid and getpid cache tests.
Using CLONE_NEWNS flag is not related to the tests, and it make
the tests unavailable in cts tests. So remove the flag.

Bug: http://b/33089743
Test: run CtsBionicTestCases --gtest_filter=unistd*.
Change-Id: I4bda39c6a0c41c9973d275202a3a7f7a1e9bbba3
2016-11-22 17:21:27 -08:00
Elliott Hughes
fc8e688c32 Implement <langinfo.h>.
POSIX locale only, as usual.

The GNU YESSTR and NOSTR extensions return the empty string in the C locale,
so I haven't bothered supporting them.

Bug: http://b/1401872
Test: bionic tests
Change-Id: I6846839e4f9f1812344ed5dce0b93f83c0c20eb3
2016-11-19 11:46:54 -08:00
Dimitry Ivanov
c4786906f8 Merge "Improve dlerror_concurrent test"
am: ada292531e

Change-Id: I7f33d654dafc319305edabf44b6bc43b3aa6eb6b
2016-11-18 00:27:43 +00:00
Dimitry Ivanov
c7365eb2fa Improve dlerror_concurrent test
Add a test to check if result is thread-local, not only buffer.

Test: run bionic-unit-tests
Change-Id: Ia95f88c0d76aa86f7f439836393abd67a57dd396
2016-11-17 14:23:24 -08:00
Elliott Hughes
aee547dbef Merge "Add and use constants for the Android API levels."
am: 60ba60dd25

Change-Id: I83b38008d8ba734b303cae6b270534ee11afebe6
2016-11-17 02:43:18 +00:00
Treehugger Robot
60ba60dd25 Merge "Add and use constants for the Android API levels." 2016-11-17 02:37:37 +00:00
Dimitry Ivanov
05d1ada098 Merge "Add original prebuilt test libraries"
am: 2880754368

Change-Id: I80a1c62d81baf96256d8901059026f8b18ea13fc
2016-11-17 01:04:40 +00:00
Elliott Hughes
5bc78c8bcd Add and use constants for the Android API levels.
Test: bionic tests still pass
Change-Id: If1b619cfc9db1d3f5d91f14f2ace71058dca0c4a
2016-11-16 16:55:42 -08:00
Dimitry Ivanov
2880754368 Merge "Add original prebuilt test libraries" 2016-11-17 00:52:41 +00:00
Christopher Ferris
1dc3ae163e Fix error case to print newlines properly.
Bug: 32640542

Test: Built and ran on a failing device.

(cherry picked from commit 4dd2785f05)

Change-Id: I81a578af7608c741819062bd54aa8e348a621b83
2016-11-16 15:34:55 -08:00
Christopher Ferris
f1e44785e5 Make prctl test check maps.
It turns out that sometimes this kernel bug can be present but not
trigger a crash. Modify the test to check for overlapping maps instead.

Bug: 32640542

Test: Verified that this fails on a device without the kernel patch
Test: (both bionic-unit-tests32 and CtsBionicTestCases32). Verified
Test: this passes on an angler.

(cherry picked from commit f1649d92f7)

Change-Id: Ia3fae3ee3d01f33d8414c1796fc3e942d5b56ec8
2016-11-16 15:32:25 -08:00
Dimitry Ivanov
416158db60 Add original prebuilt test libraries
This is the library used to produce invalid prebuilt libraries
for loader tests.

Bug: http://b/30795430
Test: not necessary - these are added for reference
Change-Id: I06e681bf826e59a76da9b49d84d26dee34920d49
2016-11-16 14:02:49 -08:00
Christopher Ferris
452d4d3db5 Merge "Fix error case to print newlines properly."
am: b08fde95cb

Change-Id: I2987196ad6bb4e3ccf0c19b8e6b450903cf691f6
2016-11-09 01:31:33 +00:00
Christopher Ferris
4dd2785f05 Fix error case to print newlines properly.
Bug: 32640542

Test: Built and ran on a failing device.
Change-Id: I81a578af7608c741819062bd54aa8e348a621b83
2016-11-08 14:05:18 -08:00
Dimitry Ivanov
7676c3494a Merge "Eliminate deadlock in forked child due to delayed resetting mutex lock"
am: 8bfaac0f8a

Change-Id: I7db0e466f3ea8af90fe9ec7c103ec3ddff3a7da9
2016-11-08 21:13:44 +00:00
Dimitry Ivanov
8bfaac0f8a Merge "Eliminate deadlock in forked child due to delayed resetting mutex lock" 2016-11-08 20:59:42 +00:00
Elliott Hughes
34637a7865 Merge "Show amount of parallelism in gtest output."
am: 15ae549658

Change-Id: I397a9f303b650445608480551ba863cb5cdc78fd
2016-11-07 22:56:52 +00:00
Treehugger Robot
15ae549658 Merge "Show amount of parallelism in gtest output." 2016-11-07 22:48:49 +00:00
Elliott Hughes
54901af44f Merge "Fix format macros for fast16 and fast32 int types."
am: a3ab8ebedd

Change-Id: Id8156b85fa1d29acd6b4375798ed5df0aaa19b71
2016-11-07 16:36:57 +00:00
Elliott Hughes
a3ab8ebedd Merge "Fix format macros for fast16 and fast32 int types." 2016-11-07 16:33:35 +00:00
Christopher Ferris
d568220a4b Merge "Make prctl test check maps."
am: 95780f2b42

Change-Id: Id4fb876295328ea874052abc88d5a94c8ba2959e
2016-11-07 16:12:25 +00:00
Christopher Ferris
f1649d92f7 Make prctl test check maps.
It turns out that sometimes this kernel bug can be present but not
trigger a crash. Modify the test to check for overlapping maps instead.

Bug: 32640542

Test: Verified that this fails on a device without the kernel patch
Test: (both bionic-unit-tests32 and CtsBionicTestCases32). Verified
Test: this passes on an angler.

Change-Id: Ia3fae3ee3d01f33d8414c1796fc3e942d5b56ec8
2016-11-06 23:25:34 -08:00
Mingwei Shi
f6a21bfac5 Eliminate deadlock in forked child due to delayed resetting mutex lock
For some program implementation, the pattern like below, calling 
pthread_atfork to register atfork interfaces.

    pthread_atfork(&atfork_prepare, &atfork_parent, &atfork_child);

When the program is expected to reopen the shared library's handle 
inherited from parent in child process. Maybe, dlclose is called in 
atfork_child to release the shared library handle before reopen it. 
Then, dlclose will indrectly call _cxa_finalize and finaly call 
__unregister_atfork when dso is not NULL.

    atfork_child() -> dlclose() -> __on_dlclose() 
    	-> __cxa_finalize() -> __unregister_atfork(dso)

In __unregister_atfork, firstly, it try to hold the g_atfork_list_mutex 
lock to operate the g_atfork_list. Due to the registered atfork_child is
executed before resetting g_atfork_list_mutex lock in child, the child 
process will be blocked here because of deadlock.

Test: bionic-unit-tests32 --gtest_filter=pthread.pthread_atfork_child_with_dlclose 
without the fixing, the test will be timeout.

Change-Id: I35d3001682c836e0955d6d681bc5f9297fad0c7b
Signed-off-by: Mingwei Shi <mingwei.shi@intel.com>
Signed-off-by: Qiming Shi <qiming.shi@intel.com>
Signed-off-by: Chao Xie <chao.xie@intel.com>
2016-11-07 03:32:57 +00:00
Robert Sesek
fec6131f36 Merge "Set __get_thread()->tid as part of clone()."
am: f41032a3e2

Change-Id: Ic04e3283a680bec43d8d85a9ab9f035c746681ce
2016-11-05 01:32:29 +00:00
Robert Sesek
e462117087 Set __get_thread()->tid as part of clone().
This was previously done only in fork() and pthread_create(), but this left raw
clone() with an invalid cached tid. Since the tid is used for pthread routines,
this led to unstable behavior after clone().

Test: ltp clone01 (see bug for more)
Test: mmma bionic/tests
Test: bionic-unit-tests-static --gtest_filter=*fork*:*clone*

Bug: 32612735
Bug: 32305649
Change-Id: I30eae5a8024b4c5da65476fcadfe14c6db35bb79
2016-11-04 16:57:20 -04:00
Robert Sesek
b690715225 Merge "Fix gettid() after clone()."
am: 8c22ff76e2

Change-Id: I37f128b09378364e55388af2a20d086d1f8d8135
2016-10-29 02:17:27 +00:00
Treehugger Robot
8c22ff76e2 Merge "Fix gettid() after clone()." 2016-10-29 02:09:56 +00:00
Elliott Hughes
48de71e3cc Show amount of parallelism in gtest output.
Bug: http://b/19075519
Test: ran tests
Change-Id: Ia190f728cc28e2283636e9cfea927e525d6c10c8
2016-10-28 10:04:44 -07:00
Robert Sesek
a4edf7a57c Fix gettid() after clone().
The tid is cached in the pthread_internal_t and is properly re-set after fork()
and pthread_create(). But after a plain clone() the value is stale from the
parent.

Test: mmma bionic/tests
Test: bionic-unit-tests-static --gtest_filter=*fork*:*clone*
Test: m checkbuild tests
Test: angler boots

Bug: 32305649
Change-Id: I026d416d1537484cd3e05c8493a35e5ed2acc8ed
2016-10-28 12:14:23 -04:00
Xiaolei Yu
eb596533e3 Fix format macros for fast16 and fast32 int types.
Also change original format test to cover all cases.

Test: bionic unit tests
Change-Id: I2995145562c02918e0b596c008e63459912447ab
2016-10-26 17:52:38 -07:00
Elliott Hughes
4a6b0906b5 Merge "The default locale "" should be a UTF-8 locale."
am: 5e6eb761fc

Change-Id: Idac1bf34e000047b714a41426362de7983cb4130
2016-10-25 00:42:48 +00:00
Elliott Hughes
53de874c3c The default locale "" should be a UTF-8 locale.
"ls -q" (or "adb shell -tt ls") was mangling non-ASCII because mbrtowc
was returning multibyte characters as their individual bytes. This was
because toybox asks for "" rather than "C.UTF-8", and for some reason
we were interpreting that as "C" rather than "C.UTF-8".

Test: bionic tests, ls
Change-Id: Ic60e3b90cd5fe689e5489fad0d5d91062b9594ed
2016-10-24 14:50:31 -07:00
Colin Cross
bb7253aec0 Merge "Add missing host ldlibs"
am: 94b428c80a

Change-Id: Ic27234126a63b2c3719170a17a70f5233e52dc9b
2016-10-20 20:33:35 +00:00
Colin Cross
94b428c80a Merge "Add missing host ldlibs" 2016-10-20 20:26:09 +00:00
Colin Cross
d0ba52ebdc Add missing host ldlibs
Host builds were compiling without -Wl,--no-undefined.  Add missing
host ldlibs so that -Wl,--no-undefined can be added again.

Test: m -j host
Bug: 32305815
Change-Id: I456098775ead2bddae3e61c7055b2bde3f6b38ff
2016-10-20 10:39:50 -07:00
Elliott Hughes
91e16d4436 Merge "Add regression test for http://b/31938693."
am: 6901ca2799

Change-Id: I08432c98bfae0bf087b01b4901aa982e1e21d3fe
2016-10-20 16:40:52 +00:00
Elliott Hughes
6901ca2799 Merge "Add regression test for http://b/31938693." 2016-10-20 16:30:05 +00:00
Dimitry Ivanov
49bad0e609 Merge "Add test for libraries with textrels"
am: 2a2b41038f

Change-Id: I76f947bcf19e87834e048bff5d1057b04af4090a
2016-10-20 01:44:43 +00:00
Treehugger Robot
2a2b41038f Merge "Add test for libraries with textrels" 2016-10-20 01:37:20 +00:00
Elliott Hughes
12443702c2 Add regression test for http://b/31938693.
Bug: http://b/31938693
Bug: https://code.google.com/p/android/issues/detail?id=225132
Test: this is a test
Change-Id: I858962a1dcd56d555a4836a7bfbdf92d5c3042f6
2016-10-19 16:02:31 -07:00
Elliott Hughes
cb9b9781e3 Merge "Fix our _POSIX_* macros to declare barriers and spin locks."
am: 0759e7f5c1

Change-Id: I602b845f97ce26dbc22edff2124d075951eb941c
2016-10-19 21:25:17 +00:00
Dimitry Ivanov
816676e70d Add test for libraries with textrels
Make sure android fails to load them.

Bug: http://b/30795430
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
Test: cts-tradefed run singleCommand cts --skip-preconditions -m CtsBionicTestCases
Change-Id: Id0ebdf336b2f297007479ceb1bbccf778a7ca3f2
2016-10-19 14:21:42 -07:00
Elliott Hughes
73c44a4738 Fix our _POSIX_* macros to declare barriers and spin locks.
We have these now.

Test: ran tests
Change-Id: Ie7b479061ecec19c8b35ea81e04debfd8323d94a
2016-10-19 09:28:21 -07:00
Elliott Hughes
0aec154aa8 Merge "Fix ifaddrs error handling."
am: d824421475

Change-Id: I1eb9d61522501a9e5c925a8d3b4976674169af97
2016-10-14 23:40:53 +00:00
Elliott Hughes
22950687ee Fix ifaddrs error handling.
An NLMSG_ERROR packet includes an errno value that we should use. Also report
failures to create a socket immediately, rather than falling through to the
send and reporting EBADF.

Bug: http://b/32145516
Bug: http://b/31038971
Test: bionic ifaddr tests on ryu (with broken kernel) and flounder
Change-Id: I84c480c5b75077eb90d40426a9d66d7bffbd3d51
2016-10-14 14:35:26 -07:00
Dimitry Ivanov
2e70370aaa Merge "Remove unused build targets" am: 49ef8c822f am: df4e844940
am: 7e22b1317b

Change-Id: Ia012e4ee440c14150f8a70f631bf13d5820b6553
2016-10-13 00:06:04 +00:00
Dimitry Ivanov
426960ac87 Remove unused build targets
Test: mm
Change-Id: I4eadc40411a31a0e5fa910b0054c19f0dea6c1e2
2016-10-12 14:22:58 -07:00
Elliott Hughes
8c2b7620f9 Merge "Fix Mac build." am: e89385743e am: cbe7d68916
am: 76d8f51256

Change-Id: I0f93ba5cd644eff7661392353263398e96b483c8
2016-10-11 04:12:01 +00:00
Elliott Hughes
ffbb0f8aa4 Fix Mac build.
Test: builds on Linux (I don't have a Mac)
Change-Id: I049e1d6420b0d169e727680da9c3d97e0b8aa3d2
2016-10-10 18:38:25 -07:00
Dimitry Ivanov
48d28b50ac bionic-unit-tests: remove dependency on ANDROID_DATA am: 927877c7d3 am: 474da5a6d4
am: dde2ec372b

Change-Id: I394bdb0e53af24c075f95946efcfa75d534c03b6
2016-10-11 00:53:53 +00:00
Dimitry Ivanov
676db441c8 bionic-unit-tests: Create symlinks in runtime am: 708589f5e8 am: dbad17c928
am: 56f4114322

Change-Id: I491aaf15a2bf292ea52a4137cb18b08a29c4e2c0
2016-10-11 00:53:49 +00:00
Dimitry Ivanov
927877c7d3 bionic-unit-tests: remove dependency on ANDROID_DATA
Replace references to ANDROID_DATA enviroment variable with references
to g_testlib_root.

Bug: http://b/22182538
Test: build and run bionic-unit-tests --gtest_filter=dl*:Dl*
Test: make cts && cts-tradefed run singleCommand cts --skip-preconditions -m CtsBionicTestCases
Change-Id: I5667e991551cec55b9b664f2f0063039671ff34b
2016-10-10 13:56:20 -07:00
Dimitry Ivanov
708589f5e8 bionic-unit-tests: Create symlinks in runtime
Instead of creating symlinks in build time and then relying
on usage of adb sync (adb push follows symlinks) - create
them in test run time.

Test: mm && run bionic-unit-tests --gtest_filter=dl*:Dl*
Bug: http://b/22182538
Change-Id: I9d2a873e3ba303533c14ba5e3b779e4a67925462
2016-10-10 04:41:56 -07:00
Tianjie Xu
b2b0460c5b Fix a linking error in bionic/tests am: 3656958a16
am: 0893380bed

Change-Id: I462b022e42676ec6ceba39ece3933dc4cc6237d0
2016-10-07 04:26:44 +00:00
Tianjie Xu
0893380bed Fix a linking error in bionic/tests
am: 3656958a16

Change-Id: I5636ecc4e0a5ff4e1ee0a6cd0f1d182d444e63f9
2016-10-07 04:22:45 +00:00
Tianjie Xu
3656958a16 Fix a linking error in bionic/tests
Fix the following linking error by adding liblog in the makefile:
"system/core/libziparchive/zip_archive.cc:277: error: undefined reference to
'__android_log_error_write'"

The error happens because libziparchive has dependency on liblog. This
error affects the downstream branches of nyc-dev.

Bug: 31251826
Test: mma -j32
Change-Id: Ia42909bbbd150ae0ca9f6aa6b14372f2e0aedccf
2016-10-06 19:45:02 -07:00
Dimitry Ivanov
ff006267b6 Fix bionic-unit-tests am: d11d1e4a97 am: 1a4e213bce
am: ec7a2273c6

Change-Id: Iecf8f9499e4c5a495800a159cdfdea0ba4120824
2016-10-05 16:30:02 +00:00
Dimitry Ivanov
d11d1e4a97 Fix bionic-unit-tests
Fix rpath value for libraries after build system update

Bug: http://b/31221587
Test: run bionic-unit-tests --gtest_filter=dl*:Dl*:*atexit*
Change-Id: Iaed834bef830fd0b252b5de82e27634bafc92d8b
2016-10-05 02:58:25 -07:00
Elliott Hughes
2d9fe94b92 Merge "Fix mbsnrtowcs where dst is null." am: b81ade6203 am: b11335cf6c
am: ec198c17f7

Change-Id: I6e4c3dbe04ac929aabad0abe74830879c48b28fa
2016-09-30 15:54:09 +00:00
Elliott Hughes
3276d7ae3f Merge "Fix tests/run-on-host.sh for glibc." am: d43c8891ae am: f8cafd1ade
am: 9c948d555d

Change-Id: I83a41930cbc297b9acf273cca7daac20d5b68ac0
2016-09-30 15:53:57 +00:00
Elliott Hughes
b81ade6203 Merge "Fix mbsnrtowcs where dst is null." 2016-09-30 15:41:40 +00:00
Elliott Hughes
d43c8891ae Merge "Fix tests/run-on-host.sh for glibc." 2016-09-30 15:37:48 +00:00
Colin Cross
9510ee8453 Merge "Update escaping in Android.bp files" am: 83e9f36a11 am: ffddaa224f
am: 6fac759338

Change-Id: Iec71672602f38aa32a6cb02a56eff880b9fc152c
2016-09-30 04:26:51 +00:00
Elliott Hughes
89e29ee485 Fix mbsnrtowcs where dst is null.
POSIX is its usual unintelligible self
(http://pubs.opengroup.org/onlinepubs/9699919799/functions/mbsrtowcs.html),
but the ISO C11 standard (7.29.6.4.1 paragraph 2) is pretty clear: *src
should change if and only if dst is non-null.

Bug: https://code.google.com/p/android/issues/detail?id=166381
Test: bionic tests
Change-Id: Ibc631cfa5b1bf4a6f56963feba9f0eea27b07984
2016-09-29 17:26:13 -07:00
Elliott Hughes
f48f499329 Fix tests/run-on-host.sh for glibc.
Test: tests/run-on-host.sh glibc
Change-Id: Idd5b2a72335ff0ca47f37c578f71cec8c9fb6ea0
2016-09-29 17:17:15 -07:00
Colin Cross
7b29495d0a Update escaping in Android.bp files
Strings like cflags in Android.bp files are parsed by blueprint,
written to build.ninja files, parsed by ninja, and then passed to
/bin/sh -c.  This had resulted in a combination of blueprint
(\"), ninja ($$), and shell (\$) escaping being necessary.

Soong has been updated to automatically handle ninja and shell
escaping, remove extra escaping from Android.bp files.

Bug: 31221587
Test: m -j
Change-Id: Ib58a51dee8d22296b69ec21768ba6a49dd60e980
2016-09-29 14:37:30 -07:00
Elliott Hughes
d6d868f116 Merge "Fix complex.csqrtf test and add a trivial sincosl test." am: 424a5f629c am: 1692a4d2bc
am: 43aa53bd2f

Change-Id: Ib2df9b109833f697c6e1b8ab1aa9d1e01fc4b4f3
2016-09-26 18:43:46 +00:00
Elliott Hughes
e9719f3fb5 Fix complex.csqrtf test and add a trivial sincosl test.
sincos and sincosf are being tested more thoroughly with a table of data,
but there's nothing equivalent for sincosl.

Test: ran the tests, obviously.
Change-Id: I5b4b22b73cad9b0030549de2e2ed2a0e38648806
2016-09-26 09:35:04 -07:00
Nick Desaulniers
7031660c7a Merge "bionic: tests: add test for fallocate FALLOC_FL_PUNCH_HOLE" am: 904460f749 am: 1d52d65277
am: d22c7a5540

Change-Id: I631cb5e71d98dafd2873abc7e705eeeb70f3000d
2016-09-22 00:50:24 +00:00
Nick Desaulniers
09d900d50f bionic: tests: add test for fallocate FALLOC_FL_PUNCH_HOLE
Bug: 28760453
Change-Id: I1a58d19bf45eac5f930b0f649cf9b8c9046302f3
2016-09-21 09:24:50 -07:00
Elliott Hughes
42aa9c0c91 Merge "Fix some easy cases of __ANDROID__ versus __BIONIC__." am: 42743f1e9e am: 38718ceac2
am: f23b244930

Change-Id: Ib500aae8607217b7a4ba90118ef30bb8c0162e38
2016-09-17 16:52:19 +00:00
Elliott Hughes
42743f1e9e Merge "Fix some easy cases of __ANDROID__ versus __BIONIC__." 2016-09-17 16:40:59 +00:00
Elliott Hughes
a9209d7a0e Fix some easy cases of __ANDROID__ versus __BIONIC__.
We need to make a clearer distinction for bionic on the host. This patch
doesn't fully address things like "should host bionic try to talk to netd?"
for now, but is a step in the right direction.

Bug: http://b/31559095
Test: bionic tests.
Change-Id: I49812f8b75d9d78c4fd8a8ddf5df1201d63771d6
2016-09-16 18:27:07 -07:00
Dimitry Ivanov
4c8f9960be Merge "Make static library for loader tests" am: 9d4d60b480 am: 0a727b2550
am: dc1089d246

Change-Id: Id4746100460e1bf3e017bd064ea928485c11a1fe
2016-09-16 16:26:08 +00:00
Treehugger Robot
9d4d60b480 Merge "Make static library for loader tests" 2016-09-16 16:14:48 +00:00
Josh Gao
38ee712325 Fix instances of '#if __LP64__'. am: b36efa4343 am: 8a72a46efa
am: 3b994ab10a

Change-Id: Iff93d422199f43900b98797f63ff5509cb4e7ed4
2016-09-15 23:51:29 +00:00
Dimitry Ivanov
c462c28afe Make static library for loader tests
1. Extract bionic loader tests to static library in
order to link it to bionic cts tests.
2. Make libpagemap dependency static to reduce dependencies
on internal native libraries.

Bug: http://b/22182538
Test: run bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I5decd5893e6338c84b3ab23e1d65d70bd75ad880
2016-09-15 16:25:31 -07:00
Josh Gao
b36efa4343 Fix instances of '#if __LP64__'.
Triggers -Wundef, which is on in -Weverything.

Bug: http://b/31496165
Change-Id: Ib06107073f7dd1d584c19c222d0430da9d35630b
2016-09-15 14:21:28 -07:00
Kenny Root
1e59055c02 Merge "Fix memory leak in test util" am: b32184eb84 am: 3c749f13d3
am: 89ac2d147f

Change-Id: Ic6fd8973117772e49a5ebc01796e96bbc2f35750
2016-09-15 19:27:05 +00:00
Kenny Root
f0cccdbe19 Fix memory leak in test util
This shows up when you're doing make HOST_SANITIZE=address

Test: mmma bionic && out/host/linux-x86/bin/bionic_tests_zipalign (compare before and after)
Change-Id: Ia94790496327f3818d5fdb7b5ad07e14e60bcae1
2016-09-14 17:24:37 -07:00
Dimitry Ivanov
c6c430e35e Merge "Move test libraries under /data/nativetests" am: 0f81dd3548 am: b2d09c71b1
am: 866e9945d8

Change-Id: I459669903cf3ac1a900d63544b97be51ebd0cd48
2016-09-09 19:08:53 +00:00
Treehugger Robot
0f81dd3548 Merge "Move test libraries under /data/nativetests" 2016-09-09 18:58:34 +00:00
Elliott Hughes
ab728c07a5 Merge "Fix sscanf/wcstod parsing of NaNs." am: 8327a1707b am: ba04201f58
am: 3369646f57

Change-Id: I545ba4caee145e51869158b3073bd02fdde3f212
2016-09-07 23:15:53 +00:00
Elliott Hughes
7f0849fd11 Fix sscanf/wcstod parsing of NaNs.
The parsefloat routines -- which let us pass NaNs and infinities on to
strto(f|d|ld) -- come from NetBSD.

Also fix LP64's strtold to return a NaN, and fix all the architectures
to return quiet NaNs.

Also fix wcstof/wcstod/wcstold to use parsefloat so they support hex
floats.

Lots of new tests.

Bug: http://b/31101647
Change-Id: Id7d46ac2d8acb8770b5e8c445e87cfabfde6f111
2016-09-07 15:01:54 -07:00
Elliott Hughes
fde473ed67 Merge "Fix time.mktime_EOVERFLOW for LP32." am: 52ea18658f am: c97a9f0e64
am: fac932c36b

Change-Id: I9a8a96a3f8247ab3b8a94ac7e45759effea1a3b1
2016-09-06 23:06:11 +00:00
Elliott Hughes
47126edb90 Fix time.mktime_EOVERFLOW for LP32.
Times before 1901-12-13 *underflow* on LP32, making the year 1900 a bad
choice for success case.

Bug: http://b/31305222
Change-Id: I20d4885c80b57707225580db044abc8948a55fdc
2016-09-06 13:34:15 -07:00
Dimitry Ivanov
a36e59bb99 Move test libraries under /data/nativetests
Move libraries used in bionic-unit-tests out of system partition to
/data/nativetests../bionic-loader-test-libs

Bug: http://b/22182538
Test: build bionic and run bionic-unit-tests
Change-Id: I170177bef782839d0b4970ae4418bf54d0a77836
2016-09-02 14:27:47 -07:00
Dan Willemsen
299b5e6e68 Merge "cc_test_library now creates shared libraries too" am: dd14725eeb am: 4b5216d677
am: 9b6737e86d

Change-Id: I6584eb2cb237f8155fdeebcce033244d0726e786
2016-09-01 01:41:12 +00:00
Treehugger Robot
dd14725eeb Merge "cc_test_library now creates shared libraries too" 2016-09-01 01:27:01 +00:00
Elliott Hughes
701a726abd Merge "List failing tests last, to reduce the amount of scrolling." am: af071ed598 am: beb7c64177
am: b349ce0025

Change-Id: Icfaf21eff547f4519e5943860471c7522e969923
2016-08-31 23:37:58 +00:00
Dan Willemsen
4156770d84 cc_test_library now creates shared libraries too
Make these compile as static libraries by properly declaring their
dependencies.

I turned off the shared version of libBionicTests because it produces
this linker warning (treated as error):

external/libcxx/include/sstream:859: warning: relocation refers to
discarded section

Change-Id: I2e1448b47a441b273d208ebd068d0d22e340a0ff
2016-08-31 16:35:01 -07:00
Elliott Hughes
a456fae45f List failing tests last, to reduce the amount of scrolling.
On actual devices, we have a lot of slow tests. Warnings about those
cause cause the failed tests to scroll off the display.

Also replace the made-up word "warnline".

Change-Id: I6b579521a21b56da8a1add08cd34888fc902646e
2016-08-31 14:49:32 -07:00
Dimitry Ivanov
b276c80443 Merge "Remove $(module)_install_to_out_data flag from test makefile" am: 6d7a1eec4c am: a9c9129009
am: 729a12e3ec

Change-Id: I431f776bc02fbad7b3acdd313fdbbac912acdfbb
2016-08-30 21:29:12 +00:00
Treehugger Robot
6d7a1eec4c Merge "Remove $(module)_install_to_out_data flag from test makefile" 2016-08-30 21:16:33 +00:00
Elliott Hughes
6bdfbabd01 Merge "Fix SysV IPC test failures on Android devices." am: af730e63a3 am: c5b5e3adc8
am: 85256c71ab

Change-Id: I1de032b341d0172f17090a8c3099d1f651669156
2016-08-30 19:48:05 +00:00
Elliott Hughes
af730e63a3 Merge "Fix SysV IPC test failures on Android devices." 2016-08-30 19:35:04 +00:00
Dimitry Ivanov
b16e443239 Remove $(module)_install_to_out_data flag from test makefile
Use non-empty $(module)_install_to_out_data_dir as indication
of custom target dir for a library.

Bug: http://b/22182538
Test: build and run bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: Ibfc87f45084a6fe2f487ca1b17a7625a8d8ec707
2016-08-30 11:38:43 -07:00
Alex Vakulenko
e9014474c9 Fix pty.bug_28979140 test in Bionic
The test relies on the fact/assumes that CPU 0 is available to the
test process. This is not necessarily the case. Instead of allocating
CPU 0 to the main thread, find the first available CPU and use that
instead.

BUG=b/29991929
TEST=All Bionic unit tests pass

(cherrypick of 766275e7f697c30164678e1fed55b2a2fcbf8546.)

Change-Id: I36b311cdba57112d663d652757fd5114183fc780
2016-08-27 09:12:31 -07:00
Elliott Hughes
40bae4fc89 Fix SysV IPC test failures on Android devices.
SysV IPC has been compiled out of all our kernels.

Change-Id: I1294459697ed7dff4f21af5c7b04c8b3d3649329
2016-08-26 19:23:39 -07:00
Elliott Hughes
1cfad1622d Merge "Fix execvp/execvpe behavior with absolute paths and ENOEXEC." am: 6395a3047a am: bb4f16227e
am: 389869899a

Change-Id: I5811305ab1495f4c3917e42bef31dcfceff11bfa
2016-08-26 16:28:06 +00:00
Elliott Hughes
63615066d9 Fix execvp/execvpe behavior with absolute paths and ENOEXEC.
Bug: http://b/31091962
Change-Id: Id0b3d41868f5e3ed1ccf618bfefb46609367bc9a
2016-08-25 17:40:27 -07:00
Dimitry Ivanov
23af6af7c2 Fix dlext.ns_smoke test
Check for updated error_message

Bug: http://b/31097098
Test: adb shell bionic-unit-tests32/64 --gtest_filter=dlext.ns*
(cherry picked from commit 3a6c6b3254)

Change-Id: I0f0dd59a6deba016d37d0ccc80113b62db86c1c2
2016-08-25 15:22:50 -07:00
Elliott Hughes
7d15ac6ee1 Merge "Fix execvpe ENOEXEC behavior." am: e1d792b10c am: 745c5e5bf6
am: 32bde59fd0

Change-Id: I84a0a9b05fde3fd11e931997e7305c43ca952af7
2016-08-25 16:34:48 +00:00
Elliott Hughes
3c1159024c Fix execvpe ENOEXEC behavior.
The special case for absolute paths wasn't handling ENOEXEC.

Also add more extensive tests for execvpe.

Also switch to manually doing the fork in ExecTestHelper::Run because
ASSERT_EXIT doesn't actually return, meaning we were only running the
first part of each test.

Bug: http://b/31073104
Change-Id: I7a4640afc6d290c51ba2e66fc1b9bb6b0fc174f7
2016-08-24 22:56:52 -07:00
Elliott Hughes
dc2e87b302 Merge "Rewrite the exec family." am: fac56897f8 am: 6c7d654f69
am: 50a7bc7ead

Change-Id: I8009f1f5afb1844969780eb8346c7b3ac7984716
2016-08-24 21:33:04 +00:00
Treehugger Robot
fac56897f8 Merge "Rewrite the exec family." 2016-08-24 21:21:43 +00:00
Elliott Hughes
1b40aafe3f Rewrite the exec family.
* Removes duplication.
* Removes fixed PATH_MAX limit.
* Adds basic tests.

Bug: http://b/30032507
Change-Id: I4087a9de3e53884ac3297ebafbec4e6f8a9871b6
2016-08-24 13:03:04 -07:00
Alex Vakulenko
3fcca8b80a Fix pty.bug_28979140 test in Bionic am: 766275e7f6
am: 90e3740912

Change-Id: I155a7fb41860615e00d411c85c6f53c5e8230ee0
2016-08-24 06:27:08 +00:00
Alex Vakulenko
766275e7f6 Fix pty.bug_28979140 test in Bionic
The test relies on the fact/assumes that CPU 0 is available to the
test process. This is not necessarily the case. Instead of allocating
CPU 0 to the main thread, find the first available CPU and use that
instead.

BUG=b/29991929
TEST=All Bionic unit tests pass

Change-Id: I36b311cdba57112d663d652757fd5114183fc780
2016-08-23 21:26:37 +00:00
Elliott Hughes
123d261d85 Merge "Flesh out <sys/msg.h>, <sys/sem.h>, <sys/shm.h>." am: 7d4e28a486 am: a0a3a8c3b6
am: 2e805b4f1a

Change-Id: Ic5cdfacb332a9cbd2a958a81f78b80099961aebf
2016-08-19 00:09:26 +00:00
Elliott Hughes
7d4e28a486 Merge "Flesh out <sys/msg.h>, <sys/sem.h>, <sys/shm.h>." 2016-08-18 23:58:43 +00:00
Elliott Hughes
7c59f3f6f3 Flesh out <sys/msg.h>, <sys/sem.h>, <sys/shm.h>.
Also fix <sys/ipc.h>.

Not useful except to systems/bringup folks for testing. Trivial tests
added, and double-checked under strace to see that things look right.

x86 -- which works differently to everything else -- tested on the host.

Bug: http://b/27952303
Change-Id: I328534e994ae9e90755f545478fba03038c0bb94
2016-08-18 15:23:38 -07:00
Dimitry Ivanov
076677961d Merge "[mips] Add missing linker shdr tests" am: fc9958ce76 am: 2223d5bb1c
am: 41b5e450e3

Change-Id: If324ce069b699987b836232e025b6fa29f897fdc
2016-08-17 19:07:30 +00:00
Dimitry Ivanov
fc9958ce76 Merge "[mips] Add missing linker shdr tests" 2016-08-17 18:29:52 +00:00
Elliott Hughes
acfa40ef15 Merge "Fix memmem behavior with empty needles." am: ce8a5b4b9d am: c8d967f0ec
am: 7fbe92cc29

Change-Id: Ifdeb9fe91fca986e954935ee1dcc6f48e792461b
2016-08-16 21:09:40 +00:00
Treehugger Robot
ce8a5b4b9d Merge "Fix memmem behavior with empty needles." 2016-08-16 20:56:54 +00:00
Elliott Hughes
cae33ade6c Fix memmem behavior with empty needles.
Change-Id: I8b893d80c27b548652d843af9520d7adc8ba8902
2016-08-16 12:28:58 -07:00
Nikola Veljkovic
44a654446e [mips] Add missing linker shdr tests
Test: bionic-unit-tests for mips, mips64.
Change-Id: I8ed5f03df8d129e74fa04be2b203bd113a381888
2016-08-16 18:52:06 +00:00
Dimitry Ivanov
45153a305e Merge "linker: add test for zeroed out shdr_table_" am: 3b2d331e77 am: b500830389
am: 8613fdc059

Change-Id: I3f4f0c7a7ca96741523b2203fb5cf59740636908
2016-08-15 23:35:59 +00:00
Treehugger Robot
3b2d331e77 Merge "linker: add test for zeroed out shdr_table_" 2016-08-15 23:23:26 +00:00
Dimitry Ivanov
65eb9b5bf8 Merge "linker: add test for zero shdr offset" am: 4154b77285 am: a9e2c78f8a
am: 989764a73f

Change-Id: Ia6507de40c3c4d9011d75e7337114e0b4ccce371
2016-08-15 22:17:54 +00:00
Treehugger Robot
4154b77285 Merge "linker: add test for zero shdr offset" 2016-08-15 22:01:30 +00:00
Lazar Trsic
ecb70b92c8 Merge "[MIPS] Fix bionic test build" am: 63ccb1bdac am: 05d6befe01
am: d6b302458f

Change-Id: I88d2004d81c0242cc5b59ba90422ee3b173c7252
2016-08-15 21:21:20 +00:00
Dimitry Ivanov
559583469c linker: add test for zeroed out shdr_table_
Bug: http://b/30795430
Change-Id: I86b658d01b64670d3e702ddb1d3f9db4f75d784f
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
2016-08-15 14:06:04 -07:00
Treehugger Robot
63ccb1bdac Merge "[MIPS] Fix bionic test build" 2016-08-15 21:00:47 +00:00
Dimitry Ivanov
4623044517 linker: add test for zero shdr offset
Bug: http://b/30795430
Change-Id: I03853257c4b632ad9daaf1e90f9620678397cff0
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
2016-08-15 13:42:47 -07:00
Elliott Hughes
f1598c86c6 Merge "Fix mktime's errno behavior." am: 228e747b6c am: b3ed1c5202
am: 368f348d16

Change-Id: I07e4a8a8d8352e351843d7bc66c5ac3ba26bc464
2016-08-15 20:34:47 +00:00
Dimitry Ivanov
9d268ffff2 Merge "linker: add test for empty shdr table" am: ac69db1f85 am: 68418746f2
am: d49567855e

Change-Id: I01f2357153b07da5bd34a7470c4bbf1dca812b28
2016-08-15 20:34:47 +00:00
Treehugger Robot
228e747b6c Merge "Fix mktime's errno behavior." 2016-08-15 20:06:57 +00:00
Lazar Trsic
293d5132d0 [MIPS] Fix bionic test build
Group of libtest_invalid* libraries does not exists for mips architecture,
so disable relevant tests.

Change-Id: I3a4fef94933eb33654c4274aa249ea5d61d6cf9b
2016-08-15 12:48:20 -07:00
Dimitry Ivanov
c268eb96d7 Merge "linker: add test for zero shstrndx" am: 21482db6e1 am: 5a66605226
am: cea5f282a8

Change-Id: Icd0e32a99fc0250ed3eecec97f25f81c7fd99f2e
2016-08-15 19:05:09 +00:00
Dimitry Ivanov
8bdf70e6e4 linker: add test for empty shdr table
Bug: http://b/30795430
Change-Id: Id839c22f88276f31e0615bc2a67d75e27a9aa7c6
Test: run bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
2016-08-15 11:30:45 -07:00
Dimitry Ivanov
c9a95613a9 linker: add test for zero shstrndx
Bug: http://b/30166532
Bug: http://b/30795430
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
Change-Id: I4cec73635cf403df9dd60b9a294d2298bb0abe3d
2016-08-15 10:29:50 -07:00
Dimitry Ivanov
3ae29cd6d3 Merge changes Ibcefd6d9,I249c0815,If59cb6da am: 0deb70cd04 am: aa2798e9a8
am: 1d539ce83d

Change-Id: Ifafcb9c4d10e0c2dbfc312505faa4e6abd4b54ce
2016-08-13 03:55:09 +00:00
Dimitry Ivanov
0deb70cd04 Merge changes Ibcefd6d9,I249c0815,If59cb6da
* changes:
  Remove some duplication in the makefile
  linker: add test for zero e_shentsize
  Add test for misaligned section header
2016-08-13 03:42:15 +00:00
Dimitry Ivanov
ff25581083 Remove some duplication in the makefile
Bug: http://b/30795430
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
Change-Id: Ibcefd6d913abafe0b202a83399db72050510cd5d
2016-08-12 16:55:17 -07:00
Elliott Hughes
f8ebaa4985 Fix mktime's errno behavior.
Don't touch errno on success, do set it to EOVERFLOW (the only allowed errno
value according to POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/functions/mktime.html)
on failure.

Bug: http://b/30477946
Change-Id: Ia915c7b9c3bfcd2f9025530cf5b068fe4dd4fd9e
2016-08-12 16:28:36 -07:00
Dimitry Ivanov
cb86c3128f linker: add test for zero e_shentsize
Bug: http://b/30166532
Bug: http://b/30795430
Change-Id: I249c081563f0ca7bcc799d8445a53683616eaa4e
Test: run bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
2016-08-12 15:28:42 -07:00
Dimitry Ivanov
972e3d0787 Add test for misaligned section header
Make sure linker does not crash when dlopening
elf-file with odd section header offset.

Bug: http://b/30795430
Bug: http://b/30687964
Test: bionic-unit-tests --gtest_filter=dlfcn.dlopen_invalid*
Change-Id: If59cb6da85b8752a69dc5687de85f9a9b74c92b4
2016-08-12 14:48:15 -07:00
Elliott Hughes
fd7a70e3d4 Merge "Fix sysconf(_SC_ARG_MAX)." am: 51b3b44585 am: 8407ddebec
am: 50cef99a8f

Change-Id: Ia0e9fb045ba618918eab2e7e8b56386e53623249
2016-08-12 20:18:42 +00:00
Elliott Hughes
51b3b44585 Merge "Fix sysconf(_SC_ARG_MAX)." 2016-08-12 19:53:46 +00:00
Dimitry Ivanov
30a5ab1180 Merge "linker: disallow W + E PT_LOAD segments" am: e8087022c1 am: 3c2f0a2c39
am: 070b462b89

Change-Id: I33f9fa8d81b8cf5f009f5d8ea4f9c135a069977f
2016-08-12 18:06:31 +00:00
Dimitry Ivanov
e8087022c1 Merge "linker: disallow W + E PT_LOAD segments" 2016-08-12 17:55:36 +00:00
Elliott Hughes
18474bdfbf Merge "Use sysinfo(2) to implement more of <sys/sysinfo.h>." am: b17d845d9b am: fb94c6396e
am: bf74aa362d

Change-Id: Ib55e38785172da8afce78459f75e52e2c7cc73f1
2016-08-12 17:25:46 +00:00
Treehugger Robot
b17d845d9b Merge "Use sysinfo(2) to implement more of <sys/sysinfo.h>." 2016-08-12 17:07:41 +00:00
Dimitry Ivanov
9700babc05 linker: disallow W + E PT_LOAD segments
No mapped segment from the elf file can be writable and
executable at the same time. This commit adds a check
for malformed PT_LOAD segments in the elf-files.

Bug: http://b/30146890
Test: run bionic-unit-tests --gtest_filter=dlfcn.*
Change-Id: Ia23acbe5a48780b65d7e4a50bbe024cd528079f4
2016-08-11 17:24:47 -07:00
Elliott Hughes
c508de0e41 Use sysinfo(2) to implement more of <sys/sysinfo.h>.
We already had implementations of some of the functions, and I didn't
bother rewriting them when we added sysinfo(2). Ross Anderson said in
https://www.lightbluetouchpaper.org/2016/07/29/yet-another-android-side-channel/
that we should "simply disable access to all procfs files", which made
me curious how many places we use /proc in bionic. This is the one that's
obviously unnecessary. The others I'm not aware of alternative APIs for.

Change-Id: Ia64f36b76f29a7a1dd67845270a5472e121aae10
2016-08-11 14:51:31 -07:00
Elliott Hughes
38dba2e7e1 Fix sysconf(_SC_ARG_MAX).
ARG_MAX hasn't been a constant since Linux 2.6.23.

Bug: http://lists.landley.net/pipermail/toybox-landley.net/2016-August/008592.html
Change-Id: I1eddb562751604c75b89fa610d79be0655c53693
Test: ran the bionic tests on device and against glibc
2016-08-10 15:51:06 -07:00