Skip to content

opcache JIT support improvements attempts on macOs.#8382

Closed
devnexen wants to merge 1 commit into
php:masterfrom
devnexen:macos_opcache_jit_protect_flags_fix_attempt
Closed

opcache JIT support improvements attempts on macOs.#8382
devnexen wants to merge 1 commit into
php:masterfrom
devnexen:macos_opcache_jit_protect_flags_fix_attempt

Conversation

@devnexen

Copy link
Copy Markdown
Member

for cases when shared segments switch b/w R/W/X and R/X bits.

@devnexen devnexen force-pushed the macos_opcache_jit_protect_flags_fix_attempt branch 5 times, most recently from 036c348 to 17d924a Compare April 16, 2022 10:36
@devnexen devnexen marked this pull request as ready for review April 16, 2022 11:18
@ramsey ramsey added this to the PHP 8.2 milestone May 22, 2022
@devnexen devnexen requested a review from dstogov July 19, 2022 03:18
Comment thread ext/opcache/jit/zend_jit.c Outdated
Comment on lines 4617 to 4618

Copy link
Copy Markdown
Member

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

Comment thread ext/opcache/jit/zend_jit.c Outdated
Comment on lines 4919 to 4918

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This denies execution.

@devnexen devnexen force-pushed the macos_opcache_jit_protect_flags_fix_attempt branch from 17d924a to 6735ac4 Compare July 19, 2022 07:14

@dstogov dstogov left a comment

Copy link
Copy Markdown
Member

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.

Comment thread ext/opcache/jit/zend_jit.c Outdated
Comment on lines 4647 to 4648

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alignment

Comment thread ext/opcache/jit/zend_jit.c Outdated
Comment on lines 4915 to 4928

Copy link
Copy Markdown
Member

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.
@devnexen devnexen force-pushed the macos_opcache_jit_protect_flags_fix_attempt branch from 6735ac4 to 5842ce5 Compare July 19, 2022 07:42
@devnexen devnexen closed this in 1416961 Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants