diff options
author | Jiyong Park <jiyong@google.com> | 2018-12-13 18:26:48 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2019-01-04 22:29:36 +0900 |
commit | c45fe9f7bd49b110f63b5928d00cf33a7b515d04 (patch) | |
tree | 71c0df52796a2e3b24e1983897f019101e6bcf3e | |
parent | c975355066daf0b3012d236aa4e726b0d3d7e06a (diff) |
Add stubs variants for bionic libs
Bionic libs are part of the runtime APEX (com.android.runtime). In order
to be able to update the runtime APEX independetly from the platform, we
have to prevent things outside of the APEX from using bionic symbols
that are not guaranteed to be stable. Otherwise, platform could break
when a symbol is removed from the libs via the APEX update.
To achive this goal, this change adds stubs variant to the bionic libs.
With this, things outside of the runtime APEX (i.e. other APEXes and the
platform) are built with the stubs variants that provide only the
symbols that are guaranteed to be stable.
The set of symbols are basically the same as the symbols available to
NDK clients. However, there are a few additional symbols that are not
available for NDK but should be made available for platform components.
They are marked with "# apex" tag. Symbols with that tag are not exposed
to apps (via NDK stubs) or vendors (via LLNDK stubs).
Note that the stubs is a build-time only artifact. It is used just to
break the build when private symbols are used outside of the runtime
APEX. At runtime, the real library in the APEX is used.
Bug: 120266448
Test: m
Test: m bionic-unit-tests
Change-Id: I7b8d75830c81d7d7d54e2fca21a85b3417531b47
-rw-r--r-- | libc/Android.bp | 5 | ||||
-rw-r--r-- | libc/libc.map.txt | 34 | ||||
-rw-r--r-- | libdl/Android.bp | 5 | ||||
-rw-r--r-- | libdl/libdl.map.txt | 20 | ||||
-rw-r--r-- | libm/Android.bp | 5 | ||||
-rw-r--r-- | tests/Android.bp | 1 |
6 files changed, 50 insertions, 20 deletions
diff --git a/libc/Android.bp b/libc/Android.bp index 3e607f606..4f371af5f 100644 --- a/libc/Android.bp +++ b/libc/Android.bp @@ -1605,6 +1605,11 @@ cc_library { version_script: ":libc.x86_64.map", }, }, + + stubs: { + symbol_file: "libc.map.txt", + versions: ["10000"], + }, } genrule { diff --git a/libc/libc.map.txt b/libc/libc.map.txt index 4b8463f22..e8809df5e 100644 --- a/libc/libc.map.txt +++ b/libc/libc.map.txt @@ -1450,16 +1450,36 @@ LIBC_Q { # introduced=Q android_fdsan_close_with_tag; android_fdsan_create_owner_tag; android_fdsan_exchange_owner_tag; + android_fdsan_get_error_level; android_fdsan_get_owner_tag; android_fdsan_get_tag_type; android_fdsan_get_tag_value; - android_fdsan_get_error_level; android_fdsan_set_error_level; android_get_device_api_level; getloadavg; pthread_sigqueue; reallocarray; timespec_get; + + # Used by libselinux + __system_properties_init; # apex + + # Used by libmemunreachable + malloc_backtrace; # apex + malloc_disable; # apex + malloc_enable; # apex + malloc_iterate; # apex + + # Used by libmediautils + write_malloc_leak_info; # apex + free_malloc_leak_info; # apex + get_malloc_leak_info; # apex + + # Used by libandroid_net + android_getaddrinfofornet; # apex + + # Used by libandroid_runtime + gMallocLeakZygoteChild; # apex } LIBC_P; LIBC_PRIVATE { @@ -1639,7 +1659,6 @@ LIBC_PRIVATE { _Unwind_VRS_Get; # arm _Unwind_VRS_Pop; # arm _Unwind_VRS_Set; # arm - android_getaddrinfofornet; android_getaddrinfofornetcontext; android_gethostbyaddrfornet; android_gethostbyaddrfornetcontext; @@ -1654,12 +1673,9 @@ LIBC_PRIVATE { dlmalloc_inspect_all; # arm x86 mips dlmalloc_trim; # arm x86 mips dlmalloc_usable_size; # arm x86 mips - free_malloc_leak_info; ftime; # arm x86 mips - get_malloc_leak_info; getdents; # arm x86 mips getdtablesize; # arm x86 mips - gMallocLeakZygoteChild; index; # arm x86 mips issetugid; # arm x86 mips memswap; # arm x86 mips @@ -1677,7 +1693,6 @@ LIBC_PRIVATE { tkill; # arm x86 mips wait3; # arm x86 mips wcswcs; # arm x86 mips - write_malloc_leak_info; } LIBC_Q; LIBC_DEPRECATED { @@ -1687,9 +1702,8 @@ LIBC_DEPRECATED { LIBC_PLATFORM { global: - __system_properties_init; - __system_property_area__; # var __system_property_add; + __system_property_area__; # var __system_property_area_init; __system_property_set_filename; __system_property_update; @@ -1697,8 +1711,4 @@ LIBC_PLATFORM { android_net_res_stats_get_info_for_net; android_net_res_stats_aggregate; android_net_res_stats_get_usable_servers; - malloc_backtrace; - malloc_disable; - malloc_enable; - malloc_iterate; } LIBC_Q; diff --git a/libdl/Android.bp b/libdl/Android.bp index c4078a0c5..262da6c7d 100644 --- a/libdl/Android.bp +++ b/libdl/Android.bp @@ -100,6 +100,11 @@ cc_library { sanitize: { never: true, }, + + stubs: { + symbol_file: "libdl.map.txt", + versions: ["10000"], + }, } ndk_library { diff --git a/libdl/libdl.map.txt b/libdl/libdl.map.txt index c5d1be4d0..15148276a 100644 --- a/libdl/libdl.map.txt +++ b/libdl/libdl.map.txt @@ -41,15 +41,19 @@ LIBC_OMR1 { # introduced=27 __cfi_slowpath_diag; } LIBC_N; +LIBC_Q { # introduced=29 + global: + android_create_namespace; # apex + android_dlwarning; # apex + android_get_LD_LIBRARY_PATH; # apex + android_get_exported_namespace; # apex + android_init_anonymous_namespace; # apex + android_link_namespaces; # apex + android_set_application_target_sdk_version; # apex +} LIBC_OMR1; + LIBC_PLATFORM { global: __cfi_init; - android_dlwarning; - android_set_application_target_sdk_version; - android_get_LD_LIBRARY_PATH; android_update_LD_LIBRARY_PATH; - android_init_anonymous_namespace; - android_create_namespace; - android_link_namespaces; - android_get_exported_namespace; -} LIBC_OMR1; +} LIBC_Q; diff --git a/libm/Android.bp b/libm/Android.bp index 2463dfb02..28cf1fd1f 100644 --- a/libm/Android.bp +++ b/libm/Android.bp @@ -510,6 +510,11 @@ cc_library { // TODO(ivanlozano): Remove after b/118321713 xom: false, + + stubs: { + symbol_file: "libm.map.txt", + versions: ["10000"], + }, } ndk_library { diff --git a/tests/Android.bp b/tests/Android.bp index 899fc6691..90167d19c 100644 --- a/tests/Android.bp +++ b/tests/Android.bp @@ -42,6 +42,7 @@ cc_defaults { sanitize: { never: true, }, + bootstrap: true, } // ----------------------------------------------------------------------------- |