run companion in standalone process

This commit is contained in:
5ec1cff
2023-12-08 17:19:26 +08:00
parent 9c34c671fa
commit bcb65c4bd9
8 changed files with 195 additions and 62 deletions
-7
View File
@@ -18,15 +18,8 @@ int main(int argc, char **argv) {
return 0;
} else if (argc >= 3 && argv[1] == "trace"sv) {
if (argc >= 4 && argv[3] == "--restart"sv) {
constexpr auto companion = "./bin/zygisk-cp" LP_SELECT("32", "64");
zygiskd::Init(getenv(MAGIC_PATH_ENV));
zygiskd::ZygoteRestart();
if (fork_dont_care() == 0) {
LOGI("creating new zygisk companion");
execl(companion, basename(companion), nullptr);
PLOGE("failed to exec zygisk companion");
exit(1);
}
}
auto pid = strtol(argv[2], 0, 0);
if (!trace_zygote(pid)) {