php / php-src

The PHP Interpreter
https://www.php.net
Other
38.23k stars 7.75k forks source link

`JIT_G(enabled)` not set correctly on other threads (leads to memory protection errors) (ZTS) #16851

Open dktapps opened 4 hours ago

dktapps commented 4 hours ago

Description

Disclaimer: I encountered this issue using a threading extension. Well aware this may not be the best source of truth on issues like this, especially due to the difficulty of reproducing.

With the following INI:

opcache.jit=tracing
opcache.jit_buffer_size=0

the following happens:

Proposed solution

PHP Version

8.1, 8.2, 8.3, 8.4, master

Operating System

Windows

cmb69 commented 3 hours ago

See also https://github.com/krakjoe/parallel/issues/266#issuecomment-2457353827. It seems to me the real problem is that you can enable JIT (opcache.jit) without enabling it (opcache.jit_buffer_size=0).

dktapps commented 3 hours ago

Yeah, that looks like the same issue. Unfortunately these are the default values for opcache.jit and opcache.jit_buffer_size so you can run into this just by loading opcache and not even touching JIT.

cmb69 commented 32 minutes ago

Unfortunately these are the default values for opcache.jit and opcache.jit_buffer_size

Note that as of PHP 8.4.0, the defaults are opcache.jit=disable and opcache.jit_buffer_size=64M (see https://wiki.php.net/rfc/jit_config_defaults), though.