Commit graph

25265 commits

Author SHA1 Message Date
Evgeny Eltsin
284c4fdc39 Add a warm up pass to pthread_leak.join test
Bug: 73105445
Bug: 37920774
Test: bionic-unit-tests --gtest_filter=pthread_leak*
Change-Id: I227c999ecc13ee0a2136ff6b00a722f135dd48fe
(cherry picked from commit 775fb09621)
2018-05-07 13:16:16 +02:00
Elliott Hughes
7eb976e00d Merge "Document the historical dlopen issues." 2018-05-02 21:54:15 +00:00
Christopher Ferris
5a6c866dd5 Merge "Fix nullptr dereference during sort." 2018-05-02 20:18:18 +00:00
android-build-prod (mdb)
cf4b4706be Merge "Fix PROP_FILENAME_MAX overflow handling" 2018-05-02 05:24:50 +00:00
android-build-prod (mdb)
a48aa64e04 Merge "Fix async_safe_fatal overflow handling" 2018-05-02 02:57:41 +00:00
Ryan Prichard
d91285f166 Fix PROP_FILENAME_MAX overflow handling
Bug: b/79117743
Test: /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Change-Id: Idd5aa4d195abc13c06d3e5b57aef69a68c2a9a9d
2018-05-01 18:19:21 -07:00
Ryan Prichard
5258c2518e Fix async_safe_fatal overflow handling
Bug: b/79116392
Test: manual
Change-Id: I46cd1007be165489db27cdcd4b42ec69de40d645
2018-05-01 17:59:59 -07:00
Elliott Hughes
52aab72f33 Merge "Document FORTIFY." 2018-05-01 22:59:23 +00:00
Christopher Ferris
c151bc3078 Fix nullptr dereference during sort.
Add new unit test that will crash without this fix.

Bug: 78900050

Test: Ran unit tests.
Change-Id: I73e1b89e965a7b399822c3a6f25cbc70d2d355e2
2018-05-01 14:49:15 -07:00
Elliott Hughes
07f62385b6 Document FORTIFY.
Hilariously, our blog post didn't actually say how to turn it on :-)

Bug: N/A
Test: N/A
Change-Id: I6e773e88c32a70b0f8b8b6d105fce74d68ebf5cd
2018-05-01 13:13:47 -07:00
Elliott Hughes
dc66073417 Document the historical dlopen issues.
Bug: https://groups.google.com/forum/#!topic/android-ndk/OJxg_550eHE
Test: N/A
Change-Id: Ife066dcd3af89952f81f0aefc33351c59b83be9b
2018-05-01 11:27:46 -07:00
Dimitry Ivanov
a27cadfa5f Merge "Libraries without dt_soname are inaccessible" 2018-04-30 09:13:23 +00:00
dimitry
7217a092a6 Libraries without dt_soname are inaccessible
When linker tries to check if a library without dt_soname is accessible
it crashes. This change fixes this problem to return false instead
(making them inaccessible from other namespaces)

This went unnoticed because vendor libraries on current
devices all have dt_soname set. This was only discovered
on one of the newer devices which has a vendor prebuilt
library without a soname.

Bug: http://b/78661414
Bug: https://issuetracker.google.com/77287902
Test: cts-tradefed run commandAndExit cts -m CtsJniTestCases
Change-Id: Idb192b4ed7a810840ba2a9177bad2360ffbb75e2
(cherry picked from commit 94f7a87510)
2018-04-29 13:39:46 +02:00
Elliott Hughes
8602538a15 Merge "Fix sysconf errno for unknown names." 2018-04-26 18:09:31 +00:00
Elliott Hughes
d6f57306d2 Fix sysconf errno for unknown names.
The code (and comment) have been like this since the initial commit, but
there was never a test of this, and glibc seems to have been returning
EINVAL (as POSIX says it should) since long before Android existed.

Bug: http://b/31154352
Test: ran tests
Change-Id: Ica1ea836a4a5699ef0d956fe9c0f322e567de34d
2018-04-25 22:13:14 -07:00
Christopher Ferris
6c4e77dd4a Merge "Remove ion.h from bionic uapi headers." 2018-04-25 21:00:59 +00:00
Christopher Ferris
5ed15ba733 Remove ion.h from bionic uapi headers.
Bug: 77976082

Test: Ran the generate script and verified ion.h is deleted.
Change-Id: I33b3aeef66f08f35dd496a073931b2fe2c80a1d6
2018-04-24 13:33:30 -07:00
Treehugger Robot
67b5979930 Merge "Add __libc_add_main_thread and mark it weak" 2018-04-22 17:27:34 +00:00
Evgeny Eltsin
47e41c8d24 Add __libc_add_main_thread and mark it weak
This complements __libc_init_main_thread in setting up main thread
under native bridge.

Test: run_tests
Bug: 77877742
Change-Id: I53efab66f285a1b9f0ab36d44386fa1e2621e4ba
(cherry picked from commit 4c9504aa6c)
2018-04-22 17:55:50 +02:00
Treehugger Robot
97ef43553a Merge "Revert "Add 64-bit slm optimized strlcpy and srlcat."" 2018-04-20 22:35:11 +00:00
Treehugger Robot
56aa9cb041 Merge "Fix posix_memalign introduced tag." 2018-04-20 19:38:05 +00:00
Dan Albert
e219cefc17 Fix posix_memalign introduced tag.
Apparently this didn't make it to all android-16 devices. As far as
we know it did make it for all android-17 devices.

Test: make checkbuild
Bug: https://github.com/android-ndk/ndk/issues/647
Change-Id: I2f07cfb1254e2a203c1c10b91b0be46bf37ea853
2018-04-20 10:46:16 -07:00
Treehugger Robot
6880f93617 Merge "Disable lld, failed to link bionic/linker." 2018-04-16 23:04:06 +00:00
Treehugger Robot
6c1d847514 Merge "Disable lld, libc_malloc_debug failed to boot." 2018-04-16 19:20:39 +00:00
Chih-hung Hsieh
f0abf07034 Merge "allow_undefined_symbols to link libelf-tls-library" 2018-04-16 17:54:50 +00:00
Chih-Hung Hsieh
0e87940961 Disable lld, libc_malloc_debug failed to boot.
* Linker rules for lld do not work with libunwind_llvm yet.

Bug: 78118944
Test: make checkbuild and boot
Change-Id: I0eda2409d9f365029f70f4255edffbeae49cb6d2
2018-04-16 10:50:52 -07:00
Chih-Hung Hsieh
d6b56c921f allow_undefined_symbols to link libelf-tls-library
* Since Android does not have __tls_get_addr yet,
  -fno-emulated-tls is only a test of compiler.
  Lld is correct to reject this at link time.
  But if the purpose of this test is to check at run-time,
  allow_undefined-symbols is the trick to get the linked library.

Bug: http://b/74361956
Test: build and compare linked file
Change-Id: Ibcdc8b50aeeaec9d7d308b66df2a6997ce3c1a4f
2018-04-16 17:44:58 +00:00
Chih-Hung Hsieh
73de62e461 Disable lld, failed to link bionic/linker.
* Upstream bug: https://bugs.llvm.org/show_bug.cgi?id=36295

Bug: 78115263
Test: make checkbuild
Change-Id: Id38d90f90ca2e3505a47e40c1a3fe0647e7f3a32
2018-04-16 09:51:50 -07:00
Treehugger Robot
af0ad77af5 Merge "Bionic: Always use fortified versions of FD_X macros" 2018-04-16 15:34:14 +00:00
Treehugger Robot
9ee88bdbc7 Merge "Type of second __sched_cpucount should be "const cpu_set_t*"." 2018-04-14 01:27:28 +00:00
Andreas Gampe
00a6d5fe0a Bionic: Always use fortified versions of FD_X macros
When compiling on/for at least Lollipop, always use the fortified
versions of FD_X macros. This works around side-effect issues (which
are explicitly called out in the specification) and generally
increases robustness of code.

Bug: 77986327
Test: mmma bionic
Test: m
Test: bionic_unit_tests
Change-Id: I9096c6872770e46ba5ab64e7375ff83fc0518e07
2018-04-13 17:57:21 -07:00
Treehugger Robot
bf885f8745 Merge "Add dlext.h to the libdl doc group." 2018-04-13 23:25:24 +00:00
Tong Shen
37793a1892 Type of second __sched_cpucount should be "const cpu_set_t*".
Test: none

Bug: 77341596
Change-Id: Ib4f1a75d2cfe147855b4d5f0203f4a64c22c116a
2018-04-13 16:07:21 -07:00
Dan Albert
da1994ced6 Add dlext.h to the libdl doc group.
Test: https://irina-dot-devsite.googleplex.com/ndk/reference/group/libdl
Bug: http://b/77236573
Change-Id: Ie09351ee961554488e34c79511712b07c345b8ad
2018-04-13 14:32:37 -07:00
Jeremy Compostella
611ad621c6 Revert "Add 64-bit slm optimized strlcpy and srlcat."
This reverts commit 2e7145c048.

When src is at the end page, the sse2 strlcpy SSE2 optimized version
can issue a movdqu instruction that can cross the page boundary.  If
the next page is not allocated to that process, it leads to
segmentation fault.  This is a rare but has be caught multiple times
during robustness testing.

We isolated a way to reproduce that issue outside of an Android device
and we have been able to resolve this particular case.  However, we
ran some additional compliance and robustness tests and found several
other similar page crossing issues with this implementation.

In conclusion, this optimization needs to be re-written from scratch
because its design is at cause.  In the meantime, it is better to
remove it.

Change-Id:  If90450de430ba9b7cd9282a422783beabd701f3d
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
2018-04-12 14:00:43 -07:00
Treehugger Robot
48227e6602 Merge "spawn.signal_stress: reap spawned children on exit" 2018-04-10 02:39:15 +00:00
Ryan Prichard
344969c849 spawn.signal_stress: reap spawned children on exit
Test: adb shell \
  /data/nativetest64/bionic-unit-tests-static/bionic-unit-tests-static \
  --gtest_filter=spawn.signal_stress
Bug: b/77824306
Change-Id: I970d1a4d0f8ac9621e676f32f838fc2f638d9750
2018-04-09 16:58:20 -07:00
Treehugger Robot
df0a2d237d Merge "Point to the NDK wrap.sh docs." 2018-04-07 02:51:38 +00:00
Treehugger Robot
6062ec2826 Merge "Stop claiming that malloc debug is only usable on rooted devices." 2018-04-06 23:57:28 +00:00
Elliott Hughes
5ad142157d Point to the NDK wrap.sh docs.
Bug: N/A
Test: N/A
Change-Id: Ic4c12a2ae43a6d733a23dcd2c901c2b6478eee97
2018-04-06 15:13:14 -07:00
Elliott Hughes
7dc7d2b7f2 Stop claiming that malloc debug is only usable on rooted devices.
Bug: N/A
Test: N/A
Change-Id: Ie9d753e7c2b6cc06e1c8e562970a000858f1072e
2018-04-06 14:44:49 -07:00
Tom Cherry
d238817037 Merge "Do not check user/group names in pwd/grp tests for OEM uid/gids" 2018-04-05 16:06:37 +00:00
Treehugger Robot
3ffe171d9a Merge "Make sys_ptrace_test.cpp Yama LSM-aware" 2018-04-05 02:13:16 +00:00
Tom Cherry
b4c25c882e Do not check user/group names in pwd/grp tests for OEM uid/gids
Vendors that use config.fs will have their own uniquely named
user/group names for uids/gids that fall in the OEM ranges.  We
continue to allow lookup via oem_## for these values, however the
returned structs will always include the name from config.fs, so we do
not check it for anything in the tests.

Bug: 77549259
Test: bionic unit tests with uid 5000 as AID_CRAS
Change-Id: I27fc1fdd0e22063fea82b4c9d2a6fb8b865c5d7b
2018-04-04 15:02:55 -07:00
Luis Hector Chavez
7300d83b2e Make sys_ptrace_test.cpp Yama LSM-aware
This change enables the tracer process to be able to call ptrace(2) on
the worker process, which is does not have a direct-ancestor dependency.

Bug: 77146512
Test: adb shell \
      /data/nativetest{,64}/bionic-unit-tests{,-static}/bionic-unit-tests-{,-static} \
      --gtest_filter='spawn*'  # aosp_sailfish and Chrome OS
Test: cts-tradefed run singleCommand cts --skip-preconditions \
      -m CtsBionicTestCases --test 'PtraceResumptionTest*'  # aosp_sailfish
                                                            # and Chrome OS
Change-Id: I9e41b3ddde64c0623ba9299cede9d5b2001c8e30
2018-04-04 14:10:57 -07:00
Elliott Hughes
b7fd08cad7 Merge "Support getting/setting API level in static binaries." 2018-04-04 15:24:46 +00:00
Treehugger Robot
bf0f6d0b5a Merge "Fix race in spawn.signal_stress test" 2018-04-04 12:57:40 +00:00
Treehugger Robot
d24dc1b354 Merge "Fix race in ld.config.txt tests" 2018-04-04 10:10:31 +00:00
Ryan Prichard
a1bc826c37 Fix race in spawn.signal_stress test
The default behavior for a real-time signal is to terminate the process.
If the child we fork sends a SIGRTMIN signal before we've set up the
ScopedSignalHandler for it, then the parent is terminated.

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

Test: adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests  --gtest_filter=dl.exec_with_ld_config_file:dl.exec_with_ld_config_file_with_ld_preload:dl.disable_ld_config_file --gtest_repeat=1000
Bug: b/77555708
Change-Id: I9763caa076ece30d1a0eb9c8892a310ac51543b6
2018-04-03 21:57:16 -07:00