Remove property ro.build.selinux
This commit is contained in:
parent
97db49a57b
commit
bc6a14d30f
@ -12,13 +12,13 @@ using namespace std;
|
|||||||
static const char *prop_key[] =
|
static const char *prop_key[] =
|
||||||
{ "ro.boot.vbmeta.device_state", "ro.boot.verifiedbootstate", "ro.boot.flash.locked",
|
{ "ro.boot.vbmeta.device_state", "ro.boot.verifiedbootstate", "ro.boot.flash.locked",
|
||||||
"ro.boot.veritymode", "ro.boot.warranty_bit", "ro.warranty_bit", "ro.debuggable",
|
"ro.boot.veritymode", "ro.boot.warranty_bit", "ro.warranty_bit", "ro.debuggable",
|
||||||
"ro.secure", "ro.build.type", "ro.build.tags", "ro.build.selinux",
|
"ro.secure", "ro.build.type", "ro.build.tags",
|
||||||
"ro.vendor.boot.warranty_bit", "ro.vendor.warranty_bit", nullptr };
|
"ro.vendor.boot.warranty_bit", "ro.vendor.warranty_bit", nullptr };
|
||||||
|
|
||||||
static const char *prop_val[] =
|
static const char *prop_val[] =
|
||||||
{ "locked", "green", "1",
|
{ "locked", "green", "1",
|
||||||
"enforcing", "0", "0", "0",
|
"enforcing", "0", "0", "0",
|
||||||
"1", "user", "release-keys", "0",
|
"1", "user", "release-keys",
|
||||||
"0", "0", nullptr };
|
"0", "0", nullptr };
|
||||||
|
|
||||||
static const char *late_prop_key[] =
|
static const char *late_prop_key[] =
|
||||||
@ -38,22 +38,23 @@ void hide_sensitive_props() {
|
|||||||
|
|
||||||
// Hide that we booted from recovery when magisk is in recovery mode
|
// Hide that we booted from recovery when magisk is in recovery mode
|
||||||
auto bootmode = getprop("ro.bootmode");
|
auto bootmode = getprop("ro.bootmode");
|
||||||
if (!bootmode.empty() && str_contains(bootmode, "recovery")) {
|
if (!bootmode.empty() && str_contains(bootmode, "recovery"))
|
||||||
setprop("ro.bootmode", "unknown", false);
|
setprop("ro.bootmode", "unknown", false);
|
||||||
}
|
|
||||||
bootmode = getprop("ro.boot.mode");
|
bootmode = getprop("ro.boot.mode");
|
||||||
if (!bootmode.empty() && str_contains(bootmode, "recovery")) {
|
if (!bootmode.empty() && str_contains(bootmode, "recovery"))
|
||||||
setprop("ro.boot.mode", "unknown", false);
|
setprop("ro.boot.mode", "unknown", false);
|
||||||
}
|
|
||||||
// Xiaomi cross region flash
|
// Xiaomi cross region flash
|
||||||
auto hwc = getprop("ro.boot.hwc");
|
auto hwc = getprop("ro.boot.hwc");
|
||||||
if (!hwc.empty() && str_contains(hwc, "CN")) {
|
if (!hwc.empty() && str_contains(hwc, "CN"))
|
||||||
setprop("ro.boot.hwc", "GLOBAL", false);
|
setprop("ro.boot.hwc", "GLOBAL", false);
|
||||||
}
|
|
||||||
auto hwcountry = getprop("ro.boot.hwcountry");
|
auto hwcountry = getprop("ro.boot.hwcountry");
|
||||||
if (!hwcountry.empty() && str_contains(hwcountry, "China")) {
|
if (!hwcountry.empty() && str_contains(hwcountry, "China"))
|
||||||
setprop("ro.boot.hwcountry", "GLOBAL", false);
|
setprop("ro.boot.hwcountry", "GLOBAL", false);
|
||||||
}
|
|
||||||
|
auto selinux = getprop("ro.build.selinux");
|
||||||
|
if (!selinux.empty)
|
||||||
|
delprop("ro.build.selinux");
|
||||||
}
|
}
|
||||||
|
|
||||||
void hide_late_sensitive_props() {
|
void hide_late_sensitive_props() {
|
||||||
@ -64,24 +65,24 @@ void hide_late_sensitive_props() {
|
|||||||
if (!value.empty() && value != late_prop_val[i])
|
if (!value.empty() && value != late_prop_val[i])
|
||||||
setprop(prop_key[i], late_prop_val[i], false);
|
setprop(prop_key[i], late_prop_val[i], false);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bootmode = getprop("vendor.boot.mode");
|
auto bootmode = getprop("vendor.boot.mode");
|
||||||
if (!bootmode.empty() && str_contains(bootmode, "recovery")) {
|
if (!bootmode.empty() && str_contains(bootmode, "recovery"))
|
||||||
setprop("vendor.boot.mode", "unknown", false);
|
setprop("vendor.boot.mode", "unknown", false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void lazy_unmount(const char* mountpoint) {
|
static void lazy_unmount(const char* mountpoint) {
|
||||||
if (umount2(mountpoint, MNT_DETACH) != -1)
|
if (umount2(mountpoint, MNT_DETACH) != -1)
|
||||||
LOGD("hide_policy: Unmounted (%s)\n", mountpoint);
|
LOGD("hide_policy: Unmounted (%s)\n", mountpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hide_daemon(int pid) {
|
void hide_daemon(int pid) {
|
||||||
run_finally fin([=]() -> void {
|
if (fork_dont_care() == 0) {
|
||||||
|
hide_unmount(pid);
|
||||||
// Send resume signal
|
// Send resume signal
|
||||||
kill(pid, SIGCONT);
|
kill(pid, SIGCONT);
|
||||||
_exit(0);
|
_exit(0);
|
||||||
});
|
}
|
||||||
hide_unmount(pid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TMPFS_MNT(dir) (mentry->mnt_type == "tmpfs"sv && \
|
#define TMPFS_MNT(dir) (mentry->mnt_type == "tmpfs"sv && \
|
||||||
|
@ -247,7 +247,6 @@ static bool check_pid(int pid) {
|
|||||||
PTRACE_LOG("target found\n");
|
PTRACE_LOG("target found\n");
|
||||||
LOGI("proc_monitor: [%s] PID=[%d] UID=[%d]\n", cmdline, pid, uid);
|
LOGI("proc_monitor: [%s] PID=[%d] UID=[%d]\n", cmdline, pid, uid);
|
||||||
detach_pid(pid, SIGSTOP);
|
detach_pid(pid, SIGSTOP);
|
||||||
if (fork_dont_care() == 0)
|
|
||||||
hide_daemon(pid);
|
hide_daemon(pid);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user