mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-17 15:48:30 +00:00
SAR can also have monolithic sepolicy
This commit is contained in:
parent
f008420891
commit
32cd694ad5
@ -61,9 +61,6 @@ protected:
|
|||||||
// When this boolean is set, this means we are currently
|
// When this boolean is set, this means we are currently
|
||||||
// running magiskinit on legacy SAR AVD emulator
|
// running magiskinit on legacy SAR AVD emulator
|
||||||
bool avd_hack = false;
|
bool avd_hack = false;
|
||||||
#else
|
|
||||||
// Make it constexpr so compiler can optimize hacks out of the code
|
|
||||||
static constexpr bool avd_hack = false;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void patch_sepolicy(const char *file);
|
void patch_sepolicy(const char *file);
|
||||||
|
@ -181,6 +181,7 @@ void SARBase::patch_ro_root() {
|
|||||||
|
|
||||||
xmkdir(ROOTOVL, 0);
|
xmkdir(ROOTOVL, 0);
|
||||||
|
|
||||||
|
#if ENABLE_AVD_HACK
|
||||||
// Handle avd hack
|
// Handle avd hack
|
||||||
if (avd_hack) {
|
if (avd_hack) {
|
||||||
int src = xopen("/init", O_RDONLY | O_CLOEXEC);
|
int src = xopen("/init", O_RDONLY | O_CLOEXEC);
|
||||||
@ -193,6 +194,7 @@ void SARBase::patch_ro_root() {
|
|||||||
close(src);
|
close(src);
|
||||||
close(dest);
|
close(dest);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Handle overlay.d
|
// Handle overlay.d
|
||||||
restore_folder(ROOTOVL, overlays);
|
restore_folder(ROOTOVL, overlays);
|
||||||
@ -233,14 +235,18 @@ void SARBase::patch_ro_root() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (access("/sepolicy", F_OK) == 0) {
|
||||||
|
patch_sepolicy(ROOTOVL "/sepolicy");
|
||||||
|
} else {
|
||||||
|
hijack_sepolicy();
|
||||||
|
}
|
||||||
|
|
||||||
// Mount rootdir
|
// Mount rootdir
|
||||||
magic_mount(ROOTOVL);
|
magic_mount(ROOTOVL);
|
||||||
int dest = xopen(ROOTMNT, O_WRONLY | O_CREAT, 0);
|
int dest = xopen(ROOTMNT, O_WRONLY | O_CREAT, 0);
|
||||||
write(dest, magic_mount_list.data(), magic_mount_list.length());
|
write(dest, magic_mount_list.data(), magic_mount_list.length());
|
||||||
close(dest);
|
close(dest);
|
||||||
|
|
||||||
hijack_sepolicy();
|
|
||||||
|
|
||||||
chdir("/");
|
chdir("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user