Skip to content

ext/opcache/zend_jit: call TSRM dtor before unloading opcache.so #10533

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

Merged
merged 1 commit into from
Feb 7, 2023

Conversation

MaxKellermann
Copy link
Contributor

@MaxKellermann MaxKellermann commented Feb 7, 2023

Commit a211956 added a TSRM destructor, but that destructor will get called by tsrm_shutdown(), which is after opcache.so has already been unloaded, resulting in a shutdown crash, e.g.:

  #0  0x00007fad01737500 in ?? ()
  #1  0x000055ac54e723c4 in tsrm_shutdown () at TSRM/TSRM.c:194
  #2  0x000055ac54c42180 in main (argc=80, argv=0x55ac57bc14d0) at sapi/cli/php_cli.c:1388

By calling ts_free_id() before opcache.so gets unloaded, we can easily fix this crash bug.

(@dstogov, this should fix the CI failures after your JIT dtor change.)

Commit a211956 added a TSRM destructor, but that destructor
will get called by tsrm_shutdown(), which is after opcache.so has
already been unloaded, resulting in a shutdown crash, e.g.:

  #0  0x00007fad01737500 in ?? ()
  php#1  0x000055ac54e723c4 in tsrm_shutdown () at TSRM/TSRM.c:194
  php#2  0x000055ac54c42180 in main (argc=80, argv=0x55ac57bc14d0) at sapi/cli/php_cli.c:1388

By calling ts_free_id() before opcache.so gets unloaded, we can easily
fix this crash bug.
Copy link
Member

@dstogov dstogov left a comment

Choose a reason for hiding this comment

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

This looks right. I'll merge this when tests passed.

@MaxKellermann
Copy link
Contributor Author

All green, this worked. (Only AppVeyor is still queued.)

@dstogov dstogov merged commit 131b862 into php:PHP-8.1 Feb 7, 2023
dstogov added a commit that referenced this pull request Feb 7, 2023
* PHP-8.1:
  ext/opcache/zend_jit: call TSRM dtor before unloading opcache.so (#10533)
dstogov added a commit that referenced this pull request Feb 7, 2023
* PHP-8.2:
  ext/opcache/zend_jit: call TSRM dtor before unloading opcache.so (#10533)
@dstogov
Copy link
Member

dstogov commented Feb 7, 2023

Thanks again.

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.

2 participants