Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed PHP SEGV by not writing to shared memory for zend_class_entry. #9995

Merged
merged 2 commits into from
May 19, 2022

Conversation

haberman
Copy link
Member

Fixes: #9446

The root cause of the SEGV was that we were mutating zend_class_entry.create_object As of PHP 8.1, it appears that zend_class_entry structs for PHP classes are shared between PHP processes when using php-fpm and opcache. This means that writes to zend_class_entry.create_object in one process will be visible in another process, which violated our assumption that such writes reads and writes were single-threaded.

The fix was to stop mutating zend_class_entry.create_object, instead mutating a member of our PROTOBUF_G() struct.

Unfortunately the setup to reproduce this is somewhat involved, so there is no test at the moment. I tested and verified the fix locally on my machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segmentation Fault caused on PHP
2 participants