Commit 02dd9626 authored by LoveSy's avatar LoveSy Committed by John Wu

Don't load zygisk module for magisk app

parent 256d7156
...@@ -167,6 +167,11 @@ static int zygisk_log(int prio, const char *fmt, va_list ap) { ...@@ -167,6 +167,11 @@ static int zygisk_log(int prio, const char *fmt, va_list ap) {
return ret; return ret;
} }
static inline bool should_load_modules(int flags) {
return (flags & UNMOUNT_MASK) != UNMOUNT_MASK &&
(flags & PROCESS_IS_MAGISK_APP) != PROCESS_IS_MAGISK_APP;
}
int remote_get_info(int uid, const char *process, uint32_t *flags, vector<int> &fds) { int remote_get_info(int uid, const char *process, uint32_t *flags, vector<int> &fds) {
if (int fd = connect_daemon(); fd >= 0) { if (int fd = connect_daemon(); fd >= 0) {
write_int(fd, ZYGISK_REQUEST); write_int(fd, ZYGISK_REQUEST);
...@@ -175,7 +180,7 @@ int remote_get_info(int uid, const char *process, uint32_t *flags, vector<int> & ...@@ -175,7 +180,7 @@ int remote_get_info(int uid, const char *process, uint32_t *flags, vector<int> &
write_int(fd, uid); write_int(fd, uid);
write_string(fd, process); write_string(fd, process);
xxread(fd, flags, sizeof(*flags)); xxread(fd, flags, sizeof(*flags));
if ((*flags & UNMOUNT_MASK) != UNMOUNT_MASK) { if (should_load_modules(*flags)) {
fds = recv_fds(fd); fds = recv_fds(fd);
} }
return fd; return fd;
...@@ -351,7 +356,7 @@ static void get_process_info(int client, const sock_cred *cred) { ...@@ -351,7 +356,7 @@ static void get_process_info(int client, const sock_cred *cred) {
xwrite(client, &flags, sizeof(flags)); xwrite(client, &flags, sizeof(flags));
if ((flags & UNMOUNT_MASK) != UNMOUNT_MASK) { if (should_load_modules(flags)) {
char buf[256]; char buf[256];
get_exe(cred->pid, buf, sizeof(buf)); get_exe(cred->pid, buf, sizeof(buf));
vector<int> fds = get_module_fds(str_ends(buf, "64")); vector<int> fds = get_module_fds(str_ends(buf, "64"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment