Bug #78630 [Com]: PHP 7.3 preg_match(): JIT compilation failed: no more memory (need pcre.jit=0)
| From: | bugreports at gmail dot com | Date: | Fri, 04 Oct 2019 11:02:45 +0000 |
| Subject: | Bug #78630 [Com]: PHP 7.3 preg_match(): JIT compilation failed: no more memory (need pcre.jit=0) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-223063@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78630&edit=1
ID: 78630
Comment by: bugreports at gmail dot com
Reported by: ilya at ilya dot pp dot ua
Summary: PHP 7.3 preg_match(): JIT compilation failed: no
more memory (need pcre.jit=0)
Status: Open
Type: Bug
Package: PCRE related
Operating System: openSUSE Tumbleweed
PHP Version: 7.3.10
Block user comment: N
Private report: N
New Comment:
> But I donât know how to execute it in such a way as to connect
> strace to it, because there is no process before the code execution
that's the much easier case than attach a running process
strace php -r
"preg_match('/^[\w.-]+@[\w.-]+\.\w{2,}$/','ilya@ilya.pp.ua');"
--------------------
usage: strace [-ACdffhikqqrtttTvVwxxyyzZ] [-I n] [-b execve] [-e expr]...
[-a column] [-o file] [-s strsize] [-X format] [-P path]...
[-p pid]... [--seccomp-bpf]
{ -p pid | [-D] [-E var=val]... [-u username] PROG [ARGS] }
or: strace -c[dfwzZ] [-I n] [-b execve] [-e expr]... [-O overhead]
[-S sortby] [-P path]... [-p pid]... [--seccomp-bpf]
{ -p pid | [-D] [-E var=val]... [-u username] PROG [ARGS] }
Previous Comments:
------------------------------------------------------------------------
[2019-10-04 10:59:16] ilya at ilya dot pp dot ua
I found a shorter and more reliable way to show the problem right from the console.
php -r "preg_match('/^[\w.-]+@[\w.-]+\.\w{2,}$/','ilya@ilya.pp.ua');"
PHP Warning: preg_match(): JIT compilation failed: no more memory in Command line code on line 1
This code always gives an error no matter how much I run it.
But I donât know how to execute it in such a way as to connect strace to it, because there is
no process before the code execution ..., you can probably try sleep(30) &&.
And now I'm even more confused ...
php -r "preg_match('/^[\w.-]+@[\w.-]+\.\w{2,}$/','ilya@ilya.pp.ua');"
Always performed with an error!
php -r
"sleep(30)&&preg_match('/^[\w.-]+@[\w.-]+\.\w{2,}$/','ilya@ilya.pp.ua');"
It always runs without error, so I put it strace You will not be interested.
Is there a way to connect strace without knowing the process number in advance?
------------------------------------------------------------------------
[2019-10-04 10:59:15] bugreports at gmail dot com
> Note that openSUSE Tumbleweed uses a private /tmp,
> which is mounted under /var/tmp/systemd-private...
this is not true!
PrivateTemp isolates /tmp and /var/tmp and so you have /tmp/systemd-private...
------------------------------------------------------------------------
[2019-10-04 10:43:21] build+suse at de-korte dot org
Note that openSUSE Tumbleweed uses a private /tmp, which is mounted under
/var/tmp/systemd-private-[lots of hex]-php-fpm.service-[more hex]/tmp. So if you have mounted your
/var partition as no-exec, the private /tmp your PHP process is using will also be no-exec.
------------------------------------------------------------------------
[2019-10-04 10:35:58] nikic@php.net
Thanks for the strace logs! The relevant part is:
openat(AT_FDCWD, "/tmp", O_RDWR|O_EXCL|O_NOATIME|O_CLOEXEC|O_TMPFILE, 0600) = 5
ftruncate(5, 65536) = 0
mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_SHARED, 5, 0) = 0x7f33788e9000
mmap(NULL, 65536, PROT_READ|PROT_EXEC, MAP_SHARED, 5, 0) = -1 EPERM
(ÐпеÑаÑÐ¸Ñ Ð½Ðµ позволена)
munmap(0x7f33788e9000, 65536) = 0
close(5) = 0
The PROT_READ|PROT_EXEC mmap fails with EPERM. Apart from the possibility of this being prevented by
something like SELinux, the man page also lists two more possibilities:
EPERM The prot argument asks for PROT_EXEC but the mapped area
belongs to a file on a filesystem that was mounted no-exec.
EPERM The operation was prevented by a file seal; see fcntl(2).
Could you check whether the /tmp filesystem might be mounted as noexec? (This should be visible in
the output of "mount".)
------------------------------------------------------------------------
[2019-10-04 10:15:05] ilya at ilya dot pp dot ua
@nikic
Thank you, I did it.
Received strange results. At the first start (php processes do not exist yet), an error always
appears, and moreover, when you refresh the php page once everything is fine, then again this error.
Attached strace output from both processes after an error.
https://bugzilla.suse.com/attachment.cgi?id=820531
https://bugzilla.suse.com/attachment.cgi?id=820532
------------------------------------------------------------------------
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=78630
--
Edit this bug report at https://bugs.php.net/bug.php?id=78630&edit=1