[php-src] Issue #7883: PHP CLI segafult when INI file is not readable

From: Date: Tue, 04 Jan 2022 16:30:51 +0000
Subject: [php-src] Issue #7883: PHP CLI segafult when INI file is not readable
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-238764@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/7883 Author: milo ### Description Redirected there by https://github.com/oerdnj/deb.sury.org/issues/1703 When mods-available INI file, e.g. /etc/php/8.1/mods-available/opcache.ini, has no sufficient permission to read by user, PHP CLI ends by segmentation fault. ``` php8.1[5509]: segfault at 0 ip 00007f4a768c97e4 sp 00007ffdae393780 error 4 in libc-2.28.so[7f4a7687c000+148000] ``` I've removed INI file permission by mistake and had no glue what happend to CLI scripts. Steps to reproduce the behavior: ``` # Probably not needed, this is default after installation chown root:root /etc/php/8.1/mods-available/opcache.ini # Remove read permission for others chmod 640 /etc/php/8.1/mods-available/opcache.ini # Run php as non-root user su username -c php8.1 Segmentation fault ``` **Expected behavior** Not segafult. Probably, extension should not be loaded, or emit warning. **Distribution** - Linux alfa-01 4.19.0-18-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) x86_64 GNU/Linux - OS: Debian 10.11 - Architecture: amd64 - Repository: deb https://packages.sury.org/php/ buster main Last lines of strace: ``` stat("/etc/php/8.1/cli/conf.d/10-opcache.ini", {st_mode=S_IFREG|0640, st_size=79, ...}) = 0 openat(AT_FDCWD, "/etc/php/8.1/cli/conf.d/10-opcache.ini", O_RDONLY) = -1 EACCES (Permission denied) --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} --- +++ killed by SIGSEGV +++ ``` ### PHP Version PHP 8.1.1 ### Operating System Debian 10.11

« previous php.bugs (#238764) next »