Restore context before copy

fix magiskpolicy context
This commit is contained in:
vvb2060 2022-07-22 03:08:37 +08:00 committed by John Wu
parent 8b095de04d
commit c7c9fb9576
3 changed files with 6 additions and 0 deletions

View File

@ -40,3 +40,4 @@ bool selinux_enabled();
void enable_selinux();
void restorecon();
void restore_tmpcon();
void restore_databincon();

View File

@ -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;

View File

@ -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));
}