You've already forked ReZygisk
mirror of
https://github.com/PerformanC/ReZygisk.git
synced 2025-09-06 06:37:01 +00:00
fix: ReZygiskd Magisk DenyList not checking against process
This commit improves the precision of ReZygiskd check for Magisk if a process is in DenyList/SuList, as previously it used "package_name" instead of the correct "process" field.
This commit is contained in:
@@ -64,7 +64,7 @@ bool rezygiskd_ping() {
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t rezygiskd_get_process_flags(uid_t uid) {
|
||||
uint32_t rezygiskd_get_process_flags(uid_t uid, const char *const process) {
|
||||
int fd = rezygiskd_connect(1);
|
||||
if (fd == -1) {
|
||||
PLOGE("connection to ReZygiskd");
|
||||
@@ -74,6 +74,7 @@ uint32_t rezygiskd_get_process_flags(uid_t uid) {
|
||||
|
||||
write_uint8_t(fd, (uint8_t)GetProcessFlags);
|
||||
write_uint32_t(fd, (uint32_t)uid);
|
||||
write_string(fd, process);
|
||||
|
||||
uint32_t res = 0;
|
||||
read_uint32_t(fd, &res);
|
||||
|
||||
@@ -45,6 +45,25 @@ int read_fd(int fd) {
|
||||
return sendfd;
|
||||
}
|
||||
|
||||
ssize_t write_string(int fd, const char *str) {
|
||||
size_t str_len = strlen(str);
|
||||
ssize_t write_bytes = write(fd, &str_len, sizeof(size_t));
|
||||
if (write_bytes != (ssize_t)sizeof(size_t)) {
|
||||
LOGE("Failed to write string length: Not all bytes were written (%zd != %zu).\n", write_bytes, sizeof(size_t));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
write_bytes = write(fd, str, str_len);
|
||||
if (write_bytes != (ssize_t)str_len) {
|
||||
LOGE("Failed to write string: Promised bytes doesn't exist (%zd != %zu).\n", write_bytes, str_len);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return write_bytes;
|
||||
}
|
||||
|
||||
char *read_string(int fd) {
|
||||
size_t str_len = 0;
|
||||
ssize_t read_bytes = read(fd, &str_len, sizeof(size_t));
|
||||
|
||||
@@ -63,7 +63,7 @@ int rezygiskd_connect(uint8_t retry);
|
||||
|
||||
bool rezygiskd_ping();
|
||||
|
||||
uint32_t rezygiskd_get_process_flags(uid_t uid);
|
||||
uint32_t rezygiskd_get_process_flags(uid_t uid, const char *const process);
|
||||
|
||||
void rezygiskd_get_info(struct rezygisk_info *info);
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <stdint.h>
|
||||
|
||||
int read_fd(int fd);
|
||||
|
||||
ssize_t write_string(int fd, const char *str);
|
||||
|
||||
char *read_string(int fd);
|
||||
|
||||
|
||||
@@ -677,7 +677,7 @@ void ZygiskContext::run_modules_post() {
|
||||
void ZygiskContext::app_specialize_pre() {
|
||||
flags[APP_SPECIALIZE] = true;
|
||||
|
||||
info_flags = rezygiskd_get_process_flags(g_ctx->args.app->uid);
|
||||
info_flags = rezygiskd_get_process_flags(g_ctx->args.app->uid, (const char *const)process);
|
||||
if (info_flags & PROCESS_IS_FIRST_STARTED) {
|
||||
/* INFO: To ensure we are really using a clean mount namespace, we use
|
||||
the first process it as reference for clean mount namespace,
|
||||
|
||||
Reference in New Issue
Block a user