diff --git a/native/jni/base/include/selinux.hpp b/native/jni/base/include/selinux.hpp index ea4cf0f40..bc31ed213 100644 --- a/native/jni/base/include/selinux.hpp +++ b/native/jni/base/include/selinux.hpp @@ -40,3 +40,4 @@ bool selinux_enabled(); void enable_selinux(); void restorecon(); void restore_tmpcon(); +void restore_databincon(); diff --git a/native/jni/core/bootstages.cpp b/native/jni/core/bootstages.cpp index 20bc43969..bd32ca73a 100644 --- a/native/jni/core/bootstages.cpp +++ b/native/jni/core/bootstages.cpp @@ -152,6 +152,8 @@ static bool magisk_env() { xmkdir(SECURE_DIR "/post-fs-data.d", 0755); xmkdir(SECURE_DIR "/service.d", 0755); + restore_databincon(); + if (access(DATABIN "/busybox", X_OK)) return false; diff --git a/native/jni/core/restorecon.cpp b/native/jni/core/restorecon.cpp index 72dd90c79..bab2df857 100644 --- a/native/jni/core/restorecon.cpp +++ b/native/jni/core/restorecon.cpp @@ -74,6 +74,9 @@ void restorecon() { close(fd); lsetfilecon(MODULEROOT, SYSTEM_CON); restore_syscon(xopen(MODULEROOT, O_RDONLY | O_CLOEXEC)); +} + +void restore_databincon() { restore_magiskcon(xopen(DATABIN, O_RDONLY | O_CLOEXEC)); }