Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f361123c authored by Mårten Kongstad's avatar Mårten Kongstad Committed by Todd Kennedy
Browse files

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
parent 93f07e20
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -203,12 +203,14 @@ public final class AssetManager implements AutoCloseable {
            if (FEATURE_FLAG_IDMAP2) {
                final String[] systemIdmapPaths =
                    nativeCreateIdmapsForStaticOverlaysTargetingAndroid();
                if (systemIdmapPaths == null) {
                    throw new IOException("idmap2 scan failed");
                }
                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();
                loadStaticRuntimeOverlays(apkAssets);