mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.3'
* PHP-8.3: [ci skip] NEWS Hint the opcache shm mapping location only when JIT is enabled Fix the JIT buffer relocation failure at the corner case (#11266)
This commit is contained in:
commit
c60dbecb69
1 changed files with 13 additions and 3 deletions
|
@ -20,6 +20,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "zend_shared_alloc.h"
|
#include "zend_shared_alloc.h"
|
||||||
|
#include "jit/zend_jit.h"
|
||||||
|
|
||||||
#ifdef USE_MMAP
|
#ifdef USE_MMAP
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@
|
||||||
# define MAP_HUGETLB MAP_ALIGNED_SUPER
|
# define MAP_HUGETLB MAP_ALIGNED_SUPER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(__linux__) || defined(__FreeBSD__)) && (defined(__x86_64__) || defined (__aarch64__)) && !defined(__SANITIZE_ADDRESS__)
|
#if defined(HAVE_JIT) && (defined(__linux__) || defined(__FreeBSD__)) && (defined(__x86_64__) || defined (__aarch64__)) && !defined(__SANITIZE_ADDRESS__)
|
||||||
static void *find_prefered_mmap_base(size_t requested_size)
|
static void *find_prefered_mmap_base(size_t requested_size)
|
||||||
{
|
{
|
||||||
size_t huge_page_size = 2 * 1024 * 1024;
|
size_t huge_page_size = 2 * 1024 * 1024;
|
||||||
|
@ -197,8 +198,17 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
|
||||||
#ifdef PROT_MAX
|
#ifdef PROT_MAX
|
||||||
flags |= PROT_MAX(PROT_READ | PROT_WRITE | PROT_EXEC);
|
flags |= PROT_MAX(PROT_READ | PROT_WRITE | PROT_EXEC);
|
||||||
#endif
|
#endif
|
||||||
#if (defined(__linux__) || defined(__FreeBSD__)) && (defined(__x86_64__) || defined (__aarch64__)) && !defined(__SANITIZE_ADDRESS__)
|
#if defined(HAVE_JIT) && (defined(__linux__) || defined(__FreeBSD__)) && (defined(__x86_64__) || defined (__aarch64__)) && !defined(__SANITIZE_ADDRESS__)
|
||||||
void *hint = find_prefered_mmap_base(requested_size);
|
void *hint;
|
||||||
|
if (JIT_G(enabled) && JIT_G(buffer_size)
|
||||||
|
&& zend_jit_check_support() == SUCCESS) {
|
||||||
|
hint = find_prefered_mmap_base(requested_size);
|
||||||
|
} else {
|
||||||
|
/* Do not use a hint if JIT is not enabled, as this profits only JIT and
|
||||||
|
* this is potentially unsafe when the only suitable candidate is just
|
||||||
|
* after the heap (e.g. in non-PIE builds) (GH-13775). */
|
||||||
|
hint = MAP_FAILED;
|
||||||
|
}
|
||||||
if (hint != MAP_FAILED) {
|
if (hint != MAP_FAILED) {
|
||||||
# ifdef MAP_HUGETLB
|
# ifdef MAP_HUGETLB
|
||||||
size_t huge_page_size = 2 * 1024 * 1024;
|
size_t huge_page_size = 2 * 1024 * 1024;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue