[php-src] Issue #11265: JIT buffer relocation fails with 64bit packing
| From: | LoongT4o | Date: | Thu, 18 May 2023 05:56:15 +0000 |
| Subject: | [php-src] Issue #11265: JIT buffer relocation fails with 64bit packing | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244475@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11265
Author: LoongT4o
### Description
JIT buffer relocation failed when WordPress workload is running with 64bit packing.
64bit packing places PHP and its libraries together at 64b memory space by using Ubuntu-native
dynamic loader while executing php-fpm program, e.g. /lib64/ld-linux-x86-64.so.2
/usr/local/sbin/php-fpm
Here is the maps of php-fpm:
40000000-48000000 rw-s 00000000 00:0f 38927338 /anon_hugepage (deleted)
48000000-49400000 r-xs 08000000 00:0f 38927338 /anon_hugepage (deleted)
7ffff6dae000-7ffff6ea6000 r--p 00000000 08:02 11538447 /usr/local/sbin/php-fpm
7ffff6ea6000-7ffff6fae000 ---p 000f8000 08:02 11538447 /usr/local/sbin/php-fpm
7ffff6fae000-7ffff735c000 r-xp 00200000 08:02 11538447 /usr/local/sbin/php-fpm
We can see that the memory address distance between opcache/JIT buffer and PHP .text segment is
greater than 4GB.
Actually, there is an available free segment between 49400000 and 7ffff6dae000 to place the JIT
buffer to meet the 4GB distance requirement.
Patch #8890 's method is to traverse each free memory segment, and then verify whether the
candidate at the beginning of the current segment meets the requirements (that is, from the end
address of the last non-free memory segment). However, if the address range of the current free
segment is large, the algorithm may fail to find candidates (the address of the second half of the
current free segment may meet the 4GB requirement).
### PHP Version
PHP 8.2
### Operating System
Ubuntu22.04