Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#57050 closed defect (bug) (invalid)

Allocation of JIT memory failed …

Reported by: petroski's profile petroski Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Bootstrap/Load Keywords:
Focuses: Cc:

Description (last modified by costdev)

Hello All,

I provide hosting for a number of WordPress websites on a CentOS server with the following config.

CentOS Linux 7.9.2009
Plesk Obsidian Version 18.0.47
PHP 7.43
mySQL 5.5.68-1.el7

For server security I have Atomic Secured Linux (Atomic Protector) installed that provides Firewall and OSSEC security (full version, not Plesk extension)

For quite some time, ASL has been reporting the following error code hundreds of times a day …

60027 : Denied a RWX mmap event. An application just attempted to use the mprotect function to bypass memory protection functions in the kernel.

I have contacted Atomic support several times over this issue but the problem is not with their software, it is doing what it is supposed to do. ASL uses their own custom kernel that would deny attempts to bypass memory protection.

So, digging a little deeper, I find this in my server logs at /var/log/plesk-php74-fpm/error.log:

WARNING: [pool xxxxxxxxx.ca] child 23848 said into stderr: “PHP message: PHP Warning: preg_match(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /var/www/vhosts/xxxxxxxxx.ca/httpdocs/wp-includes/load.php on line 43”

So, every time any of the domains on my server loads, this error is generated.

Looking at wp_fix_server_vars() in wp-includes/load.php, here is the errant code at lines 42-43:

<?php

// Fix for IIS when running with PHP ISAPI.
if ( empty( $_SERVER['REQUEST_URI'] ) || ( 'cgi-fcgi' !== PHP_SAPI && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {

Change History (3)

#1 @petroski
3 years ago

For more information regarding this error, see:

https://wiki.atomicorp.com/wiki/index.php/HIDS_60027

Thank you.

#2 @costdev
3 years ago

  • Component changed from Security to Bootstrap/Load
  • Description modified (diff)
  • Focuses coding-standards removed
  • Keywords changes-requested removed
  • Version changed from 6.1 to 3.0

@petroski Thanks for opening this ticket and welcome to Trac!

Just cleaning up some ticket properties and noting that this preg_match() call has existed since WordPress 3.0 in changeset [12732].

Last edited 3 years ago by costdev (previous) (diff)

#3 @TimothyBlynJacobs
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

This doesn't look to be something that WordPress needs to be adjusting. WordPress is just trying to use a standard regular expression. Instead, you need to follow what PHP is recommending you do.

“PHP Warning: preg_match(): Allocation of JIT memory failed, PCRE JIT will be disabled. This is likely caused by security restrictions. Either grant PHP permission to allocate executable memory, or set pcre.jit=0 in /var/www/vhosts/xxxxxxxxx.ca/httpdocs/wp-includes/load.php on line 43”

You need to set pcre.jit=0 in your php.ini file to tell PHP not to attempt to use JIT for regular expressions.

Note: See TracTickets for help on using tickets.