** Description changed:

+ [Impact]
+ 
+ As explained in https://www.php.net/manual/en/intro.opcache.php,
+  
+ OPcache improves PHP performance by storing precompiled bytecode in shared 
memory, removing the need to load and parse scripts on each request.
+ 
+ A bug in PHP OPcache code (https://bugs.php.net/bug.php?id=79603) may
+ make PHP crash when this feature is enabled. For instance, this has been
+ observed with Symfony's caching feature.
+ 
+ The fix is available upstream at https://github.com/php/php-
+ src/commit/4f47ba99f002d50e11c111b8625d81f79b2bf52f
+ 
+ [Test Plan]
+ 
+ Use the following script to reproduce the issue on a focal environment
+ with php7.4 installed:
+ 
+ BEGIN_REPRODUCER
+ #!/bin/bash
+ 
+ PHP_TMP_DIR="$(mktemp -d)"
+ PHP_CACHE_DIR="${PHP_TMP_DIR}/cache"
+ PHP_FILE1="${PHP_TMP_DIR}/file1.php"
+ PHP_FILE2="${PHP_TMP_DIR}/file2.php"
+ mkdir -p "${PHP_CACHE_DIR}"
+ 
+ # prints information about the current php environment
+ # php -d opcache.enable_cli=1 -d opcache.file_cache_only=1 -d 
opcache.file_cache="${PHP_CACHE_DIR}" -i
+ 
+ cat > "${PHP_FILE1}" <<EOF
+ <?php
+ return function() {};
+ EOF
+ 
+ cat > "${PHP_FILE2}" <<EOF
+ <?php
+ \$file = '${PHP_FILE1}';
+ var_dump(include \$file);
+ touch(\$file);
+ var_dump(include \$file);
+ EOF
+ 
+ sleep 5
+ php -d opcache.enable_cli=1 -d opcache.file_cache_only=1 -d 
opcache.file_cache="${PHP_CACHE_DIR}" ${PHP_FILE1}
+ php -d opcache.enable_cli=1 -d opcache.file_cache_only=1 -d 
opcache.file_cache="${PHP_CACHE_DIR}" ${PHP_FILE2}
+ 
+ # clean up
+ rm -rf "${PHP_TMP_DIR}"
+ END_REPRODUCER
+ 
+ Re-run the reproducer after installing the proposed fix to ensure the
+ new package is no longer affected.
+ 
+ [Where problems could occur]
+ 
+ While the patch being proposed seems to be straightforward, it was
+ applied on top of two other patches in Zend/zend_compile.c and will be
+ back-ported (it does apply on different lines without changes). This may
+ lead to unpredicted code-paths being executed, triggering possible bugs
+ not seen upstream.
+ 
+ The set of patches is small enough and if needed, we could apply the
+ whole set to make the codepaths closer to what upstream intended for PHP
+ 7.4.7.
+ 
+ $ git log --oneline PHP-7.4.3..PHP-7.4.7 -- Zend/zend_compile.c
+ 4f47ba99f0 Fix bug #79603, by retrying on RTD key collision
+ c5159b3832 Check asserts early
+ 2dddab01ae Avoid "Anonymous class wasn't preloaded" error by lazely loading 
of not preloaded part of a preloaded script
+ 
+ Moreover, recompiling PHP linking it to possible new versions of
+ libraries that may have been SRU'd could trigger unwanted behaviors
+ which were not observed before.
+ 
+ [Other Info]
+  
+ This bug was fixed in php 7.4.7 and is not present in Ubuntu releases other 
than focal.
+ 
+ [Original message]
+ 
  As described in PHP bug #79603, it is possible to cause opcache
  collisions that result in a fatal error.
  
  https://bugs.php.net/bug.php?id=79603
  
  It has been fixed in this upstream commit:
  https://github.com/php/php-src/commit/4f47ba99f002d50e11c111b8625d81f79b2bf52f
  
  The changes to zend_compile.c apply cleanly, just at different line
  numbers.
  
  This has been reproduced on Ubuntu 20.04 with version 7.4.3-4ubuntu2.8
  of php7.4-opcache installed.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1968228

Title:
  RTD collision with opcache

To manage notifications about this bug go to:
https://bugs.launchpad.net/php/+bug/1968228/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to