Commit graph

269 commits

Author SHA1 Message Date
Jiyong Park
fa4971f3c3 Search rs namespace prior to vndk namespace
With the recent change that removed get_exported_namespace out of libdl,
the RenderScript SP-HAL stopped using android_dlopen_ext which it used
to load libRS_internal.so in the "rs" namespace. Instead, it now falls
back to the ordinary dlopen() call. The dlopen() call tries to load the
lib in the current namespace (which is sphal) and then falls back to the
linked namespaces: default, vndk, rs.

The problem is that rs is listed as the last namespace and therefore the
linker tries the namespace only when it failed to load the library in
other namespaces: default and vndk. libRS_internal.so is accessible to
both vndk and rs namespaces. So, the dlopen() call always goes into the
vndk namespace and there is no chance for the lib to be loaded in the rs
namespace.

To fix the problem, the rs namespace is placed before vndk so that the
namespace is tried first.

Bug: 129550847
Test: runtest -x cts/tests/camera/src/android/hardware/
Change-Id: Idafc32f8a309dd12495768931d7ea17a2f791c50
2019-04-02 02:43:23 +00:00
Martin Stjernholm
60de348654 Merge "Apply the standard system linker config to all of /data." 2019-03-28 12:37:29 +00:00
Martin Stjernholm
adf4503de1 Apply the standard system linker config to all of /data.
This is necessary to get the correct APEX namespace setup for apps that
executes binaries from there.

In older releases no linker config applied to binaries in /data, so the
fallback config in /system/bin/linker was used, which basically just looked
up libraries in /system/{lib,lib64}. With the introduction of APEXes that
location no longer contains the complete set of libraries, so this is
necessary to retain functional parity.

Strictly speaking this fallback rule should apply as last resort for a
binary in any location, but the linker does not accept "dir.system = /".

Test: Flash and boot
Test: The app regression in b/128569634
Bug: 128569634
Change-Id: Icfcd66f0a7d8d898618be1b6186bb1111d20d688
2019-03-26 18:10:51 +00:00
Martin Stjernholm
5c074e0ab9 Remove links to libart(d).so in the runtime.
They are not needed since the binaries and relevant exported libraries have
moved to the Runtime APEX.

Test: Flash and boot
Test: atest CtsJniTestCases CtsJdwpTestCases
Bug: 119867084
Change-Id: If416fbae7057aec02059bb31a4dcd8b63dcc0cad
2019-03-26 17:24:12 +00:00
Pete Bentley
cc6c50a123 Tighten native API surface.
AsynchronousCloseMonitor is moved into libandroidio by
r.android.com/910073 and so libjavacore no longer needs to
be linked to the conscrypt namespace.

Bug: 123744297
Test: m && flashall
Test: atest CtsLibcoreOkHttpTestCases
Test: atest CtsLibcoreTestCases
Change-Id: Id720b59e4ef42a2c0226b497a1cc3c54f7a837d0
2019-03-21 17:13:14 +00:00
Vic Yang
c3e96512c0 Merge "Add support for no-vendor-variant VNDK" 2019-03-21 04:30:47 +00:00
Roland Levillain
5c99a0c067 Include tests directories in the linker legacy configuration.
Make ld.config.legacy.txt similar to other linker configurations with
respect to tests in /data/{nativetest,benchmarktest}{,64}.

Note: The linker legacy configuration is used by the ART generic build
targets, defined in project device/generic/art.

Test: ART chroot-based on-device testing using the master-art
Bug: 121117762
Change-Id: I6c8fafa2568862e450aa7b9fea1177a184cb9705
2019-03-18 19:07:32 +00:00
Dongwon Kang
a013e3d53d List stable libraries media apex relies on.
With allow_all_shared_libs, the libs under /system/lib may be used
instead of libs included in the apex. This change adds stable libraries
the media apex relies on to prevent this case.

Test: dumpsys media.extractor, atest MediaPlayer2Test
Bug: 127791685

Change-Id: I6a0419e6da9e9f48a394257b1e8f977ec2dfa9a1
2019-03-15 17:23:03 -07:00
Jiyong Park
7b4801a921 Don't bind-mount bionic files
Bind-mounting of the bionic files on /bionic/* paths no longer required
as there are direct symlinks from bionic files in /system partition to
the corresponding bionic files in the runtime APEX. e.g.,

/system/lib/libc.so -> /apex/com.android.runtime/lib/bionic/libc.so

Bug: 125549215
Test: m; devices boots
Change-Id: I4a43101c3e3e2e14a81001d6d65a8a4b727df385
2019-03-14 07:35:54 +09:00
Vic Yang
19b3a51f64 Add support for no-vendor-variant VNDK
When no-vendor-variant VNDK is enabled, the vendor variant of VNDK
libraries are not installed.  In this case, the vendor binaries need to
be able to link in the core variant.

Update the linker config so that we export such VNDK libraries to the
proper linker namespaces.

Bug: 119423884
Test: Enable no-vendor-variant VNDK for a dummy VNDK library.  Boot and
      check the vendor variant does not exist and only the core variant
      is used.

Change-Id: I71274fdf61373663603a5fbc3497400420094fcf
2019-03-12 13:30:46 -07:00
Roland Levillain
ecef987a35 Merge "Fix a typo in linker configuration comments." 2019-03-08 11:48:43 +00:00
Roland Levillain
e51c87634a Fix a typo in linker configuration comments.
Test: n/a
Change-Id: I3fa36094cf3eb45b0e1400712f22b8477a096b59
2019-03-07 19:06:57 +00:00
Dongwon Kang
787e09a1de allow_all_shared_libs for media namespace in ld.config.legacy.txt
This is a temporal fix. With this change, the extractor plug-ins uses
unstable libs under /system/lib[64]. The right resolution is being
discussed.

Test: applied the same change to ld.config.txt and checked
      the memory map of media.extractor on cuttlefish.
Bug: 127791685

Change-Id: Ifd5b79831f27ef4017bb8aa774671aa9b2c5264e
2019-03-07 10:14:02 -08:00
Felix
9e40e12cea ld.config: Permit legacy /system/vendor paths
Because /vendor is a symlink to /system/vendor on devices without a
dedicated /vendor partition, /system/vendor/lib/* needs to be added to
the permitted paths whereever /vendor/lib/* is permitted.

Reasoning:
Legacy devices are forced to use ld.config.legacy.txt, which is very
permissive. We can prolong support for them and enable them to use the
VNDK if we extend the search paths to include the resolved symlink dirs.

Change-Id: I6b3bb7b86ed82395345a16bdc857353b1b15c704
2019-03-03 14:31:37 +01:00
Dongwon Kang
3408eaa914 Add permitted path in media namesapce for extractor process.
Test: build, boot, dumpsys media.extractor
Bug: 125134086
Change-Id: I5ed67d7d8d3ad7abf2cff7da8f33fdaab842acff
2019-02-22 01:16:54 -08:00
Tom Cherry
4e47753338 Merge "liblog: add stubs variant" 2019-02-20 20:33:36 +00:00
Tom Cherry
fe1f701761 liblog: add stubs variant
Ensure that only the symbols in liblog.map.txt can be used by the
platform.

Bug: 123349183
Test: build
Change-Id: I99ae5d0e8ba8f5061ec20701c941d861c9eb615d
2019-02-20 12:32:12 -08:00
Treehugger Robot
14efb903bb Merge "Add the 'unrestricted' config section for vndk_lite devices" 2019-02-20 18:12:27 +00:00
Jiyong Park
137e0308b7 Add the 'unrestricted' config section for vndk_lite devices
This is essentially the same change as
bcb5ba75a5
for ld.config.vndk_lite.txt.

Bug: 124789446
Test: atest CtsBionicTestCases on marlin
Change-Id: I6b65ec4df1626d625975c9834bf96ac9ff6cc3f3
2019-02-20 16:43:22 +09:00
Victor Chang
ff67ef3c7d Expose libandroidicu to llndk namespace
Bug: 124772622
Test: Treehugger
Change-Id: If936eb377c7f0994a9225b8099a672addb2f9ed6
2019-02-20 01:10:06 +00:00
vichang
ce912aadda Merge changes from topic "dup_icu4c"
* changes:
  Linker namespace changes for moving ICU4C to APEX
  Remove the public libs in runtime namespace
2019-02-19 10:14:31 +00:00
Jiyong Park
d8b07f8c05 Replace bionic-unit-tests with CtsBionicTestCases
Bug: 124437796
Test: monitor treehugger
Change-Id: I8bf8d1bb1af3f4ccfca434846adcc1f4eda3fb69
2019-02-15 15:20:59 +09:00
Victor Chang
785ba2e68e Linker namespace changes for moving ICU4C to APEX
libandroidicu is used by various libraries, e.g. libxml2, minikin.
Thus, expose libandroidicu to default namespace.

libpac is only used by libjni_pacprocessor (part of framework).

libicuuc, libicui18n are not exposed to default namespace,
because everyone else, except app, should use libandroidicu.
They are exposed to classloader namespace from runtime namespace
via the work done in libnativeloader in http://r.android.com/887453
b/120786417 has more details about these 2 libraries.

Bug: 120659668
Test: m droid
Change-Id: I2cd3378f1eb94b7bb1c942738b59d7e577a5f8f0
2019-02-14 10:42:27 +00:00
Treehugger Robot
ebadad5c56 Merge "Add TEST_MAPPING for system/core/rootdir/etc" 2019-02-14 00:11:36 +00:00
Martin Stjernholm
18de135031 Merge "Introduce a separate linker config section for native tests." 2019-02-13 10:32:29 +00:00
Jiyong Park
8011f03eb2 Add TEST_MAPPING for system/core/rootdir/etc
bionic-unit-tests runs when one of the linker config files is changed.

Test: N/A
Change-Id: I8af1a9728dab4492fe34a3b4daab9c5f9973d84f
2019-02-13 16:40:47 +09:00
Logan Chien
8540f50887 Merge "Fix APEX run-time ld.config.txt for ASAN targets" 2019-02-13 02:24:08 +00:00
Justin Yun
023ff46e18 Change search order for vendor processes in vndk_lite.
Originally, vndk_lite does not include system/lib/vndk-* directory but
searching the required files in system/lib instead. However, in GSI,
they are using the vndk libs which has symbols than core variants.
To avoid this problem, allow the vendor processes in vndk_lite devices
to search system/lib prior to vndk libs.

Bug: 124063441
Test: Check boot for vndk_lite devices.
Change-Id: I89a72e9d43d6fb05f4b6d87bbd4500f8febfe970
2019-02-13 01:56:28 +00:00
Martin Stjernholm
bcb5ba75a5 Introduce a separate linker config section for native tests.
There are tests that require access to both system and vendor libraries,
like what the linker sets up when there is no matching config section.

Test: atest cameraservice_test libsurfaceflinger_unittest perfprofd_test \
  inputflinger_tests (no new failures, but 3 old ones)
Test: Internal test can load libandroid.so
Bug: 124127405
Bug: 123700170

Change-Id: I4f5cb2e09bdf1ae510259198c08c252b41249d94
2019-02-12 18:45:37 +00:00
Logan Chien
f7b46a2eb1 Fix APEX run-time ld.config.txt for ASAN targets
This commit fixes the search paths for vendor binaries in ASAN targets.

Test: Boot aosp_walleye-userdebug to home screen
Change-Id: Id87ceee3c43098bd453f6fae4f32ea62355f922b
2019-02-12 20:02:05 +08:00
Dongwon Kang
9dff515bdb Exclude libvndksupport from APEXes.
Test: build, boot, and checked mount paths.
Bug: 123948402
Change-Id: I687dde4f3d1a7971f68c7c536de5002dcdaecfa4
2019-02-11 11:14:11 -08:00
Anton Hansson
a13b119c3d Merge "Fix asan paths in ld.config" 2019-02-05 16:28:05 +00:00
Anton Hansson
2dae6f035e Fix asan paths in ld.config
As of Id663c5f284e3b4fc65ed8cb8c2da6bcf6542e034, the asan libs
are in the TARGET_COPY_OUT_X subpath of the /data/asan/ dir, rather
than just 'x' unconditionally.

Test: presubmit
Change-Id: I3a515791e237ad10703415ea532c7a089660d8e9
2019-02-05 12:36:58 +00:00
Martin Stjernholm
4a7138fe37 Some tests are run from /data/local/tmp, and they need proper namespaces.
Bug: 123700170
Test: atest cameraservice_test libcompositionengine_test librenderengine_test libsurfaceflinger_arc_test libsurfaceflinger_unittest perfprofd_test inputflinger_tests
Change-Id: Id3c628175c0037944ccc0d53a2d5327e688ef99e
2019-02-04 14:10:31 +00:00
Jesse Hall
bdebda2bba Search/permit /vendor/${LIB}/hw in sphal namespace
The vulkan runtime loads drivers into the sphal namespace and relies
on them being in the sphal search path so that it doesn't have to
hardcode /vendor/${LIB}/hw.

These paths used to be allowed, but were removed by commit 2498e1b
because they were believed not to be required. Things didn't break
immediately because the vulkan runtime has a (supposed to be
temporary) fallback to hw_get_module, which loads from
/vendor/${LIB}/hw using absolute paths.

Bug: 123600276
Test: Launch Vulkan app on device with hw_get_module disabled
Change-Id: I07ac43bc9d2d877d8f427058b2d62c62d065c558
2019-01-31 18:13:03 -08:00
Treehugger Robot
d664c9d952 Merge "Make libnative*.so from the Runtime APEX libs accessible to vendor binaries." 2019-01-31 21:15:28 +00:00
Martin Stjernholm
60b259b93a Make libnative*.so from the Runtime APEX libs accessible to vendor binaries.
Test: Flash and boot
Test: Boot test on internal tree
Bug: 119840313
Change-Id: I7c87519f94af2eeef9ebfd0d1e46e7bfca8df5c5
2019-01-31 17:03:16 +00:00
Pete Bentley
7b967bf6cf Export libjavacore into the conscrypt linker namespace.
Needed to allow access to AsynchronousCloseMonitor.

Bug: 123121395
Bug: 122881655
Test: atest CtsLibcoreOkHttpTestCases:com.squareup.okhttp.CallTest
Change-Id: I1c73a9beb7a083a61ed52e437d7377b2486a34f7
2019-01-31 11:06:41 +00:00
Treehugger Robot
a15f385821 Merge changes from topic "move_bionic_to_apex3"
* changes:
  Handle adb sync with Bionic under /bionic
  Proper mount namespace configuration for bionic
2019-01-31 04:46:49 +00:00
Treehugger Robot
dd70df2e69 Merge "Add more comments for resolv apex." 2019-01-30 13:56:30 +00:00
Jiyong Park
6866041ff0 Proper mount namespace configuration for bionic
This CL fixes the design problem of the previous mechanism for providing
the bootstrap bionic and the runtime bionic to the same path.

Previously, bootstrap bionic was self-bind-mounted; i.e.
/system/bin/libc.so is bind-mounted to itself. And the runtime bionic
was bind-mounted on top of the bootstrap bionic. This has not only caused
problems like `adb sync` not working(b/122737045), but also is quite
difficult to understand due to the double-and-self mounting.

This is the new design:

Most importantly, these four are all distinct:
1) bootstrap bionic (/system/lib/bootstrap/libc.so)
2) runtime bionic (/apex/com.android.runtime/lib/bionic/libc.so)
3) mount point for 1) and 2) (/bionic/lib/libc.so)
4) symlink for 3) (/system/lib/libc.so -> /bionic/lib/libc.so)

Inside the mount namespace of the pre-apexd processes, 1) is
bind-mounted to 3). Likewise, inside the mount namespace of the
post-apexd processes, 2) is bind-mounted to 3). In other words, there is
no self-mount, and no double-mount.

Another change is that mount points are under /bionic and the legacy
paths become symlinks to the mount points. This is to make sure that
there is no bind mounts under /system, which is breaking some apps.

Finally, code for creating mount namespaces, mounting bionic, etc are
refactored to mount_namespace.cpp

Bug: 120266448
Bug: 123275379
Test: m, device boots, adb sync/push/pull works,
especially with following paths:
/bionic/lib64/libc.so
/bionic/bin/linker64
/system/lib64/bootstrap/libc.so
/system/bin/bootstrap/linker64
Change-Id: Icdfbdcc1efca540ac854d4df79e07ee61fca559f
2019-01-30 19:18:22 +09:00
chenbruce
d771740030 Add more comments for resolv apex.
Describe the link of resolv apex detailedly.

Bug: 119527674
Test: make; flash; lsof -p $(pidof netd)
Change-Id: I0f6038eb9950c6b862a257d0a6f35f19cb83a328
2019-01-30 17:03:09 +08:00
Martin Stjernholm
626c7ca588 Add libnativebridge.so link to vndk_lite linker config.
Getting it back in line with the normal ld.config.txt. This was missed in
http://r.android.com/854740.

Test: Flash and boot on marlin
Bug: 119867084
Bug: 113373927
Change-Id: Ic7e482133250eda20ff2c94c27bdee30e015ab5c
2019-01-28 19:11:29 +00:00
Treehugger Robot
2d3ef2a22f Merge "Linker namespace configuration for the Resolv APEX." 2019-01-28 15:21:52 +00:00
Nicolas Geoffray
3ea7785ee9 Merge "Make runtime namespace visible." 2019-01-28 09:16:21 +00:00
chenbruce
aa87fd5f7d Linker namespace configuration for the Resolv APEX.
Support netd to load resolv Apex.
Switch namespaces when switching library paths between
/system and the APEX, so that internal library dependencies in both
locations are loaded from their own directory.

Bug: 119527674
Test: make; flash; lsof -p $(pidof netd)
Test: 1. manual test datacall/wifi work
      2. manual test tethering work
      3. system/netd/tests/runtests.sh
Change-Id: I3f69e85f2f529636f0ef29a2d9d71ad582c46dfb
2019-01-28 16:42:58 +08:00
Jiyong Park
c84bbb0079 Remove permitted path for non-isolated namespace
No reason to have permitted path for non-isolated namespace.

Bug: 123303398
Test: N/A
Change-Id: Iaddb358efab7a2017c17f74ee53a9d711646b57c
2019-01-26 11:34:40 +09:00
Nicolas Geoffray
a9b4f2b66b Make runtime namespace visible.
So that ART can look it up by name.

Test: m && boots
Change-Id: Ib747a92e7decad2f9effe976a771a4eb0becc440
2019-01-26 01:06:43 +00:00
Dongwon Kang
0095e35fdd Add mediametrics to ld.config.legacy.txt
Test: TH
Bug: 119675363
Change-Id: Ic2fa2cf1931b40f0f476e8be797aa0db9a2582b7
2019-01-25 09:26:17 -08:00
Justin Yun
5579bf14f6 vndk: workaround for building ld.config.<ver>.txt
ld.config.27.txt requires additional search paths for vendor
processes. Substitute '#VNDK27#' when building ld.config.<ver>.txt.
If <ver> equals 27, remove '#VNDK27#'. Otherwise, remove whole line
that starts with '#VNDK27#'.

Bug: 123209911
Bug: 123390078
Test: build ld.config.27.txt
Change-Id: Ie3a284ab39f17fa2f9a3285e080b2ba0da3663dc
2019-01-25 19:49:19 +09:00