Skip to content

sapi/fpm: Make event queue traversal deletion-safe - #346

Closed
iliaal wants to merge 1 commit into
PHP-8.4from
fix/aph-fpm-event-queue-uaf-84
Closed

iliaal wants to merge 1 commit into
PHP-8.4from
fix/aph-fpm-event-queue-uaf-84

Conversation

@iliaal

@iliaal iliaal commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Save the next FPM event-queue node before invoking callbacks that may remove the current event, fixing both poll and select backends. The FPM binary builds and its configuration test succeeds.

fpm_event_select_wait() and fpm_event_poll_wait() read q->next after
firing the event, but fpm_stdio_child_said() deletes its own event when a
worker pipe reaches EOF, which frees q. The iterator must not touch a node
a callback may have freed, so save the successor before firing, as the
timer loop in fpm_event_loop() already does. With catch_workers_output
enabled, the loop reads freed memory when a worker exits under select, and
under poll on Linux when the worker leaves unread output in its pipe. With
glibc this crashes the master.
@iliaal
iliaal force-pushed the fix/aph-fpm-event-queue-uaf-84 branch from d7890aa to aae52e1 Compare November 2, 2026 13:40
@iliaal

iliaal commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Promoted upstream: php#25154

@iliaal iliaal closed this Nov 2, 2026
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