Skip to content

GH-9370: Fix opcache jit protection bits. #9371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions ext/opcache/jit/zend_jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -4611,7 +4611,6 @@ ZEND_EXT_API void zend_jit_unprotect(void)
#ifdef HAVE_PTHREAD_JIT_WRITE_PROTECT_NP
if (zend_write_protect) {
pthread_jit_write_protect_np(0);
return;
}
#endif
opts |= PROT_EXEC;
Expand Down Expand Up @@ -4645,7 +4644,6 @@ ZEND_EXT_API void zend_jit_protect(void)
#ifdef HAVE_PTHREAD_JIT_WRITE_PROTECT_NP
if (zend_write_protect) {
pthread_jit_write_protect_np(1);
return;
}
#endif
if (mprotect(dasm_buf, dasm_size, PROT_READ | PROT_EXEC) != 0) {
Expand Down
3 changes: 3 additions & 0 deletions ext/opcache/shared_alloc_mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
#ifdef PROT_MAX
flags |= PROT_MAX(PROT_READ | PROT_WRITE | PROT_EXEC);
#endif
#ifdef MAP_JIT
flags |= MAP_JIT;
#endif
#if (defined(__linux__) || defined(__FreeBSD__)) && (defined(__x86_64__) || defined (__aarch64__))
void *hint = find_prefered_mmap_base(requested_size);
if (hint != MAP_FAILED) {
Expand Down