php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80905 VirtualProtect error when proc_open executed in CLI
Submitted: 2021-03-25 09:27 UTC Modified: 2021-05-31 12:55 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: gajowy at agzeta dot pl Assigned:
Status: Open Package: JIT
PHP Version: 8.0.3 OS: Windows 10 64-bit
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gajowy at agzeta dot pl
New email:
PHP Version: OS:

 

 [2021-03-25 09:27 UTC] gajowy at agzeta dot pl
Description:
------------
When JIT mode is enabled, running child process using proc_open causes crash in CLI mode with VirtualError message.



Test script:
---------------
1. Set opcache.jit_buffer_size=100M in php.ini
2. Run following script in CLI mode:

$proc=proc_open('php.exe',[],$pipes,NULL,NULL,['bypass_shell'=>TRUE]);
print_r( proc_get_status($proc) );
proc_terminate($proc);

Expected result:
----------------
Array
(
    [command] => php.exe
    [pid] => 13620
    [running] => 1
    [signaled] =>
    [stopped] =>
    [exitcode] => -1
    [termsig] => 0
    [stopsig] => 0
)

Actual result:
--------------
Thu Mar 25 10:20:55 2021 (1612): Fatal Error VirtualProtect() failed

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-03-25 15:34 UTC] cmb@php.net
At least as workaround, enforce separate OPcache instances by
using opcache.cache_id[1].  In this case

    $proc=proc_open('php.exe -dopcache.cache_id=123',[],$pipes,NULL,NULL,['bypass_shell'=>TRUE]);

[1] <https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.cache-id>
 [2021-05-19 08:02 UTC] dixyes at gmail dot com
This may fix it, but I donot know if it's proper or why donot do this.

diff --git a/ext/opcache/shared_alloc_win32.c b/ext/opcache/shared_alloc_win32.c
index f7ba4effb3..51b1679867 100644
--- a/ext/opcache/shared_alloc_win32.c
+++ b/ext/opcache/shared_alloc_win32.c
@@ -72,7 +72,7 @@ static void zend_win_error_message(int type, char *msg, int err)
 static char *create_name_with_username(char *name)
 {
        static char newname[MAXPATHLEN + 32 + 4 + 1 + 32 + 21];
-       snprintf(newname, sizeof(newname) - 1, "%s@%.32s@%.20s@%.32s", name, accel_uname_id, sapi_module.name, zend_system_id);
+       snprintf(newname, sizeof(newname) - 1, "%s@%.32s@%.20s@%.32s@%d", name, accel_uname_id, sapi_module.name, zend_system_id, GetCurrentProcessId());

        return newname;
 }
 [2021-05-31 12:55 UTC] cmb@php.net
On Windows, OPcache is supposed to be shared between different
(F)CGI processes (serving the same app), so baking in the
GetCurrentProcessId() is a no-go.
 [2023-05-27 11:21 UTC] deppjshvikaf at gmail dot com
fitness Point Blog are sharing latest news about fitness, diet, health, weight loss, runing, treatment, asthma, gym etc. More info to visit: (https://fitnesspointblog.com)github.com
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 14:01:30 2024 UTC