Remove Q dirty hacks in SARCompat

This commit is contained in:
topjohnwu
2019-06-24 01:31:42 -07:00
parent a1a1ac0bbb
commit 6cde695194
3 changed files with 1 additions and 21 deletions

View File

@@ -40,8 +40,6 @@ constexpr const char wrapper[] =
;
void RootFSInit::setup_rootfs() {
bool patch_init = patch_sepolicy();
if (cmd->system_as_root) {
// Clone rootfs
LOGD("Clone root dir from system to rootfs\n");
@@ -50,7 +48,7 @@ void RootFSInit::setup_rootfs() {
close(system_root);
}
if (patch_init) {
if (patch_sepolicy()) {
constexpr char SYSTEM_INIT[] = "/system/bin/init";
// If init is symlink, copy it to rootfs so we can patch
if (is_lnk("/init"))
@@ -157,21 +155,12 @@ bool MagiskInit::patch_sepolicy() {
sepol_allow(SEPOL_PROC_DOMAIN, ALL, ALL, ALL);
dump_policydb("/sepolicy");
// Load policy to kernel so we can label rootfs
if (load_sepol) {
LOGD("sepol: preload sepolicy\n");
dump_policydb(SELINUX_LOAD);
}
// Remove OnePlus stupid debug sepolicy and use our own
if (access("/sepolicy_debug", F_OK) == 0) {
unlink("/sepolicy_debug");
link("/sepolicy", "/sepolicy_debug");
}
// Enable selinux functions
selinux_builtin_impl();
return patch_init;
}