Bug #78894 [Fbk]: Preload: double free or corruption crash

From: Date: Mon, 27 Jan 2020 11:12:51 +0000
Subject: Bug #78894 [Fbk]: Preload: double free or corruption crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225130@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78894&edit=1

 ID:                 78894
 Updated by:         nikic@php.net
 Reported by:        luis dot armengol at koyi dot tv
 Summary:            Preload: double free or corruption crash
 Status:             Feedback
 Type:               Bug
 Package:            opcache
 Operating System:   Centos 7.3
 PHP Version:        7.4.2
 Block user comment: N
 Private report:     N

 New Comment:

> Correct, changing from opcache.preload_user=username to opcache.preload_user=root fixes the
> problem.

I don't think that works. The referenced issue occurs with any use of opcache.preload_user,
independent of whether it's root or not. Specifying root might just work by luck.

> Why do the docs say "Preloading code as root is not allowed for security reasons. This
> directive facilitates to let the preloading to be run as another user."

Preloading under root is not allowed by default, but explicit use of opcache.preload_user=root is
allowed, if you do want to run preloading under root (e.g. if you use Docker and you're root
anyway).


Previous Comments:
------------------------------------------------------------------------
[2020-01-27 11:06:13] w1zzard at gmx dot net

Correct, changing from opcache.preload_user=username to opcache.preload_user=root fixes the problem.

Thanks!

Why do the docs say "Preloading code as root is not allowed for security reasons. This
directive facilitates to let the preloading to be run as another user."

------------------------------------------------------------------------
[2020-01-27 08:30:49] nikic@php.net

Do you make use of opcache.preload_user? If so, this might be bug #79128.

------------------------------------------------------------------------
[2020-01-27 07:48:58] w1zzard at gmx dot net

Seeing the same issue on 7.4.2. 

The error will appear only after certain number of classes loaded. If I remove one class, I can load
another.

------------------------------------------------------------------------
[2019-12-18 11:36:18] nikic@php.net

I've cloned the zf1 repo and used your preload.php (with Redis commented) with the following
command:

~/php-7.4/sapi/cli/php -c ~/php-7.4/php.ini -d opcache.preload=preload.php -S localhost:8000 -t
demos/Zend/Wildfire/public/ -d include_path=$PWD/library

I couldn't produce a segfault that way (but I only used demos/Zend/Wildfire/public because it
was bundled and looked like web code...)

------------------------------------------------------------------------
[2019-12-15 18:59:21] luis dot armengol at koyi dot tv

Still crashing in 7.4.1 RC1

I can prepare a very basic web application with ZF1 if you need it and send you wherever you want.
Meanwhile, this is a small preload file content im using that its working. If you uncomment the
block of Zend/Db classes it will crash when trying to load the site (when executing bootstrap) (at
least in my case)

--------------------------------

<?php

   set_include_path(get_include_path() . PATH_SEPARATOR .
realpath("/data/webs/001_intranet.dev.zinkia.com/lib"));

   opcache_compile_file('Zend/Exception.php');

   opcache_compile_file('Zend/Loader.php');
   opcache_compile_file('Zend/Loader/Autoloader.php');
   opcache_compile_file('Zend/Loader/Autoloader/Resource.php');
   opcache_compile_file('Zend/Loader/Autoloader/Interface.php');
   opcache_compile_file('Zend/Loader/AutoloaderFactory.php');
   opcache_compile_file('Zend/Loader/ClassMapAutoloader.php');
   opcache_compile_file('Zend/Loader/Exception.php');
   opcache_compile_file('Zend/Loader/PluginLoader.php');
   opcache_compile_file('Zend/Loader/SplAutoloader.php');
   opcache_compile_file('Zend/Loader/StandardAutoloader.php');
   opcache_compile_file('Zend/Loader/Exception/InvalidArgumentException.php');
   opcache_compile_file('Zend/Loader/PluginLoader/Exception.php');
   opcache_compile_file('Zend/Loader/PluginLoader/Interface.php');

   opcache_compile_file('Zend/Config.php');
   opcache_compile_file('Zend/Config/Exception.php');
   opcache_compile_file('Zend/Config/Writer.php');
   opcache_compile_file('Zend/Config/Writer/FileAbstract.php');
   opcache_compile_file('Zend/Config/Writer/Array.php');
   opcache_compile_file('Zend/Config/Writer/Ini.php');
   opcache_compile_file('Zend/Config/Writer/Json.php');
   opcache_compile_file('Zend/Config/Writer/Xml.php');
   opcache_compile_file('Zend/Config/Writer/Yaml.php');
   opcache_compile_file('Zend/Config/Ini.php');
   opcache_compile_file('Zend/Config/Json.php');
   opcache_compile_file('Zend/Config/Xml.php');
   opcache_compile_file('Zend/Config/Yaml.php');

   opcache_compile_file('Zend/Cache.php');
   opcache_compile_file('Zend/Cache/Backend/Interface.php');
   opcache_compile_file('Zend/Cache/Backend/ExtendedInterface.php');
   opcache_compile_file('Zend/Cache/Backend.php');
   opcache_compile_file('Zend/Cache/Backend/Apc.php');
   opcache_compile_file('Zend/Cache/Backend/File.php');
   opcache_compile_file('Zend/Cache/Backend/Redis.php');
   opcache_compile_file('Zend/Cache/Backend/Static.php');
   opcache_compile_file('Zend/Cache/Backend/ZendPlatform.php');
   opcache_compile_file('Zend/Cache/Backend/ZendServer.php');
   opcache_compile_file('Zend/Cache/Backend/ZendServer/Disk.php');
   opcache_compile_file('Zend/Cache/Backend/ZendServer/ShMem.php');
   opcache_compile_file('Zend/Cache/Core.php');
   opcache_compile_file('Zend/Cache/Frontend/Capture.php');
   opcache_compile_file('Zend/Cache/Frontend/Class.php');
   opcache_compile_file('Zend/Cache/Frontend/File.php');
   opcache_compile_file('Zend/Cache/Frontend/Function.php');
   opcache_compile_file('Zend/Cache/Frontend/Output.php');
   opcache_compile_file('Zend/Cache/Frontend/Page.php');
   opcache_compile_file('Zend/Cache/Exception.php');
   opcache_compile_file('Zend/Cache/Manager.php');

   /*
   opcache_compile_file('Zend/Db.php');
   opcache_compile_file('Zend/Db/Exception.php');
   opcache_compile_file('Zend/Db/Adapter/Exception.php');
   opcache_compile_file('Zend/Db/Adapter/Abstract.php');
   //opcache_compile_file('Zend/Db/Adapter/Db2.php');
   opcache_compile_file('Zend/Db/Adapter/Mysqli.php');
   opcache_compile_file('Zend/Db/Adapter/Oracle.php');
   opcache_compile_file('Zend/Db/Adapter/Sqlsrv.php');
   //opcache_compile_file('Zend/Db/Adapter/Db2/Exception.php');
   opcache_compile_file('Zend/Db/Adapter/Mysqli/Exception.php');
   opcache_compile_file('Zend/Db/Adapter/Oracle/Exception.php');
   opcache_compile_file('Zend/Db/Adapter/Pdo/Abstract.php');
   opcache_compile_file('Zend/Db/Adapter/Pdo/Ibm.php');
   opcache_compile_file('Zend/Db/Adapter/Pdo/Mssql.php');
   opcache_compile_file('Zend/Db/Adapter/Pdo/Mysql.php');
   opcache_compile_file('Zend/Db/Adapter/Pdo/Oci.php');
   opcache_compile_file('Zend/Db/Adapter/Pdo/Pgsql.php');
   opcache_compile_file('Zend/Db/Adapter/Pdo/Sqlite.php');
   //opcache_compile_file('Zend/Db/Adapter/Pdo/Ibm/Db2.php');
   opcache_compile_file('Zend/Db/Adapter/Pdo/Ibm/Ids.php');
   opcache_compile_file('Zend/Db/Adapter/Sqlsrv/Exception.php');
   opcache_compile_file('Zend/Db/Profiler.php');
   opcache_compile_file('Zend/Db/Profiler/Exception.php');
   opcache_compile_file('Zend/Db/Profiler/Firebug.php');
   opcache_compile_file('Zend/Db/Profiler/Query.php');
   opcache_compile_file('Zend/Db/Select/Exception.php');
   opcache_compile_file('Zend/Db/Statement/Exception.php');
   opcache_compile_file('Zend/Db/Statement/Interface.php');
   opcache_compile_file('Zend/Db/Statement.php');
   opcache_compile_file('Zend/Db/Statement/Db2.php');
   opcache_compile_file('Zend/Db/Statement/Mysqli.php');
   opcache_compile_file('Zend/Db/Statement/Oracle.php');
   opcache_compile_file('Zend/Db/Statement/Pdo.php');
   opcache_compile_file('Zend/Db/Statement/Sqlsrv.php');
   //opcache_compile_file('Zend/Db/Statement/Db2/Exception.php');
   opcache_compile_file('Zend/Db/Statement/Mysqli/Exception.php');
   opcache_compile_file('Zend/Db/Statement/Oracle/Exception.php');
   opcache_compile_file('Zend/Db/Statement/Pdo/Ibm.php');
   opcache_compile_file('Zend/Db/Statement/Pdo/Oci.php');
   opcache_compile_file('Zend/Db/Statement/Sqlsrv/Exception.php');
   opcache_compile_file('Zend/Db/Select.php');
   opcache_compile_file('Zend/Db/Table/Abstract.php');
   opcache_compile_file('Zend/Db/Table/Definition.php');
   opcache_compile_file('Zend/Db/Table/Exception.php');
   opcache_compile_file('Zend/Db/Table/Row/Abstract.php');
   opcache_compile_file('Zend/Db/Table/Row/Exception.php');
   opcache_compile_file('Zend/Db/Table/Rowset/Abstract.php');
   opcache_compile_file('Zend/Db/Table/Rowset/Exception.php');
   opcache_compile_file('Zend/Db/Table/Select/Exception.php');
   opcache_compile_file('Zend/Db/Table/Row.php');
   opcache_compile_file('Zend/Db/Table/Rowset.php');
   opcache_compile_file('Zend/Db/Table/Select.php');
   opcache_compile_file('Zend/Db/Expr.php');
   opcache_compile_file('Zend/Db/Table.php');
*/

   opcache_compile_file('Zend/Registry.php');      

----------------------------------------------------------------

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=78894


--
Edit this bug report at https://bugs.php.net/bug.php?id=78894&edit=1


Thread (15 messages)

« previous php.bugs (#225130) next »