From 7245c166c39290e6d670513e8ccda609224eba5e Mon Sep 17 00:00:00 2001 From: Wang Han <416810799@qq.com> Date: Sun, 24 May 2026 15:57:34 +0800 Subject: [PATCH] Backup original sepolicy db for LD_PRELOAD strategy --- native/src/init/selinux.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/native/src/init/selinux.rs b/native/src/init/selinux.rs index 9e58dcdeef998..4144890fa70c2 100644 --- a/native/src/init/selinux.rs +++ b/native/src/init/selinux.rs @@ -225,6 +225,9 @@ impl MagiskInit { let mut sepol = SePolicy::from_file(preload_policy()); + // Keep a copy of the original policy for future use + preload_policy().copy_to(MOCK_LOAD)?; + // Remove the files before loading the policy preload_policy().remove()?; preload_ack().remove()?;