-
Notifications
You must be signed in to change notification settings - Fork 7.9k
opcache JIT support improvements attempts on macOs. #8382
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
opcache JIT support improvements attempts on macOs. #8382
Conversation
036c348
to
17d924a
Compare
ext/opcache/jit/zend_jit.c
Outdated
pthread_jit_write_protect_np(0); | ||
opts |= PROT_EXEC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you don't need to call mprotect()
after pthread_jit_write_protect_np()
here and in zend_jit_protect()
. Also see code alignment.
This probably should be changed into:
if (zend_write_protect) {
pthread_jit_write_protect_np(0);
return;
}
opts |= PROT_EXEC
ext/opcache/jit/zend_jit.c
Outdated
#ifdef HAVE_PTHREAD_JIT_WRITE_PROTECT_NP | ||
if (zend_write_protect) { | ||
pthread_jit_write_protect_np(0); | ||
} | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This denies execution.
17d924a
to
6735ac4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see problems in source code, but I can't test this.
Please try to test running ''ab -t 300 -c 10 ...'' and simultaneously modifying/touching executed php scripts.
ext/opcache/jit/zend_jit.c
Outdated
pthread_jit_write_protect_np(1); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alignment
ext/opcache/jit/zend_jit.c
Outdated
#ifdef HAVE_PTHREAD_JIT_WRITE_PROTECT_NP | ||
if (zend_write_protect) { | ||
pthread_jit_write_protect_np(1); | ||
} | ||
#endif | ||
if (mprotect(dasm_buf, dasm_size, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) { | ||
fprintf(stderr, "mprotect() failed [%d] %s\n", errno, strerror(errno)); | ||
} | ||
} else { | ||
#ifdef HAVE_PTHREAD_JIT_WRITE_PROTECT_NP | ||
if (zend_write_protect) { | ||
pthread_jit_write_protect_np(1); | ||
} | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the both new identical chunks may be merged above.
for cases when shared segments switch b/w R/W/X and R/X bits.
6735ac4
to
5842ce5
Compare
for cases when shared segments switch b/w R/W/X and R/X bits.