Skip to content

Fix GH-22759: Keep Io\Poll watcher registry in sync#22760

Open
LamentXU123 wants to merge 1 commit into
php:masterfrom
LamentXU123:fix-22759
Open

Fix GH-22759: Keep Io\Poll watcher registry in sync#22760
LamentXU123 wants to merge 1 commit into
php:masterfrom
LamentXU123:fix-22759

Conversation

@LamentXU123

@LamentXU123 LamentXU123 commented Jul 16, 2026

Copy link
Copy Markdown
Member

Also remove the watcher from the Context registry when it is explicitly removed. and roll back the backend registration on failure.

Fixed #22759

@devnexen

Copy link
Copy Markdown
Member

fix looks correct to me.

Comment thread ext/standard/io_poll.c

zend_ulong hash_key = php_io_poll_compute_ptr_key(handle);
zend_hash_index_add(intern->watchers, hash_key, &watcher_zv);
if (zend_hash_index_add(intern->watchers, hash_key, &watcher_zv) == NULL) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can zend_hash_index_add actually fail here? i.e. A duplicate handle hits PHP_POLL_ERR_EXISTS at line 751 first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Io\Poll use-after-free

2 participants