Commit c7c9fb95 authored by vvb2060's avatar vvb2060 Committed by John Wu

Restore context before copy

fix magiskpolicy context
parent 8b095de0
...@@ -40,3 +40,4 @@ bool selinux_enabled(); ...@@ -40,3 +40,4 @@ bool selinux_enabled();
void enable_selinux(); void enable_selinux();
void restorecon(); void restorecon();
void restore_tmpcon(); void restore_tmpcon();
void restore_databincon();
...@@ -152,6 +152,8 @@ static bool magisk_env() { ...@@ -152,6 +152,8 @@ static bool magisk_env() {
xmkdir(SECURE_DIR "/post-fs-data.d", 0755); xmkdir(SECURE_DIR "/post-fs-data.d", 0755);
xmkdir(SECURE_DIR "/service.d", 0755); xmkdir(SECURE_DIR "/service.d", 0755);
restore_databincon();
if (access(DATABIN "/busybox", X_OK)) if (access(DATABIN "/busybox", X_OK))
return false; return false;
......
...@@ -74,6 +74,9 @@ void restorecon() { ...@@ -74,6 +74,9 @@ void restorecon() {
close(fd); close(fd);
lsetfilecon(MODULEROOT, SYSTEM_CON); lsetfilecon(MODULEROOT, SYSTEM_CON);
restore_syscon(xopen(MODULEROOT, O_RDONLY | O_CLOEXEC)); restore_syscon(xopen(MODULEROOT, O_RDONLY | O_CLOEXEC));
}
void restore_databincon() {
restore_magiskcon(xopen(DATABIN, O_RDONLY | O_CLOEXEC)); restore_magiskcon(xopen(DATABIN, O_RDONLY | O_CLOEXEC));
} }
......
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