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

Epoll Correctness #331

Open
rennergade opened this issue Oct 24, 2023 · 0 comments
Open

Epoll Correctness #331

rennergade opened this issue Oct 24, 2023 · 0 comments
Assignees

Comments

@rennergade
Copy link
Contributor

I found a bug with epoll where fds aren't getting properly removed from the an epollfds registered fd set.

According to the manpage
, these should be removed from the set when an fd is closed and its last reference is removed.

Originally we didn't do that, but another bug was masking it from returning an error in that scenario. When that bug was fixed we ran into a problem here where it was trying to check a non-existent fd. My fix checks if the fd exists before we poll the fds, and if not removes that fd.

This isn't exactly "removing from the set when the last reference is closed", and could be a possible problem in a scenario where an fd is added to a set, closed, and then a new fd is opened with the same number. This is certainly a TOCCTOU and could possibly be used maliciously?

We'll need to design some new infrastructure to handle this correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants