Files
ReZygisk/loader/src/include/daemon.h
ThePedroo 8949561ac8 fix: logging tag for ptracer, out-of-bounds access in allowed_fds
This commit fixes the logging tag for ptracer command-line tool, which would show as "zygisk-core64", the one from libzygisk, and an out-of-bounds access in "allowed_fds" array, which then the readdir returned the "." and "..", the "parse_int" would return -1, and would try to access it in "allowed_fds" without checking if it is negative, or bigger, first.
2025-04-21 15:46:28 -03:00

91 lines
1.6 KiB
C

#ifndef DAEMON_H
#define DAEMON_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <stdbool.h>
#include <unistd.h>
#ifdef __LP64__
#define LP_SELECT(lp32, lp64) lp64
#else
#define LP_SELECT(lp32, lp64) lp32
#endif
#define SOCKET_FILE_NAME LP_SELECT("cp32", "cp64") ".sock"
enum rezygiskd_actions {
PingHeartbeat,
GetProcessFlags,
GetInfo,
ReadModules,
RequestCompanionSocket,
GetModuleDir,
ZygoteRestart,
SystemServerStarted,
UpdateMountNamespace
};
struct zygisk_modules {
char **modules;
size_t modules_count;
};
enum root_impl {
ROOT_IMPL_NONE,
ROOT_IMPL_APATCH,
ROOT_IMPL_KERNELSU,
ROOT_IMPL_MAGISK
};
struct rezygisk_info {
struct zygisk_modules *modules;
enum root_impl root_impl;
pid_t pid;
bool running;
};
enum mount_namespace_state {
Clean,
Rooted,
Module
};
#define TMP_PATH "/data/adb/rezygisk"
static inline const char *rezygiskd_get_path() {
return TMP_PATH;
}
int rezygiskd_connect(uint8_t retry);
bool rezygiskd_ping();
uint32_t rezygiskd_get_process_flags(uid_t uid);
void rezygiskd_get_info(struct rezygisk_info *info);
void free_rezygisk_info(struct rezygisk_info *info);
bool rezygiskd_read_modules(struct zygisk_modules *modules);
void free_modules(struct zygisk_modules *modules);
int rezygiskd_connect_companion(size_t index);
int rezygiskd_get_module_dir(size_t index);
void rezygiskd_zygote_restart();
void rezygiskd_system_server_started();
bool rezygiskd_update_mns(enum mount_namespace_state nms_state, char *buf, size_t buf_size);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* DAEMON_H */