[php-src] Issue #14470: Segfault in opcache module when executing php script passed via STDIN

From: Date: Tue, 04 Jun 2024 16:51:24 +0000
Subject: [php-src] Issue #14470: Segfault in opcache module when executing php script passed via STDIN
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247031@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/14470 Author: vtaneza ### Description We have a php script that should be executed via php cli command passing the script via STDIN but it segfaults with details as below: ``` Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007f515e908e4d in zend_get_file_handle_timestamp () from /usr/lib64/php/modules/opcache.so Missing separate debuginfos, [...] (gdb) bt #0 0x00007f515e908e4d in zend_get_file_handle_timestamp () from /usr/lib64/php/modules/opcache.so #1 0x00007f515e909247 in opcache_compile_file () from /usr/lib64/php/modules/opcache.so #2 0x00007f515e90bf47 in persistent_compile_file () from /usr/lib64/php/modules/opcache.so #3 0x00007f515ec1a63a in ?? () from /usr/lib64/php/modules/ioncube_loader_lin_8.2.so #4 0x000055609f75fbe4 in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at /usr/src/debug/php-8.2.18-1.el8.remi.x86_64/Zend/zend.c:1835 #5 0x000055609f6f901a in php_execute_script (primary_file=<optimized out>) at /usr/src/debug/php-8.2.18-1.el8.remi.x86_64/main/main.c:2557 #6 0x000055609f849cd1 in do_cli (argc=3, argv=0x5560a02e8090) at /usr/src/debug/php-8.2.18-1.el8.remi.x86_64/sapi/cli/php_cli.c:964 #7 0x000055609f5964e7 in main (argc=3, argv=0x5560a02e8090) at /usr/src/debug/php-8.2.18-1.el8.remi.x86_64/sapi/cli/php_cli.c:1333 ``` By the way, we are enabling ioncube loader module for PHP 8.2 (/usr/lib64/php/modules/ioncube_loader_lin_8.2.so). The script is downloaded from a site via curl and piped to php command using -- argument as below: curl https://my.domain/some/path | php -- some_args I narrowed down to the simplest command that can reproduce the issue by executing an empty script as below: echo "" | php -- Below are my observations: 1. no segfault when disabling opcache using the -d opcache.enable=0 option. i.e echo "" | php -d opcache.enable=0 -- 2. no segfault when removing ioncube loader as a zend_extension even if opcache is enabled. I am not sure where is the exact problem and where should the fix be made. Is it in opcache module or ioncube? Kindly advise. Thanks ### PHP Version PHP 8.2.18 ### Operating System Rocky Linux 8.10

« previous php.bugs (#247031) next »