mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-16 09:52:31 +00:00
Implement Magic Mount
This commit is contained in:
@@ -60,8 +60,10 @@ void launch_magiskhide(int client) {
|
||||
if (init_resetprop())
|
||||
goto error;
|
||||
|
||||
if (setprop2("persist.magisk.hide", "1", 0))
|
||||
goto error;
|
||||
if (client != -1) {
|
||||
if (setprop("persist.magisk.hide", "1"))
|
||||
goto error;
|
||||
}
|
||||
|
||||
hide_sensitive_props();
|
||||
|
||||
|
@@ -5,8 +5,6 @@
|
||||
|
||||
#define HIDELIST "/magisk/.core/magiskhide/hidelist"
|
||||
#define DUMMYPATH "/dev/magisk/dummy"
|
||||
#define ENFORCE_FILE "/sys/fs/selinux/enforce"
|
||||
#define POLICY_FILE "/sys/fs/selinux/policy"
|
||||
|
||||
typedef enum {
|
||||
HIDE_ERROR = -1,
|
||||
|
@@ -29,15 +29,15 @@ static int isMocked = 0;
|
||||
void manage_selinux() {
|
||||
if (isMocked) return;
|
||||
char val[1];
|
||||
int fd = xopen(ENFORCE_FILE, O_RDONLY);
|
||||
int fd = xopen(SELINUX_ENFORCE, O_RDONLY);
|
||||
xxread(fd, val, 1);
|
||||
close(fd);
|
||||
// Permissive
|
||||
if (val[0] == '0') {
|
||||
LOGI("hide_daemon: Permissive detected, hide the state\n");
|
||||
|
||||
chmod(ENFORCE_FILE, 0640);
|
||||
chmod(POLICY_FILE, 0440);
|
||||
chmod(SELINUX_ENFORCE, 0640);
|
||||
chmod(SELINUX_POLICY, 0440);
|
||||
isMocked = 1;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user