Commit graph

25323 commits

Author SHA1 Message Date
Ryan Prichard
6631f9b03d Clean up TLS_SLOT_BIONIC_PREINIT usage a bit
- It is only needed for dynamic executables, so move the initialization
   out of __libc_init_main_thread and just before the solib constructor
   calls. For static executables, the slot was initialized, then never
   used or cleared. Instead, leave it clear.

 - For static executables, __libc_init_main_thread already initialized the
   stack guard, so remove the redundant __init_thread_stack_guard call.

 - Simplify the slot access/clearing a bit in __libc_preinit.

 - Remove the "__libc_init_common() will change the TLS area so the old one
   won't be accessible anyway." comment. AFAICT, it's incorrect -- the
   main thread's TLS area in a dynamic executable is initialized to a
   static pthread_internal_t object in the linker, then reused by libc.so.

Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Test: adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
Change-Id: Ie2da6f5be3ad563fa65b38eaadf8ba6ecc6a64b6
2018-05-30 15:43:43 -07:00
Dimitry Ivanov
aa922bbaf3 Merge "Add secondary counter in place of tls_nodelete flag" 2018-05-30 15:32:40 +00:00
dimitry
55547db434 Add secondary counter in place of tls_nodelete flag
The tls_nodelete state should apply to load_group not
isolated soinfo. This actually also means that multiple
soinfos may have tls_counter on their dso_handles.

This change replaces TLS_NODELETE flag with secondary counter.
Note that access to the secondary counter (located inside soinfo)
is pretty expensive because it requires soinfo lookup by dso_handle
whereas dso_handle counter is much faster. This is why it is updated
only when dso_handle counter starts or hits 0.

Bug: http://b/80278285
Test: bionic-unit-tests --gtest_filter=dl*
Change-Id: I535583f6714e45fa2a7eaf7bb3126da20ee7cba9
2018-05-30 10:56:59 +02:00
Dimitry Ivanov
d980cc0c51 Merge "Remove libskia.so from the greylist" 2018-05-30 08:28:15 +00:00
Elliott Hughes
d7cabc96ae Merge "Fix the map for pthread_cond_timedwait_monotonic_np." 2018-05-30 00:24:46 +00:00
Elliott Hughes
12306f0aa0 Fix the map for pthread_cond_timedwait_monotonic_np.
Bug: https://github.com/android-ndk/ndk/issues/708
Test: builds
Change-Id: Icaa1f8cb796a0a117cbe2e10391c965c857d6d37
2018-05-29 13:12:21 -07:00
Christopher Ferris
d566b93091 Merge "Point to online documentation." 2018-05-29 17:57:10 +00:00
Tom Cherry
28567aeb26 Merge "Test that vendor AID names begin with vendor_" 2018-05-29 17:56:26 +00:00
Christopher Ferris
770cbb35cf Point to online documentation.
Test: Unit tests pass.
Change-Id: Ibbdc260bfdf6a6daf091c4a49cdf03e51f6ca6cf
2018-05-25 13:28:05 -07:00
dimitry
6e6772dcb2 Remove libskia.so from the greylist
The library is no longer available on the devices.

Bug: http://b/31971097
Test: make
Change-Id: Ie87bb8a8c200d086d272ca923242bfbab6397126
2018-05-25 10:37:49 +02:00
Treehugger Robot
8aa6d67f2d Merge "Link to native_heapdump_viewer.py." 2018-05-25 06:04:06 +00:00
Treehugger Robot
a3c7fe5417 Merge "Reenable __work_around_b_24465209__ for x86 linker" 2018-05-25 05:06:18 +00:00
Ryan Prichard
7046f391d1 Reenable __work_around_b_24465209__ for x86 linker
Bug: b/80258696
Test: build aosp_x86-userdebug ; run emulator
Change-Id: If7de24c3fc91a143c0bd17c6364c56ec04dfb08e
(cherry picked from commit dac8340c43)
2018-05-24 20:14:56 -07:00
Elliott Hughes
149671875d Link to native_heapdump_viewer.py.
Bug: N/A
Test: N/A
Change-Id: I1e448f30922d948513ebb65abc25c474ffbd5a24
2018-05-24 18:44:31 -07:00
Elliott Hughes
ebf58a6cef Merge "Add generic arm non-neon memmove." 2018-05-24 23:53:36 +00:00
Christopher Ferris
7caf313168 Merge "Modify the script to use the linux source tree." 2018-05-24 23:50:07 +00:00
Treehugger Robot
b2341cdfe3 Merge "Adapt to versioned_ndk_headers renaming." 2018-05-24 23:47:56 +00:00
Christopher Ferris
764049dce4 Modify the script to use the linux source tree.
The current code checks out the android kernel tree. Long ago, we moved
to using the linux kernel source code. Modify the script to actually
do this.

Bug: 6653610

Test: Ran the script using the --download_kernel option and without.
Change-Id: I769e769edea272f4f8c9c8d2e76bd336059c66e3
2018-05-24 15:10:33 -07:00
Elliott Hughes
da46caee09 Add generic arm non-neon memmove.
From OpenBSD.

Bug: http://b/63992911
Test: ran tests
Change-Id: If7d9166922776cdc9333ff04205f9c6312a812b3
2018-05-24 14:57:15 -07:00
Dan Albert
26e1c41f5c Adapt to versioned_ndk_headers renaming.
Test: make checkbuild
Bug: None
Change-Id: I89b931c8519eb4f336fb1a338d6b6518c50bcee1
2018-05-24 14:56:46 -07:00
Tom Cherry
e88b4083e4 Test that vendor AID names begin with vendor_
Now that we're only processing vendor AID names that begin with
vendor_, add an explicit test to fail devices that use AID names
without this prefix.

Bug: 79528966
Test: Pass if no vendor defined AIDs are present
Test: Pass if vendor defined AIDs are present with vendor_ prefix
Test: Fail if vendor defined AIDs are present without vendor_ prefix

Change-Id: I77c559800b4904f58c49fbe339e4daad7d953089
2018-05-24 14:44:10 -07:00
Christopher Ferris
7bfc149b43 Merge "Add support for using the new unwinder." 2018-05-24 18:06:02 +00:00
Chih-hung Hsieh
6b4f809476 Merge "Work around b/24465209, do not pack relocation table." 2018-05-24 16:34:28 +00:00
Christopher Ferris
93bdd6ae3a Add support for using the new unwinder.
This adds a new option backtrace_full, when it is set, then it will use
libunwindstack.

Modify the dump to file data to dump the extra information from libunwindstack.
Along with the new dump file format, change the version to v1.1.
Updated document for new format of file data.

Add unit tests for the new functionality.

Bug: 74361929

Test: Ran unit tests.
Change-Id: I40fff795f5346bba7b9d7fde2e04f269ff4eb7f1
2018-05-24 08:44:53 -07:00
Chih-Hung Hsieh
ecbff8382d Work around b/24465209, do not pack relocation table.
Global flag --pack-dyn-relocs=android is used with clang lld.
For b/24465209, we need to override that with --pack-dyn-relocs=none.

Bug: 80093890
Bug: 24465209
Test: build with USE_CLANG_LLD=true and run dlext.compat_elf_hash_and_relocation_tables
Change-Id: Ic3837446ff0deccf4e66425b39d3b062abcacc5e
2018-05-23 18:45:53 -07:00
Treehugger Robot
778a84f75b Merge "Define DT_ANDROID_REL[A] correctly for a test" 2018-05-24 00:01:36 +00:00
Ryan Prichard
6814028920 Define DT_ANDROID_REL[A] correctly for a test
DT_ANDROID_REL is 0x6000000f, but this code defined it as 0x60000002.
DT_ANDROID_RELA is 0x60000011, but this code defined it as 0x60000004.

compat_elf_hash_and_relocation_tables tests that certain shared libraries
are linked with ordinary relocations and not with packed relocations. A
shared library will only have one kind of relocation table, so the test
mostly still worked by requiring DT_REL[A].

Previously, this test would have allowed libdl.so to have packed
relocations.

Test: /data/nativetest/bionic-unit-tests/bionic-unit-tests \
  --gtest_filter=dlext.compat_elf_hash_and_relocation_tables
Test: manual
Bug: none
Change-Id: Ic8aa919a68fb6ed01a7994b69c0c7dd3798d6b67
2018-05-23 14:40:40 -07:00
Chih-hung Hsieh
4c5c45346f Merge "Work around b/24465209, do not use clang lld" 2018-05-23 17:17:18 +00:00
Chih-Hung Hsieh
0fc5df0fde Work around b/24465209, do not use clang lld
See longer explanation in b/80093890.
Clang lld does not generate expected DT_REL and DT_RELA tags
with --hash-style=both and --pack-dyn-relocs=android.
I am not sure about the extent of b/24465209, so
I would rather not to use lld for these .so files for now.

Bug: 80093890
Bug: 24465209
Test: build with USE_CLANG_LLD=true and run dlext.compat_elf_hash_and_relocation_tables
Change-Id: I94e9fe8d687daeadb0182ae26596ca11d3f8bd9b
2018-05-23 17:14:22 +00:00
Treehugger Robot
a6a56784e0 Merge "Do not use clang lld with -z,global" 2018-05-22 18:03:46 +00:00
Chih-Hung Hsieh
8e462d411a Do not use clang lld with -z,global
Bug: 80109858
Test: bionic unit test dlfcn.dlsym_df_1_global
Change-Id: Icc754385e54a5cd70312c60c635c094a27249442
2018-05-21 23:49:31 -07:00
Treehugger Robot
b886592923 Merge "Mark as recovery_available: true" 2018-05-22 05:16:20 +00:00
Logan Chien
054106bb76 Merge changes from topic "single-gsi"
* changes:
  Use ro.vndk.lite to determine the ld.config.txt
  Extract ld.config.txt lookup code
2018-05-22 04:04:07 +00:00
Logan Chien
bcfe3cf06e Use ro.vndk.lite to determine the ld.config.txt
This commit adds an extra check on `ro.vndk.lite`.  If `ro.vndk.lite` is
true, the linker will pick `/system/etc/ld.config.vndk_lite.txt`.

The purpose of this change is to distinguish:

1. Master-GSI + Master-VENDOR (w/o BOARD_VNDK_VERSION for upgrading devices)
2. Master-GSI + O-MR1-VENDOR (w/ BOARD_VNDK_VERSION)

Bug: 78605339
Test: aosp_sailfish Master-SYSTEM + Master-VENDOR boots
Test: aosp_sailfish Master-GSI    + Master-VENDOR boots
Test: aosp_walleye  Master-SYSTEM + Master-VENDOR boots
Test: aosp_walleye  Master-GSI    + Master-VENDOR boots
Test: aosp_walleye  Master-GSI    + O-MR1-VENDOR boots
Change-Id: I34f243f73c173ca2e882d3738ccb81e3fad3a9da
Merged-In: I34f243f73c173ca2e882d3738ccb81e3fad3a9da
(cherry picked from commit dd18472e56)
2018-05-17 14:27:00 +08:00
Logan Chien
886b96ef9a Extract ld.config.txt lookup code
This commit extracts ld.config.txt lookup code into
`get_ld_config_file_path()`.

Bug: 78605339
Test: aosp_walleye-userdebug builds and boots
Change-Id: I129f19cd032de02a56bda57231521c02a4b4e4c0
Merged-In: I129f19cd032de02a56bda57231521c02a4b4e4c0
(cherry picked from commit 21e496cf29)
2018-05-17 14:26:54 +08:00
Tom Cherry
903e5702f4 Merge "Require vendor users and groups to start with vendor_" 2018-05-16 16:19:28 +00:00
Tom Cherry
c2b9fec50b Require vendor users and groups to start with vendor_
Require that users and groups found in /vendor/etc/{passwd,group}
start with vendor_.  This is needed to compliance with Treble as
without this prefix, it is possible for a new system image to create a
user/group name that a vendor has already used, causing a collision.

Bug: 79528966
Test: new unit test
Change-Id: I07500641e165f41526a8101592d83fa174e7a711
2018-05-15 14:10:21 -07:00
Jiyong Park
5603c6e6b9 Mark as recovery_available: true
Libraries that are direct or indirect dependencies of modules installed
to recovery partition (e.g. toybox) are marked as recovery_available:
true. This allows a recovery variant of the lib is created when it is
depended by other recovery or recovery_available modules.

Bug: 67916654
Bug: 64960723
Bug: 63673171
Bug: 29921292
Test: m -j
Change-Id: I59bf859a10a218af6591025a0fe7d1853e328405
2018-05-14 18:08:01 +09:00
Elliott Hughes
af2eb6f40a Merge changes I8eae0c98,I09d32dcb
* changes:
  vdso should be available in all namespaces
  Unhardcode /system/lib
2018-05-12 15:51:10 +00:00
dimitry
8b142566e3 vdso should be available in all namespaces
vdso should be available in all namespaces when present. This
bug went undetected because the way libc currently uses vdso (it
does all the lookups itself). This makes it available for the
programs that want to take advantage by dlopening it.

Bug: http://b/73105445
Bug: http://b/79561555
Test: adb shell /data/nativetest/arm/bionic-unit-tests/bionic-unit-tests --gtest_filter=dl.exec_with_ld_config_file
Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests --gtest_filter=dl*
Change-Id: I8eae0c9848f256190d1c9ec85d10dc6ce383a8bc
(cherry picked from commit 69c68c46ac)
2018-05-12 10:58:00 +02:00
dimitry
e0906d8f55 Unhardcode /system/lib
Default search path may be different for native bridged enviroments

Bug: http://b/73105445
Test: adb shell /data/nativetest/arm/bionic-unit-tests/bionic-unit-tests --gtest_filter=dl.exec_with_ld_config_file
Change-Id: I09d32dcb8a7a3f161ccc6d58c29252e79ea5fd3e
(cherry picked from commit 1280cf5fd8)
2018-05-12 10:57:46 +02:00
Elliott Hughes
3f185dc01e Merge changes I8693c641,I9efbc23b,Ifa03eb36
* changes:
  Switch to FreeBSD's actual sincos.
  Switch to FreeBSD catrigl.c for complex arc trig functions.
  Update libm from upstream.
2018-05-12 00:48:08 +00:00
Christopher Ferris
47eba63c5b Merge "Add support for cortex-a55/cortex-a75." 2018-05-11 17:56:12 +00:00
Christopher Ferris
4da58cf630 Add support for cortex-a55/cortex-a75.
Bug: 78133793
Bug: 78242072

Test: Builds and ran to verify best libc routines.
Change-Id: I2299b8f0f6379c9003072764978ea917b74aee4f
Merged-In: I2299b8f0f6379c9003072764978ea917b74aee4f
(cherry picked from commit 3162eb3b81)
2018-05-11 00:43:01 +00:00
Treehugger Robot
62a93ee1a0 Merge "Fix typo in comment" 2018-05-10 22:18:26 +00:00
Tom Cherry
e267f1a7aa Fix typo in comment
Test: n/a
Change-Id: I2a869ad920a9867fda9864e11fdaa0d66611b181
2018-05-10 20:41:44 +00:00
Treehugger Robot
182523798c Merge "Remove obsolete workaround." 2018-05-10 02:35:48 +00:00
Elliott Hughes
e332f658e0 Switch to FreeBSD's actual sincos.
Before:
  BM_math_sin_fast                48 ns         48 ns   14693053
  BM_math_sincos                  61 ns         61 ns   11470219

After:
  BM_math_sin_fast                48 ns         48 ns   14725120
  BM_math_sincos                  43 ns         43 ns   16329843

Bug: N/A
Test: ran tests, benchmarks
Change-Id: I8693c64135233c0641af5302c38748f47ac76737
2018-05-09 12:25:12 -07:00
Elliott Hughes
0364a4b446 Switch to FreeBSD catrigl.c for complex arc trig functions.
Bug: N/A
Test: ran tests
Change-Id: I9efbc23bc101fcf04a01334748461f5467dcf85e
2018-05-09 12:24:28 -07:00
Elliott Hughes
8da8ca4528 Update libm from upstream.
Bug: N/A
Test: ran tests
Change-Id: Ifa03eb36d412a2776208cd2921936be4724e5547
2018-05-09 12:24:21 -07:00