diff options
author | Logan Chien <loganchien@google.com> | 2018-01-18 12:05:09 +0800 |
---|---|---|
committer | Logan Chien <loganchien@google.com> | 2018-01-25 14:45:29 +0800 |
commit | 9ee4591cb4a23b3c1a899f5ae3e4d769d0ba5a15 (patch) | |
tree | 317be1850b14a18f65bc8c9247971318c7606307 /libdl | |
parent | 73871ad09be8a8259171d606c4e3e3cf08d4733c (diff) | |
download | android_bionic-9ee4591cb4a23b3c1a899f5ae3e4d769d0ba5a15.tar.gz android_bionic-9ee4591cb4a23b3c1a899f5ae3e4d769d0ba5a15.tar.bz2 android_bionic-9ee4591cb4a23b3c1a899f5ae3e4d769d0ba5a15.zip |
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
Diffstat (limited to 'libdl')
-rw-r--r-- | libdl/libdl.arm.map | 5 | ||||
-rw-r--r-- | libdl/libdl.arm64.map | 5 | ||||
-rw-r--r-- | libdl/libdl.cpp | 11 | ||||
-rw-r--r-- | libdl/libdl.map.txt | 5 | ||||
-rw-r--r-- | libdl/libdl.mips.map | 5 | ||||
-rw-r--r-- | libdl/libdl.mips64.map | 5 | ||||
-rw-r--r-- | libdl/libdl.x86.map | 5 | ||||
-rw-r--r-- | libdl/libdl.x86_64.map | 5 |
8 files changed, 46 insertions, 0 deletions
diff --git a/libdl/libdl.arm.map b/libdl/libdl.arm.map index 1fcfc584d..7ed950361 100644 --- a/libdl/libdl.arm.map +++ b/libdl/libdl.arm.map @@ -41,6 +41,11 @@ LIBC_OMR1 { # introduced=27 __cfi_slowpath_diag; } LIBC_N; +LIBC_PRIVATE { + global: + android_link_namespaces_all_libs; +} LIBC_OMR1; + LIBC_PLATFORM { global: __cfi_init; diff --git a/libdl/libdl.arm64.map b/libdl/libdl.arm64.map index 8d4019ce4..199f2e344 100644 --- a/libdl/libdl.arm64.map +++ b/libdl/libdl.arm64.map @@ -40,6 +40,11 @@ LIBC_OMR1 { # introduced=27 __cfi_slowpath_diag; } LIBC_N; +LIBC_PRIVATE { + global: + android_link_namespaces_all_libs; +} LIBC_OMR1; + LIBC_PLATFORM { global: __cfi_init; diff --git a/libdl/libdl.cpp b/libdl/libdl.cpp index c8340888e..4c2415f1f 100644 --- a/libdl/libdl.cpp +++ b/libdl/libdl.cpp @@ -93,6 +93,11 @@ bool __loader_android_link_namespaces( const char* shared_libs_sonames); __attribute__((__weak__, visibility("default"))) +bool __loader_android_link_namespaces_all_libs( + struct android_namespace_t* namespace_from, + struct android_namespace_t* namespace_to); + +__attribute__((__weak__, visibility("default"))) void __loader_android_dlwarning(void* obj, void (*f)(void*, const char*)); __attribute__((__weak__, visibility("default"))) @@ -205,6 +210,12 @@ bool android_link_namespaces(struct android_namespace_t* namespace_from, } __attribute__((__weak__)) +bool android_link_namespaces_all_libs(struct android_namespace_t* namespace_from, + struct android_namespace_t* namespace_to) { + return __loader_android_link_namespaces_all_libs(namespace_from, namespace_to); +} + +__attribute__((__weak__)) void android_dlwarning(void* obj, void (*f)(void*, const char*)) { __loader_android_dlwarning(obj, f); } diff --git a/libdl/libdl.map.txt b/libdl/libdl.map.txt index 002e9f828..579ffa709 100644 --- a/libdl/libdl.map.txt +++ b/libdl/libdl.map.txt @@ -40,6 +40,11 @@ LIBC_OMR1 { # introduced=27 __cfi_slowpath_diag; } LIBC_N; +LIBC_PRIVATE { + global: + android_link_namespaces_all_libs; +} LIBC_OMR1; + LIBC_PLATFORM { global: __cfi_init; diff --git a/libdl/libdl.mips.map b/libdl/libdl.mips.map index 8d4019ce4..199f2e344 100644 --- a/libdl/libdl.mips.map +++ b/libdl/libdl.mips.map @@ -40,6 +40,11 @@ LIBC_OMR1 { # introduced=27 __cfi_slowpath_diag; } LIBC_N; +LIBC_PRIVATE { + global: + android_link_namespaces_all_libs; +} LIBC_OMR1; + LIBC_PLATFORM { global: __cfi_init; diff --git a/libdl/libdl.mips64.map b/libdl/libdl.mips64.map index 8d4019ce4..199f2e344 100644 --- a/libdl/libdl.mips64.map +++ b/libdl/libdl.mips64.map @@ -40,6 +40,11 @@ LIBC_OMR1 { # introduced=27 __cfi_slowpath_diag; } LIBC_N; +LIBC_PRIVATE { + global: + android_link_namespaces_all_libs; +} LIBC_OMR1; + LIBC_PLATFORM { global: __cfi_init; diff --git a/libdl/libdl.x86.map b/libdl/libdl.x86.map index 8d4019ce4..199f2e344 100644 --- a/libdl/libdl.x86.map +++ b/libdl/libdl.x86.map @@ -40,6 +40,11 @@ LIBC_OMR1 { # introduced=27 __cfi_slowpath_diag; } LIBC_N; +LIBC_PRIVATE { + global: + android_link_namespaces_all_libs; +} LIBC_OMR1; + LIBC_PLATFORM { global: __cfi_init; diff --git a/libdl/libdl.x86_64.map b/libdl/libdl.x86_64.map index 8d4019ce4..199f2e344 100644 --- a/libdl/libdl.x86_64.map +++ b/libdl/libdl.x86_64.map @@ -40,6 +40,11 @@ LIBC_OMR1 { # introduced=27 __cfi_slowpath_diag; } LIBC_N; +LIBC_PRIVATE { + global: + android_link_namespaces_all_libs; +} LIBC_OMR1; + LIBC_PLATFORM { global: __cfi_init; |