-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
lib/posix-poll: Fix poll() ignoring fd 0 #1255
Conversation
This change fixes a bug where poll() would ignore fd 0 as if it were a negative fd, which are explicitly allowed as NOP entries. Signed-off-by: Andrei Tatar <andrei@unikraft.io>
Hi, @andreittr . How does this bug manifest? |
@razvand I've updated the description; turns out it needs quite a bit of setup to trigger. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @andreittr, I was able to reproduce the issue with #1226 and gcc 13.2 and the fix works just fine. All good on my side!
Reviewed-by: Maria Sfiraiala maria.sfiraiala@gmail.com
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved-by: Razvan Deaconescu razvand@unikraft.io
This change fixes a bug where poll() would ignore fd 0 as if it were a negative fd, which are explicitly allowed as NOP entries. Signed-off-by: Andrei Tatar <andrei@unikraft.io> Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> GitHub-Closes: #1255
This change fixes a bug where poll() would ignore fd 0 as if it were a negative fd, which are explicitly allowed as NOP entries. Signed-off-by: Andrei Tatar <andrei@unikraft.io> Reviewed-by: Maria Sfiraiala <maria.sfiraiala@gmail.com> Approved-by: Razvan Deaconescu <razvand@unikraft.io> GitHub-Closes: unikraft#1255
Description of changes
This change fixes a bug where poll() would ignore fd 0 as if it were a negative fd, which are explicitly allowed as NOP entries.
Prerequisite checklist
checkpatch.uk
on your commit series before opening this PR;Base target
Additional configuration
CONFIG_LIBPOSIX_POLL=y
Test snippet (assumes fd:0 is tty stdin):
On Linux
poll
immediately returns withPOLLOUT
set.On
staging
, with or without this fix, Unikraft waits until the timeout, because vfscore stdio files never emit events.Applying #1226 that implements tty files more consistently we can test the above snippet.
(GCC 13 or clang is required, otherwise you also need #1245)
Without fix, Unikraft waits until the timeout, with the fix it immediately returns
POLLIN|POLLOUT
.