Skip to content

fix select exception fdset clearing#1373

Open
russellromney wants to merge 1 commit into
QuarkContainer:mainfrom
russellromney:codex/select-except-fdset
Open

fix select exception fdset clearing#1373
russellromney wants to merge 1 commit into
QuarkContainer:mainfrom
russellromney:codex/select-except-fdset

Conversation

@russellromney

@russellromney russellromney commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Fix select(2) fdset handling when an exception event does not occur.

DoSelect() correctly clears readfds and writefds entries when their requested events are absent, but the exception-fdset branch accidentally cleared writefds instead of exceptfds:

w[i] &= !m;

This leaves the file descriptor incorrectly set in exceptfds.

Regression Test

Adds test/c/select_except_connect.c and includes it in make clean, a minimal loopback TCP regression:

  1. start a local TCP listener
  2. create a nonblocking client socket
  3. call connect()
  4. call select() with read/write/exception fdsets
  5. assert the client socket is in writefds, not exceptfds, and SO_ERROR == 0

Validation

Local/native control:

select rc=1 read=0 write=1 except=0 so_error=0

Quark red/green on a DO droplet with only qkernel swapped:

Unpatched qkernel:

client socket was not in writefds
select rc=1 read=0 write=0 except=1 so_error=0

Patched qkernel:

select rc=1 read=0 write=1 except=0 so_error=0

runc control:

select rc=1 read=0 write=1 except=0 so_error=0

@russellromney russellromney force-pushed the codex/select-except-fdset branch from df4b215 to 24a285d Compare June 15, 2026 21:13
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

Successfully merging this pull request may close these issues.

1 participant