Commit graph

24178 commits

Author SHA1 Message Date
Elliott Hughes
6c1d23f059 Merge "Improve glibc compatibility of gethostby*_r functions." 2017-10-26 16:51:43 +00:00
Elliott Hughes
c8a2612ffc Merge "Implement pthread_attr_getinheritsched/pthread_attr_setinheritsched." 2017-10-26 16:12:04 +00:00
Treehugger Robot
048e18045d Merge "Document the dlclose/thread locals with non-trivial destructors problem." 2017-10-26 01:28:25 +00:00
Elliott Hughes
8670b41061 Merge "Don't try to link(2) in a test if we're not root." 2017-10-26 00:38:15 +00:00
Elliott Hughes
bcbce9b453 Document the dlclose/thread locals with non-trivial destructors problem.
Bug: https://github.com/android-ndk/ndk/issues/360
Test: N/A
Change-Id: I964a6c9abd1ae65d74c6aee1c842b2f3d24b5556
2017-10-25 23:08:10 +00:00
Treehugger Robot
b410f4ecf8 Merge "Remove an obsolete aarch64 hack." 2017-10-25 23:05:25 +00:00
Treehugger Robot
ea101198f9 Merge changes Ic7eea780,Id8939791
* changes:
  versioner: properly handle declarations with no identifier.
  versioner: add extern "C" to tests.
2017-10-25 22:43:20 +00:00
Elliott Hughes
8aecba7aa6 Implement pthread_attr_getinheritsched/pthread_attr_setinheritsched.
Historically, Android defaulted to EXPLICIT but with a special case
because SCHED_NORMAL/priority 0 was awkward. Because the code couldn't
actually tell whether SCHED_NORMAL/priority 0 was a genuine attempt to
explicitly set those attributes (because the parent thread is SCHED_FIFO,
say) or just because the pthread_attr_t was left at its defaults.

Now we support INHERIT, we could call sched_getscheduler to see whether
we actually need to call sched_setscheduler, but since the major cost
is the fixed syscall overhead, we may as well just conservatively
call sched_setscheduler and let the kernel decide whether it's a
no-op. (Especially because we'd then have to add both sched_getscheduler
and sched_setscheduler to any seccomp filter.)

Platform code (or app code that only needs to support >= P) can actually
add a call to pthread_attr_setinheritsched to say that they just want
to inherit (if they know that none of their threads actually mess with
scheduler attributes at all), which will save them a sched_setscheduler
call except in the doubly-special case of SCHED_RESET_ON_FORK (which we
do handle).

An alternative would be "make pthread_attr_setschedparams and
pthread_attr_setschedprio set EXPLICIT and change the platform default
to INHERIT", but even though I can only think of weird pathological
examples where anyone would notice that change, that behavior -- of
pthread_attr_setschedparams/pthread_attr_setschedprio overriding an
earlier call to pthread_attr_setinheritsched -- isn't allowed by POSIX
(whereas defaulting to EXPLICIT is).

If we have a lot of trouble with this change in the app compatibility
testing phase, though, we'll want to reconsider this decision!

 -*-

This change also removes a comment about setting the scheduler attributes
in main_thread because we'd have to actually keep them up to date,
and it's not clear that doing so would be worth the trouble.

Also make async_safe_format_log preserve errno so we don't have to be
so careful around it.

Bug: http://b/67471710
Test: ran tests
Change-Id: Idd026c4ce78a536656adcb57aa2e7b2c616eeddf
2017-10-25 14:28:42 -07:00
Elliott Hughes
3413a75460 Remove an obsolete aarch64 hack.
e210488e0d in 2013 added this, which seems
to have been a workaround for the linker at the time that was never removed.

Bug: N/A
Test: ran tests
Change-Id: I171c3f4b7c34638ab75b8e49616b3a9c24ab3fcb
2017-10-25 10:57:02 -07:00
Elliott Hughes
fc30bfe2a4 Don't try to link(2) in a test if we're not root.
Bug: http://b/68055982
Test: ran tests
Change-Id: Icdbe3dd58fb84f3661e5d9ed3ff6884cc0ea2ff8
2017-10-24 22:54:34 -07:00
Josh Gao
0062b3e60a versioner: properly handle declarations with no identifier.
Some declarations, like bitfield members, don't need identifiers.

Bug: https://github.com/android-ndk/ndk/issues/440
Test: ran versioner with -x c++ on a manually reduced <linux/timex.h>
Change-Id: Ic7eea780762cff653c54fdde4d10df203d630c25
2017-10-24 17:51:06 -07:00
Treehugger Robot
88c5ddb6d2 Merge "Fix pthread benchmarks." 2017-10-25 00:13:22 +00:00
Josh Gao
5317f2d48b versioner: add extern "C" to tests.
Bug: https://github.com/android-ndk/ndk/issues/440
Test: python run_tests.py
Change-Id: Id893979146bc609a17bd1fa2a6bec6f10dfe4804
2017-10-24 16:02:25 -07:00
Josh Gao
286b3a8b2d Fix pthread benchmarks.
PauseTiming and ResumeTiming are thread-local, and unbalanced calls to
them leads to obviously bogus results like:

    Benchmark                          Time            CPU Iterations
    -----------------------------------------------------------------
    BM_pthread_exit_and_join      212600 ns    59981418 ns         12
    BM_pthread_create_and_run  212997341 ns -1569132344 ns       1000

Bug: http://b/68170209
Test: ran bionic benchmarks
Change-Id: Ia88cd6af9ff524443850d834a96cf5dd9c7f3ed9
2017-10-24 14:02:54 -07:00
Dan Albert
34cf31a81b Merge "Revert "Revert "Revert "Cleanup transitive includes in the legacy inlines.""""
am: 7669c68964

Change-Id: Ifd21b23c4bc5a7b0cf42b608847a0a331404e079
2017-10-24 09:24:36 +00:00
Dan Albert
7669c68964 Merge "Revert "Revert "Revert "Cleanup transitive includes in the legacy inlines."""" 2017-10-24 09:21:31 +00:00
Dan Albert
b37e9aa9a6 Revert "Revert "Revert "Cleanup transitive includes in the legacy inlines."""
This reverts commit f945fb6b8a.

Reason for revert: haven't fixed all the builds yet

Change-Id: I55aff5d0290c27691427d91a8e46ae01c87da6b2
2017-10-24 09:20:41 +00:00
Dan Albert
d85d7f4ce4 Merge "Revert "Revert "Cleanup transitive includes in the legacy inlines."""
am: 13cec459d7

Change-Id: I71fa9467f710a9ea1849a4515efe8c6d42381982
2017-10-24 07:09:29 +00:00
Treehugger Robot
13cec459d7 Merge "Revert "Revert "Cleanup transitive includes in the legacy inlines.""" 2017-10-24 07:06:35 +00:00
Dimitry Ivanov
640fda69bf Merge "linker: fix error message for inaccessible libs"
am: 0b1c8be3be

Change-Id: I1dc1c1ec8aa104f6b2efd9c6ce5c2188398a7161
2017-10-24 06:52:25 +00:00
Dimitry Ivanov
0b1c8be3be Merge "linker: fix error message for inaccessible libs" 2017-10-24 06:44:19 +00:00
Sundong Ahn
b0b34d5135 Merge "Set search path to ro.vndk.version property"
am: 8ab16c5da6

Change-Id: I7bfc2c26e056e874c4e5549fedc4402da66a0db4
2017-10-24 01:24:10 +00:00
Treehugger Robot
8ab16c5da6 Merge "Set search path to ro.vndk.version property" 2017-10-24 01:17:00 +00:00
Elliott Hughes
bb7d9fb5d4 Improve glibc compatibility of gethostby*_r functions.
And add more tests.

Bug: N/A (but I'm here because a recent test broke existing tests)
Test: ran tests
Change-Id: Ib78430f179b43484a49bb50ff447ea6870c1ee3a
2017-10-23 17:38:35 -07:00
Josh Gao
591f848f25 Merge "Add explicit null checks to some stdio functions."
am: 6f12bfece5

Change-Id: I7478765a2ccb018e01f42882c9345183ee8e809c
2017-10-23 22:02:20 +00:00
Treehugger Robot
6f12bfece5 Merge "Add explicit null checks to some stdio functions." 2017-10-23 21:55:25 +00:00
Elliott Hughes
aa00d5c4f9 Merge "Fix WORD_BIT test."
am: 8220d84f52

Change-Id: I2268c2da0e9894db92ec8f54b26dfd508466187c
2017-10-23 21:04:29 +00:00
Treehugger Robot
8220d84f52 Merge "Fix WORD_BIT test." 2017-10-23 21:00:02 +00:00
Elliott Hughes
be443611da Merge "Fix LP32 large pid detection."
am: d330bbbac8

Change-Id: I98bf5b2e82963998505ed56445931de3c00319e1
2017-10-23 19:59:12 +00:00
Treehugger Robot
d330bbbac8 Merge "Fix LP32 large pid detection." 2017-10-23 19:52:26 +00:00
Josh Gao
d162060928 Add explicit null checks to some stdio functions.
Applications fopening files and then blindly trying to read are
widespread, leading to a recurring problem of SELinux tightening
resulting in segfaults. Add a friendly diagnostic for this case.

Bug: http://b/67455242
Test: bionic-unit-tests32/64 on sailfish
Change-Id: I1734fa94487c4eff9b55a02c6b01baf6b265d236
2017-10-23 12:48:08 -07:00
Elliott Hughes
dc8a612bf3 Fix WORD_BIT test.
The only explanation for this and the unistd_test failures is that I
wasn't actually running the code I thought I was. There are some unrelated
netdb_test failures still to come...

Bug: N/A
Test: ran tests
Change-Id: I91af9d2d6a42f5433fa27e7cd8f5b903e1af36ba
2017-10-23 12:06:30 -07:00
Elliott Hughes
a690f70f69 Merge "Fix unistd.sysconf test."
am: c189e43f10

Change-Id: I1db7de92a3dc39afb0f2ab0510b10fe16e09c0ba
2017-10-23 18:23:36 +00:00
Treehugger Robot
c189e43f10 Merge "Fix unistd.sysconf test." 2017-10-23 18:15:25 +00:00
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
Elliott Hughes
1d01fe8980 Fix LP32 large pid detection.
Bug: http://b/68046352
Test: ran tests
Change-Id: I89cb99173ca77e9457e677187430b61cedb55c04
2017-10-23 10:07:55 -07: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
Josh Gao
e7ccd86416 Merge "Actually correctly call vector::erase after remove_if."
am: 2e998d37ce

Change-Id: Ia64b9e88ce9fab878f62ed32a07b736cb2c487c0
2017-10-21 03:06:19 +00:00
Treehugger Robot
2e998d37ce Merge "Actually correctly call vector::erase after remove_if." 2017-10-21 02:59:27 +00:00
Josh Gao
27242c642e Actually correctly call vector::erase after remove_if.
vector::erase(iterator) erases the element that that iterator points
to, vector::erase(iterator a, iterator b) erases the range [a, b), with
a == b being a no-op.

Test: LD_PRELOAD=libc.so sh
Change-Id: I6a85c1cfaa8eb67756cb75d421f332d5c9a43a33
2017-10-20 17:47:29 -07:00
Elliott Hughes
22eb6f48ef Merge "Remove some legacy declarations from <math.h>."
am: 8f348a0cce

Change-Id: Iafacd9d7d6a832a1b1e70fc45a7b67543ff408ce
2017-10-20 18:49:15 +00:00
Treehugger Robot
8f348a0cce Merge "Remove some legacy declarations from <math.h>." 2017-10-20 18:40:17 +00:00
Elliott Hughes
c93d87bc32 Merge "Be more specific about POSIX obsolescence."
am: 4075e21ba8

Change-Id: I2496b46d48ba0910c980fe68105f7cb32b1fa10f
2017-10-20 16:56:10 +00:00
Elliott Hughes
4075e21ba8 Merge "Be more specific about POSIX obsolescence." 2017-10-20 16:50:28 +00:00
Elliott Hughes
2c48dfba8d Merge "Ignore sockatmark."
am: 8c73809bf5

Change-Id: Ic96b0188b41f4d3f90ccab20d35048381b6cf301
2017-10-20 12:39:53 +00:00
Treehugger Robot
8c73809bf5 Merge "Ignore sockatmark." 2017-10-20 12:34:58 +00:00
Elliott Hughes
90e3f44293 Be more specific about POSIX obsolescence.
Bug: N/A
Test: N/A
Change-Id: Iacc741d18fedbca7c6e8da9d2c64f3d86f9d136b
2017-10-19 21:52:51 -07:00
Sundong Ahn
8fc5032ed2 Set search path to ro.vndk.version property
The permitted and search paths should be changed according to VNDK
version for VNDK snapshot. So, {VNDK_VER} value is added in ld.config.txt
file and this value is set through the linker.
If ro.vndk.version is not set, search paths are vndk and vndk-sp as
before.

Bug: 66074376
Test: build & run
Change-Id: I266b66fe1bc95d8925053ef497db11ac0a57c082
2017-10-20 13:41:14 +09:00
Josh Gao
f2cec8eb88 Merge "Correctly call vector::erase after std::remove_if."
am: 9f69fc714a

Change-Id: I617c19ae04e179fa0ae45e7c7bf829ae65ef392b
2017-10-20 02:35:42 +00:00
Treehugger Robot
9f69fc714a Merge "Correctly call vector::erase after std::remove_if." 2017-10-20 02:29:58 +00:00