Continue process boot even if 'idmap2 --scan' fails

Relax the requirement on 'idmap2 --scan' to exit normally (as defined by
WIFEXITED) when starting a process. This allows the process to continue
booting, but with the caveat that no static="true" overlays targeting
"android" will be loaded.

The booting process is usually Zygote but can be an app that uses a
wrap.sh script (see https://d.android.com/ndk/guides/wrap-script).
Because SELinux rules prevent most processes from executing
/system/bin/idmap2, 'idmap2 --scan' will fail for "wrapped" apps.

Bug: 120854885
Test: atest CtsWrapWrapDebugTestCases CtsWrapWrapDebugMallocDebugTestCases
Change-Id: I85225cbcdd945f0026879e89f481d733217825d5
This commit is contained in:
Mårten Kongstad
2018-12-12 12:57:50 +01:00
committed by Todd Kennedy
parent 93f07e207a
commit f361123c87

View File

@@ -203,11 +203,13 @@ public final class AssetManager implements AutoCloseable {
if (FEATURE_FLAG_IDMAP2) {
final String[] systemIdmapPaths =
nativeCreateIdmapsForStaticOverlaysTargetingAndroid();
if (systemIdmapPaths == null) {
throw new IOException("idmap2 scan failed");
}
for (String idmapPath : systemIdmapPaths) {
apkAssets.add(ApkAssets.loadOverlayFromPath(idmapPath, true /*system*/));
if (systemIdmapPaths != null) {
for (String idmapPath : systemIdmapPaths) {
apkAssets.add(ApkAssets.loadOverlayFromPath(idmapPath, true /*system*/));
}
} else {
Log.w(TAG, "'idmap2 --scan' failed: no static=\"true\" overlays targeting "
+ "\"android\" will be loaded");
}
} else {
nativeVerifySystemIdmaps();