[packages/php/PHP_7_1] opcache: mediate include_once/require_once under revalidate_path

arekm arekm at pld-linux.org
Wed Sep 2 08:57:34 CEST 2026


commit 29e9de0896b0b163bcea2028d2dcff3f6b43b74d
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Wed Sep 2 00:23:41 2026 +0200

    opcache: mediate include_once/require_once under revalidate_path
    
    Those forms skipped the open(), so on a shared SHM cache one uid could run
    another uid's cached script past the LSM profile and open_basedir.

 opcache-revalidate-path-once.patch | 16 ++++++++++++++++
 php.spec                           |  4 +++-
 2 files changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/php.spec b/php.spec
index 18f7be7..3c5fbf2 100644
--- a/php.spec
+++ b/php.spec
@@ -151,7 +151,7 @@ Summary(ru.UTF-8):	PHP Версии 7 - язык препроцессирова
 Summary(uk.UTF-8):	PHP Версії 7 - мова препроцесування HTML-файлів, виконувана на сервері
 Name:		%{orgname}%{php_suffix}
 Version:	7.1.33
-Release:	26
+Release:	27
 Epoch:		4
 # All files licensed under PHP version 3.01, except
 # Zend is licensed under Zend
@@ -224,6 +224,7 @@ Patch77:	types.patch
 Patch78:	includes.patch
 Patch79:	configure.patch
 Patch80:	ac_prog_sed.patch
+Patch81:	opcache-revalidate-path-once.patch
 URL:		https://www.php.net/
 %{?with_interbase:%{!?with_interbase_inst:BuildRequires:	Firebird-devel >= 1.0.2.908-2}}
 %{?with_pspell:BuildRequires:	aspell-devel >= 2:0.50.0}
@@ -2055,6 +2056,7 @@ cp -p php.ini-production php.ini
 %patch -P78 -p1
 %patch -P79 -p1
 %patch -P80 -p1
+%patch -P81 -p1
 
 sed -E -i -e '1s,#!\s*/usr/bin/env\s+(.*),#!%{__bindir}\1,' \
       run-tests.php
diff --git a/opcache-revalidate-path-once.patch b/opcache-revalidate-path-once.patch
new file mode 100644
index 0000000..6e75f8f
--- /dev/null
+++ b/opcache-revalidate-path-once.patch
@@ -0,0 +1,16 @@
+Make opcache.revalidate_path cover include_once/require_once too: they take a ready
+cached script from persistent_zend_resolve_path() and skip the open(), so on an SHM
+cache shared by several uids one account can run another's cached script past the
+LSM profile or open_basedir. No-op with the default revalidate_path=0.
+
+--- php/ext/opcache/ZendAccelerator.c.orig
++++ php/ext/opcache/ZendAccelerator.c
+@@ -2574,7 +2574,7 @@
+ 			if (resolved_path) {
+ 				/* lookup by real path */
+ 				zend_accel_hash_entry *bucket = zend_accel_hash_find_entry(&ZCSG(hash), resolved_path);
+-				if (bucket) {
++				if (bucket && !ZCG(accel_directives).revalidate_path) {
+ 					zend_persistent_script *persistent_script = (zend_persistent_script *)bucket->data;
+ 					if (!persistent_script->corrupted) {
+ 						if (key) {
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/php.git/commitdiff/29e9de0896b0b163bcea2028d2dcff3f6b43b74d



More information about the pld-cvs-commit mailing list