Commit graph

25246 commits

Author SHA1 Message Date
Logan Chien
e3c8028c98 Merge "linker: Allow link namespaces without name filters"
am: 40517761dc

Change-Id: Iffb0070ca22a09a8a8b18ec5604f11a529c9ba45
2018-01-26 04:54:09 +00:00
Logan Chien
40517761dc Merge "linker: Allow link namespaces without name filters" 2018-01-26 04:45:26 +00:00
Chih-Hung Hsieh
f81abef148 Use __BIONIC_FORTIFY_VARIADIC for variadic functions.
* Variadic functions usually cannot be inlined.
* Do not use misleading __always_inline attribute,
  and also avoid early clang 7.0 compiler bug.

Bug: 72412382
Test: build and boot aosp*-eng in emulator
Change-Id: I7490976166581abc626f397ad408581ada0ed308
2018-01-25 17:54:50 -08:00
Yabin Cui
922d00025f Merge "Support priority inheritance mutex in 64bit programs."
am: 25ac4476d8

Change-Id: I4fec417ef60302c5c86f87a12d00a752ac3275d6
2018-01-25 23:51:00 +00:00
Elliott Hughes
5046e5fe87 Make the <android/dlext.h> docs show up on the web.
Just enough doxygen so that
https://developer.android.com/ndk/reference/dlext_8h.html won't be completely
devoid of all this.

Bug: N/A
Test: ran doxygen manually
Change-Id: I1e0667feae93227e32c1bd671065359f5be85d9d
2018-01-25 15:48:32 -08:00
Yabin Cui
25ac4476d8 Merge "Support priority inheritance mutex in 64bit programs." 2018-01-25 23:43:25 +00:00
Dan Albert
b1d307dcbe Merge "Fix __gnu_Unwind_Find_exidx for static executables."
am: 4a2407b3a1

Change-Id: I5e0084321f3c7c8fa8f86c607fbd86f0f9eab87e
2018-01-25 23:08:20 +00:00
Treehugger Robot
4a2407b3a1 Merge "Fix __gnu_Unwind_Find_exidx for static executables." 2018-01-25 22:53:44 +00:00
Dan Albert
aeb5bc658f Fix __gnu_Unwind_Find_exidx for static executables.
__exidx_start and __exidx_end are not actual values to be read, just
symbols placed before and after .ARM.exidx.

The default linker script for ARM static executables includes these
lines:

    __exidx_start = .;
   .ARM.exidx   : { *(.ARM.exidx*) }
    __exidx_end = .;

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0474c/BABEHEDA.html

Test: used __gnu_Unwind_Find_exidx in a static executable and showed
      non-bogus values
Test: verified that this fixes #593 in the NDK
Bug: https://github.com/android-ndk/ndk/issues/593
Change-Id: Ib35a4b6c82920666ae8a45aa0a2d43e458699b51
2018-01-25 12:48:57 -08:00
Logan Chien
9ee4591cb4 linker: Allow link namespaces without name filters
This commit allows users to create a link without soname filters between
two linker namespaces.

The motivation is to establish one-way shared library isolation.  For
example, assume that there are two linker namespaces `default` and
`vndk`.  We would like to limit the shared libraries that can be used by
the `default` namespace.  In the meanwhile, we would like to allow the
`vndk` namespace to use shared libs from the `default` namespace if the
soname cannot be find in the search path or loaded sonames of the `vndk`
namespace.

          shared_libs  = %VNDK_CORE_LIBRARIES%
          shared_libs += %VNDK_SAMEPROCESS_LIBRARIES%
    vndk <-------------------------------------------- default
       \_______________________________________________/^
                allow_all_shared_libs = true

android_link_namespaces_all_libs() is added to libdl, but it is
versioned as LIBC_PRIVATE.  android_link_namespaces_all_libs() is only
for unit tests.

Bug: 69824336

Test: adb shell /data/nativetest/linker-unit-tests/linker-unit-tests32
Test: adb shell /data/nativetest64/linker-unit-tests/linker-unit-tests64

Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Test: adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests

Test: Update /system/etc/ld.config*.txt and check whether the vndk
linker namespace of the vendor process can access the shared libs from
the default linker namespace.

Change-Id: I2879f0c5f5af60c7e56f8f743ebd2872e552286b
2018-01-25 14:45:29 +08:00
Dan Albert
3e4d4d4cf2 Add _FORCE_CRT_ATFORK config for crtbegin.
libc.a is always the latest library regardless of target API level.

Test: treehugger
Bug: None
Change-Id: I844dc85a9283693b01d0fbdc26854bde82c750dc
2018-01-24 22:36:31 -08:00
Dan Albert
95ceae7b1a Merge changes from topic "update-ndk-crt-objects"
am: cb405b2987

Change-Id: I69f105023ca6a982ee4703b1acad7b6b84a6963d
2018-01-25 03:47:05 +00:00
Treehugger Robot
cb405b2987 Merge changes from topic "update-ndk-crt-objects"
* changes:
  Partial revert of "Remove obsolete __stack_chk_fail_local."
  Pre-M and GCC compatibility for crtbegin.
2018-01-25 03:42:36 +00:00
Dan Albert
586b6761d0 Partial revert of "Remove obsolete __stack_chk_fail_local."
These sources are going to be used for the NDK as well, and the NDK
still uses GCC.

This partially reverts commit
4af220cfef. That commit also removed
this symbol from the linker's crtbegin (it has its own). That is
still only built with Clang, so we don't need to revert that part.

Test: treehugger
Bug: None
Change-Id: Iba231baf298e228135bdf48dfed87f9089975eb1
2018-01-24 16:37:48 -08:00
Dan Albert
2e2c72d61f Pre-M and GCC compatibility for crtbegin.
We're going to start using the bionic sources for the NDK CRT
objects, so we need to avoid using symbols that weren't around in
early versions of Android. The NDK is currently building the CRT
objects with GCC as well (there were some segfaults that have yet to
be diagnosed), so move `__used` to the GCC compatible location.

Test: treehugger
Bug: None
Change-Id: I1f5c23eafadc2e3bc0b84bc3305f79a04d35c7d8
2018-01-24 16:37:48 -08:00
Yabin Cui
6b9c85b36d Support priority inheritance mutex in 64bit programs.
Bug: http://b/29177606
Test: run bionic-unit-tests on walleye.
Test: run bionic-unit-tests-glibc on host.
Change-Id: Iac349284aa73515f384e7509445f87434757f59e
2018-01-24 16:11:07 -08:00
Josh Gao
72282add20 linker_memory: return success in enable_fallback_allocator.
Instead of aborting when in use, return a bool instead.

Test: debuggerd_test
Change-Id: Ifd2e4439303c95054298b0a05e0cb648ded1306c
2018-01-24 15:08:53 -08:00
Elliott Hughes
f9e87abf4a Merge "Deprecate readdir_r."
am: 73871ad09b

Change-Id: I4ffafc2d8b75888721b406c5596652c09164c684
2018-01-23 21:58:53 +00:00
Elliott Hughes
73871ad09b Merge "Deprecate readdir_r." 2018-01-23 21:51:22 +00:00
Victor Hsieh
8c3d156797 Merge "Block bunch of privileged syscalls to apps"
am: 6ea80375e6

Change-Id: I899fbf6aaca4307c34900cdecd9e10adb8f66ce0
2018-01-23 18:31:58 +00:00
Treehugger Robot
6ea80375e6 Merge "Block bunch of privileged syscalls to apps" 2018-01-23 17:54:30 +00:00
Victor Hsieh
2f23ceda44 Block bunch of privileged syscalls to apps
Test: build, run some app
Bug: 63944145
Change-Id: I13eb56f923732e110851dec02eaa11f6cb44535c
2018-01-22 22:30:17 -08:00
Elliott Hughes
f19af37b5e Deprecate readdir_r.
I've been campaigning against readdir_r for years:

  http://elliotth.blogspot.com/2012/10/how-not-to-use-readdirr3.html

and glibc deprecated it in 2.24, so we should join the club.

Bug: http://b/32678321
Test: builds
Change-Id: Ie3887ed75989aced9324266aa3b93e85c11bdbc9
2018-01-22 17:15:25 -08:00
Elliott Hughes
46170f871a Merge "linker: add experimental support for SHT_RELR sections."
am: d00d38b36b

Change-Id: Id9b7b7157b0df70276253ca28e2136ce54353edb
2018-01-23 00:38:38 +00:00
Elliott Hughes
d00d38b36b Merge "linker: add experimental support for SHT_RELR sections." 2018-01-23 00:24:26 +00:00
Dan Albert
aaec2dffb0 Merge "Package bionic static libraries in the NDK."
am: 86a2fba164

Change-Id: Idfd654b03f9b085d6f6cc3bee793d4a4d5e5159a
2018-01-22 20:50:06 +00:00
Treehugger Robot
86a2fba164 Merge "Package bionic static libraries in the NDK." 2018-01-22 20:41:27 +00:00
Rahul Chaudhry
b7feec7454 linker: add experimental support for SHT_RELR sections.
This change adds experimental support for SHT_RELR sections, proposed
here: https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg

Definitions for the new ELF section type and dynamic array tags, as well
as the encoding used in the new section are all under discussion and are
subject to change. Use with caution!

Bug: None
Test: Built image for marlin, flashed on device, ran arm and
      aarch64 binaries containing '.relr.dyn' sections.

Change-Id: I2953ae932d3c42ae394e71f8fa058013758a1778
2018-01-22 12:41:27 -08:00
Dan Albert
40f15ec4b1 Package bionic static libraries in the NDK.
Test: build/soong/scripts/build-ndk-prebuilts.sh
Bug: https://github.com/android-ndk/ndk/issues/272
Change-Id: Ibb21d799fdcf230ed45db0b809e20dd86d2d8e52
2018-01-22 12:40:56 -08:00
Dan Albert
72e8ff8325 Merge "Include what we use."
am: 88e61da8a7

Change-Id: Ie04211846fac94132a3616cd6c8da59485930e44
2018-01-22 20:34:03 +00:00
Dan Albert
88e61da8a7 Merge "Include what we use." 2018-01-22 20:23:53 +00:00
Dan Albert
8583d5a766 Include what we use.
Test: mma
Bug: None
Change-Id: I88a23673fdad3babaaef89acd7e369419dc1ee3a
2018-01-22 12:20:16 -08:00
Dan Albert
861b08388d Merge "Reland "Cleanup transitive includes in the legacy inlines.""
am: c728aa3127

Change-Id: I32c81e3bab578c8be9cc7365c90b161ada4d6520
2018-01-22 19:56:40 +00:00
Treehugger Robot
c728aa3127 Merge "Reland "Cleanup transitive includes in the legacy inlines."" 2018-01-22 19:32:23 +00:00
Elliott Hughes
5d550bd752 Merge "Address a bunch of clang-tidy complaints."
am: e5fbd983cb

Change-Id: Ib3f319e3ad1dfb7c13c9491f9269f00c04468b17
2018-01-20 18:20:00 +00:00
Elliott Hughes
f75319afca Merge "Simplify CT_CCL and CT_STRING inner loop."
am: 055565b2aa

Change-Id: I46bb5d55f5508bd586e16fca0a57a69b0af8a388
2018-01-20 18:19:38 +00:00
Treehugger Robot
e5fbd983cb Merge "Address a bunch of clang-tidy complaints." 2018-01-20 18:15:12 +00:00
Elliott Hughes
055565b2aa Merge "Simplify CT_CCL and CT_STRING inner loop." 2018-01-20 18:14:24 +00:00
Elliott Hughes
6f035645d0 Merge "Document that dlclose with thread_local is fixed in P."
am: fb96db14d1

Change-Id: I68a3ee9019bb882b1073da7972a14b9bdadde1b2
2018-01-20 04:54:54 +00:00
Treehugger Robot
fb96db14d1 Merge "Document that dlclose with thread_local is fixed in P." 2018-01-20 04:48:24 +00:00
Elliott Hughes
3048a36a34 Simplify CT_CCL and CT_STRING inner loop.
Makes no difference to the benchmarks, but does make the code a bit
more readable.

Bug: http://b/68672236
Test: ran tests, benchmarks
Change-Id: I63fa5f78d077c86e4f4f194f2c76ab5510c29109
2018-01-19 17:58:07 -08:00
Elliott Hughes
d88740e608 Merge "Support %mc/%ms/%m[ in sscanf."
am: 2b66844a0b

Change-Id: I9318bf8cc028ca5588cba33624ff3fb1da0c757f
2018-01-20 01:25:56 +00:00
Treehugger Robot
2b66844a0b Merge "Support %mc/%ms/%m[ in sscanf." 2018-01-20 01:17:25 +00:00
Elliott Hughes
5cec377f49 Address a bunch of clang-tidy complaints.
There were a bunch more unreasonable/incorrect ones, but these ones
seemed legit. Nothing very interesting, though.

Bug: N/A
Test: ran tests, benchmarks
Change-Id: If66971194d4a7b4bf6d0251bedb88e8cdc88a76f
2018-01-19 15:56:12 -08:00
Elliott Hughes
38e4aefe6c Support %mc/%ms/%m[ in sscanf.
Also support the "long" (wchar_t) variants.

Bug: http://b/68672236
Test: ran tests
Change-Id: I060e98b4d2feb61e12986d9d51e4710b2b1d9724
2018-01-19 14:53:55 -08:00
Elliott Hughes
e61e0cda99 Document that dlclose with thread_local is fixed in P.
Bug: https://github.com/android-ndk/ndk/issues/360
Test: N/A
Change-Id: Ib9807045bd3206fa3cd300ab70ebed93c73a58e4
2018-01-19 10:33:41 -08:00
Ian Pedowitz
01d28eab25 Merge "Fixing app compat issue b/72143978"
am: df4c92888e

Change-Id: Id7b79652ef18c1f7ca396b5e5bcbb4ace7b1c8a6
2018-01-19 04:10:01 +00:00
Treehugger Robot
df4c92888e Merge "Fixing app compat issue b/72143978" 2018-01-19 02:38:33 +00:00
Chenbo Feng
f09ab8a96b Merge "Add bpf syscall to seccomp whitelist"
am: 0dac05642e

Change-Id: I00cb78dbcb1c49cee13a5d83a1d0533e95491f4f
2018-01-19 02:04:48 +00:00
Treehugger Robot
0dac05642e Merge "Add bpf syscall to seccomp whitelist" 2018-01-19 01:59:05 +00:00