You've already forked ReZygisk
mirror of
https://github.com/PerformanC/ReZygisk.git
synced 2025-09-06 06:37:01 +00:00
add: error handling for UpdateMountNamespace
This commit adds the missing error handling for "UpdateMountNamespace" in both libzygisk.so and ReZygiskd, as before it would send a -1 as unsigned, leading to issues.
This commit is contained in:
@@ -342,6 +342,14 @@ bool rezygiskd_update_mns(enum mount_namespace_state nms_state, char *buf, size_
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (target_fd == 0) {
|
||||||
|
LOGE("Failed to get target fd");
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(buf, buf_size, "/proc/%u/fd/%u", target_pid, target_fd);
|
snprintf(buf, buf_size, "/proc/%u/fd/%u", target_pid, target_fd);
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|||||||
@@ -647,8 +647,17 @@ void zygiskd_start(char *restrict argv[]) {
|
|||||||
save_mns_fd(pid, Module, impl);
|
save_mns_fd(pid, Module, impl);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t clean_namespace_fd = (uint32_t)save_mns_fd(pid, (enum MountNamespaceState)mns_state, impl);
|
int clean_namespace_fd = save_mns_fd(pid, (enum MountNamespaceState)mns_state, impl);
|
||||||
ret = write_uint32_t(client_fd, clean_namespace_fd);
|
if (clean_namespace_fd == -1) {
|
||||||
|
LOGE("Failed to save mount namespace fd for pid %d: %s\n", pid, strerror(errno));
|
||||||
|
|
||||||
|
ret = write_uint32_t(client_fd, (uint32_t)0);
|
||||||
|
ASSURE_SIZE_WRITE_BREAK("UpdateMountNamespace", "clean_namespace_fd", ret, sizeof(clean_namespace_fd));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = write_uint32_t(client_fd, (uint32_t)clean_namespace_fd);
|
||||||
ASSURE_SIZE_WRITE_BREAK("UpdateMountNamespace", "clean_namespace_fd", ret, sizeof(clean_namespace_fd));
|
ASSURE_SIZE_WRITE_BREAK("UpdateMountNamespace", "clean_namespace_fd", ret, sizeof(clean_namespace_fd));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user