From ec115cd7e3c08a96a32c692c2448f834add178cc Mon Sep 17 00:00:00 2001 From: Wang Han Date: Sat, 23 Sep 2023 16:05:14 +0800 Subject: [PATCH] Don't skip fd sanitization if fds_to_ignore does not exist --- native/src/zygisk/hook.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/native/src/zygisk/hook.cpp b/native/src/zygisk/hook.cpp index 7e9c94b1f..0401e6ac6 100644 --- a/native/src/zygisk/hook.cpp +++ b/native/src/zygisk/hook.cpp @@ -691,9 +691,10 @@ void HookContext::nativeForkAndSpecialize_pre() { flags[APP_FORK_AND_SPECIALIZE] = true; if (args.app->fds_to_ignore == nullptr) { - // if fds_to_ignore does not exist and there's no FileDescriptorTable::Create, - // we can skip fd sanitization - flags[SKIP_FD_SANITIZATION] = !dlsym(RTLD_DEFAULT, "_ZN19FileDescriptorTable6CreateEv"); + // if fds_to_ignore does not exist, we do not have a good way to determine + // whether keeping fd open during fork is allowed, as needed symbols may be + // inlined. Better be safe than sorry. + flags[SKIP_FD_SANITIZATION] = false; } else { int logd_fd = magiskd.get_log_pipe(); if (logd_fd >= 0) {