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

Segfault when using PTHREADS_INHERIT_NONE and calling global function #111

Open
dktapps opened this issue Apr 24, 2023 · 0 comments
Open

Comments

@dktapps
Copy link
Member

dktapps commented Apr 24, 2023

In PHP 8.2, ZEND_INIT_FCALL assumes that the function exists: php/php-src@da684582d74

This is fine for normal code, but pthreads may copy classes without copying functions (even when PTHREADS_INHERIT_NONE is used), creating a problem - a mistake in code that would have previously caused a thrown Error will now crash the interpreter instead.

A few possible solutions:

  • Scan INIT_FCALL opcodes in copied op_arrays, and copy any functions found as dependent functions (similar to how we copy class hierarchies)
  • Use CG(compiler_options) |= ZEND_COMPILE_IGNORE_USER_FUNCTIONS - a quick and dirty fix, but this would cause minor performance degradation the first time a user function is called (probably OK for long-running applications?)
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

No branches or pull requests

1 participant