mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.3' into PHP-7.4
This commit is contained in:
commit
db7702213c
2 changed files with 47 additions and 1 deletions
|
@ -121,7 +121,20 @@ static SLJIT_INLINE int get_map_jit_flag()
|
|||
uname(&name);
|
||||
|
||||
/* Kernel version for 10.14.0 (Mojave) */
|
||||
map_jit_flag = (atoi(name.release) >= 18) ? MAP_JIT : 0;
|
||||
if (atoi(name.release) >= 18) {
|
||||
/* Only use MAP_JIT if a hardened runtime is used, because MAP_JIT is incompatible
|
||||
with fork(). */
|
||||
void *ptr = mmap(
|
||||
NULL, getpagesize(), PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
|
||||
if (ptr == MAP_FAILED) {
|
||||
map_jit_flag = MAP_JIT;
|
||||
} else {
|
||||
map_jit_flag = 0;
|
||||
munmap(ptr, getpagesize());
|
||||
}
|
||||
} else {
|
||||
map_jit_flag = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return map_jit_flag;
|
||||
|
|
33
ext/pcre/tests/bug78272.phpt
Normal file
33
ext/pcre/tests/bug78272.phpt
Normal file
|
@ -0,0 +1,33 @@
|
|||
--TEST--
|
||||
Bug #78272: calling preg_match() before pcntl_fork() will freeze child process
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('pcntl')) die("skip pcntl extension required");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
preg_match('/abc/', 'abcde', $r);
|
||||
|
||||
$pid = pcntl_fork();
|
||||
if ($pid === 0) {
|
||||
print "Child start\n";
|
||||
preg_match('/abc/', 'abcde', $r);
|
||||
print_r($r);
|
||||
print "End child\n";
|
||||
exit(0);
|
||||
} else {
|
||||
print "Main start\n";
|
||||
pcntl_waitpid($pid, $status);
|
||||
print "End Main\n";
|
||||
exit(0);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
Main start
|
||||
Child start
|
||||
Array
|
||||
(
|
||||
[0] => abc
|
||||
)
|
||||
End child
|
||||
End Main
|
Loading…
Add table
Add a link
Reference in a new issue