Skip to content

main/poll: Cap kqueue grouped-event buffer write at runtime#22327

Open
iliaal wants to merge 1 commit into
php:masterfrom
iliaal:fix/poll-kqueue-buffer-cap
Open

main/poll: Cap kqueue grouped-event buffer write at runtime#22327
iliaal wants to merge 1 commit into
php:masterfrom
iliaal:fix/poll-kqueue-buffer-cap

Conversation

@iliaal

@iliaal iliaal commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

The kqueue grouped-event path bounded the result buffer only with a ZEND_ASSERT, allowing an out-of-bounds write in release builds when more distinct descriptors were ready than the caller's maxEvents. This caps the buffer write at runtime while still running the oneshot bookkeeping so the backend's tracking stays in sync. An alternative is to cap the kevent() request to maxEvents so the dedup can't exceed the buffer; this takes the minimal in-place fix. kqueue isn't compiled on Linux, so it rides macOS CI. Split out of #22316 on review.

@iliaal iliaal requested a review from bukka as a code owner June 15, 2026 23:31
The kqueue grouped-event path bounded the result buffer only with a
ZEND_ASSERT, allowing an out-of-bounds write in release builds when more
distinct descriptors were ready than the caller's maxEvents. Cap the
buffer write at runtime while still running the oneshot bookkeeping so
the backend's tracking stays in sync.

Closes phpGH-22327
@iliaal iliaal force-pushed the fix/poll-kqueue-buffer-cap branch from 1ac6729 to 5508243 Compare June 15, 2026 23:31
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