Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syscall_server: fix epoll_wait implementation #101

Merged
merged 4 commits into from
Nov 21, 2023

Conversation

Officeyutong
Copy link
Contributor

This PR fixes the implementation of epoll_wait in syscall server, so make bpftrace exit properly.

In kernel, syscall epoll_wait could be interrupted by signal, when either no requests were received, or the timeout expired.

In the previous epoll_wait of syscall-server, we doesn't implement similar things. So when signals were devilered during the execution of epoll_wait, they were handled normally (e.g directly call the signal handler).

In the current implementation, we block the develivery of SIGINT and SIGTERM (more could be added after suitable tests) during the execution of epoll_wait, but unblock them when epoll_wait is sleeping. epoll_wait will use sigtimedwait to wait for SIGINT and SIGTERM when no requests were received. Once these signal were develivered when sleeping, we just set errno to EINTR, and return -1 from epoll_wait. This will keep the same behavior like the kernel epoll_wait implementation.

Closes #99

@pull-request-size pull-request-size bot added size/L and removed size/M labels Nov 21, 2023
@Officeyutong Officeyutong reopened this Nov 21, 2023
@Officeyutong Officeyutong marked this pull request as ready for review November 21, 2023 12:16
@Officeyutong Officeyutong merged commit f87cec6 into eunomia-bpf:master Nov 21, 2023
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] bpftrace doesn't terminating correctly
2 participants