Commit 2fb49ad7 authored by LoveSy's avatar LoveSy Committed by John Wu

Don't always mock selinux enforce as "0"

parent 92f0e53f
......@@ -70,7 +70,6 @@ void MagiskInit::hijack_sepolicy() {
} else {
// We block using the "enforce" node
blocking_target = SELINUX_ENFORCE;
actual_content = "0";
}
// Hijack the "load" and "enforce" node in selinuxfs to manipulate
......@@ -169,6 +168,10 @@ void MagiskInit::hijack_sepolicy() {
xmount("selinuxfs", REAL_SELINUXFS, "selinuxfs", 0, nullptr);
sepol->to_file(REAL_SELINUXFS "/load");
if (strcmp(blocking_target, SELINUX_ENFORCE) == 0) {
actual_content = full_read(SELINUX_ENFORCE);
}
// Write to mock blocking target ONLY after sepolicy is loaded. We need to make sure
// the actual init process is blocked until sepolicy is loaded, or else
// restorecon will fail and re-exec won't change context, causing boot failure.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment