Skip to content

poll: Write back only revents to userspace, matching Linux behavior#12898

Merged
copybara-service[bot] merged 2 commits intomasterfrom
test/cl896650914
Apr 9, 2026
Merged

poll: Write back only revents to userspace, matching Linux behavior#12898
copybara-service[bot] merged 2 commits intomasterfrom
test/cl896650914

Conversation

@copybara-service
Copy link
Copy Markdown

poll: Write back only revents to userspace, matching Linux behavior

doPoll() was modifying pfd.Events (adding POLLHUP|POLLERR) and writing back the entire pollfd struct. Linux only writes back revents via unsafe_put_user() in do_sys_poll(). The polluted events field broke libevent's poll_del(), causing a busy-loop in tmux (CPU 96.6%).

Fix: write back only the 2-byte revents field per fd in doPoll().
FUTURE_COPYBARA_INTEGRATE_REVIEW=#12851 from tanyifeng:poll-revents-writeback 3169ea6

doPoll() was modifying pfd.Events (adding POLLHUP|POLLERR) and writing
back the entire pollfd struct. Linux only writes back revents via
unsafe_put_user() in do_sys_poll(). The polluted events field broke
libevent's poll_del(), causing a busy-loop in tmux (CPU 96.6%).

Fix: write back only the 2-byte revents field per fd in doPoll().

Signed-off-by: Tan Yifeng <yiftan@tencent.com>
@copybara-service copybara-service Bot added the exported Issue was exported automatically label Apr 8, 2026
@copybara-service copybara-service Bot force-pushed the test/cl896650914 branch 5 times, most recently from efec1fd to acbbb22 Compare April 9, 2026 18:09
@copybara-service copybara-service Bot merged commit 217f4bf into master Apr 9, 2026
@copybara-service copybara-service Bot deleted the test/cl896650914 branch April 9, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants