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

Commit 143a9711 authored by Mark White's avatar Mark White Committed by Android (Google) Code Review
Browse files

Merge "Legacy app compatibility workaround" into main

parents 9b3f4dd4 59f72520
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1833,6 +1833,15 @@ static void BindMountSyspropOverride(fail_fn_t fail_fn, JNIEnv* env) {
  ReloadBuildJavaConstants(env);
}

static void MountInitOverride(fail_fn_t fail_fn, JNIEnv* env) {
    const char* init_etc_dir = "/system/etc/init";

    if (TEMP_FAILURE_RETRY(mount("tmpfs", init_etc_dir, "tmpfs", MS_NOSUID | MS_NODEV | MS_NOEXEC,
                                 "uid=0,gid=0,mode=0751")) == -1) {
        fail_fn(CREATE_ERROR("Failed to mount tmpfs %s: %s", init_etc_dir, strerror(errno)));
    }
}

static void BindMountStorageToLowerFs(const userid_t user_id, const uid_t uid,
    const char* dir_name, const char* package, fail_fn_t fail_fn) {
    bool hasSdcardFs = IsSdcardfsUsed();
@@ -1954,6 +1963,7 @@ static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray gids,

    if (mount_sysprop_overrides) {
        BindMountSyspropOverride(fail_fn, env);
        MountInitOverride(fail_fn, env);
    }

    // If this zygote isn't root, it won't be able to create a process group,