Commit 69c2f407 authored by LoveSy's avatar LoveSy Committed by topjohnwu

Log if failed to dlopen a zygisk module

parent ffcd093d
...@@ -367,6 +367,8 @@ void HookContext::run_modules_pre(const vector<int> &fds) { ...@@ -367,6 +367,8 @@ void HookContext::run_modules_pre(const vector<int> &fds) {
if (void *e = dlsym(h, "zygisk_module_entry")) { if (void *e = dlsym(h, "zygisk_module_entry")) {
modules.emplace_back(i, h, e); modules.emplace_back(i, h, e);
} }
} else if (g_ctx->state[SERVER_SPECIALIZE]) {
LOGW("Failed to dlopen zygisk module: %s\n", dlerror());
} }
close(fds[i]); close(fds[i]);
} }
......
...@@ -112,14 +112,19 @@ static void zygiskd(int socket) { ...@@ -112,14 +112,19 @@ static void zygiskd(int socket) {
vector<comp_entry> modules; vector<comp_entry> modules;
{ {
vector<int> module_fds = recv_fds(socket); vector<int> module_fds = recv_fds(socket);
char buf[256];
for (int fd : module_fds) { for (int fd : module_fds) {
snprintf(buf, sizeof(buf), "/proc/self/fd/%d", fd);
comp_entry entry = nullptr; comp_entry entry = nullptr;
if (void *h = dlopen(buf, RTLD_LAZY)) { android_dlextinfo info {
.flags = ANDROID_DLEXT_USE_LIBRARY_FD,
.library_fd = fd,
};
if (void *h = android_dlopen_ext("/jit-cache", RTLD_LAZY, &info)) {
*(void **) &entry = dlsym(h, "zygisk_companion_entry"); *(void **) &entry = dlsym(h, "zygisk_companion_entry");
} else {
LOGW("Failed to dlopen zygisk module: %s\n", dlerror());
} }
modules.push_back(entry); modules.push_back(entry);
close(fd);
} }
} }
......
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