From 79620c97d1e93c960e7a3dfc212349acadf54112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=8B=E9=A1=B5?= <31466456+canyie@users.noreply.github.com> Date: Thu, 3 Feb 2022 16:46:52 +0800 Subject: [PATCH] Invalidate Samsung's persist.sys.zygote.early Samsung FDE devices with the "persist.sys.zygote.early=true" property will cause Zygote to start before post-fs-data. According to Magisk's document, the post-fs-data phase should always happen before Zygote is started. Features assuming this behavior (like Zygisk and modules that need to control zygote) will not work. To avoid breaking existing modules, we simply invalidate this property to prevent this non-standard behavior from happening Fix #5299, fix #5328, fix #5308 Co-authored-by: LoveSy --- native/jni/init/rootdir.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/native/jni/init/rootdir.cpp b/native/jni/init/rootdir.cpp index f1f5abc4d..e434ad4fd 100644 --- a/native/jni/init/rootdir.cpp +++ b/native/jni/init/rootdir.cpp @@ -31,6 +31,12 @@ static void patch_init_rc(const char *src, const char *dest, const char *tmp_dir fprintf(rc, "service flash_recovery /system/bin/xxxxx\n"); return true; } + // Samsung's persist.sys.zygote.early will start zygotes before actual post-fs-data phase + if (str_starts(line, "on property:persist.sys.zygote.early=")) { + LOGD("Invalidate persist.sys.zygote.early\n"); + fprintf(rc, "on property:persist.sys.zygote.early.xxxxx=true\n"); + return true; + } // Else just write the line fprintf(rc, "%s", line.data()); return true;