Merge pull request #831 from zhaozihanzzh/dev-ldpreload-fix-close

Close kernel epoll fd in ff_hook_close when using FF_KERNEL_EVENT
This commit is contained in:
johnjiang 2024-08-27 16:16:01 +08:00 committed by GitHub
commit 4cfc2ccf48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 0 deletions

View File

@ -1542,6 +1542,18 @@ ff_hook_close(int fd)
SYSCALL(FF_SO_CLOSE, args); SYSCALL(FF_SO_CLOSE, args);
#ifdef FF_KERNEL_EVENT
if (ret == 0 && fstack_kernel_fd_map[fd]) {
int kernel_fd_ret = ff_linux_close(fstack_kernel_fd_map[fd]);
if (kernel_fd_ret < 0) {
ERR_LOG("fstack_kernel_fd_map[%d]=%d, ff_linux_close returns %d, errno=%d\n",
fd, fstack_kernel_fd_map[fd], kernel_fd_ret, errno);
} else {
fstack_kernel_fd_map[fd] = 0;
}
}
#endif
RETURN_NOFREE(); RETURN_NOFREE();
} }