Skip to content

Commit

Permalink
Don't skip fd sanitization if fds_to_ignore does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
aviraxp authored and topjohnwu committed Sep 25, 2023
1 parent 9b3896f commit ec115cd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions native/src/zygisk/hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ec115cd

Please sign in to comment.