Skip to content

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

Closed
devnexen wants to merge 2 commits into
php:masterfrom
devnexen:gh9370_bug_fix
Closed

GH-9370: Fix opcache jit protection bits.#9371
devnexen wants to merge 2 commits into
php:masterfrom
devnexen:gh9370_bug_fix

Conversation

@devnexen

Copy link
Copy Markdown
Member

Allow mprotect to occur, pthread_jit_write_np are just to allow mprotect
flags to be used.

Allow mprotect to occur, pthread_jit_write_np are just to allow mprotect
 flags to be used.

@cmb69 cmb69 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.

Thank you! Looks good to me.

@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 cannot test this, but according to https://keith.github.io/xcode-man-pages/pthread_jit_write_protect_np.3.html pthread_jit_write_protect_np() should work without mprotect().

May be mprotect() is necessary, because we used it before in zend_accel_shared_protect(). Also note that we seem don't use MAP_JIT flag and this may make difference.

@devnexen

Copy link
Copy Markdown
Member Author

@jdp1024 would the new changes work for you ?

@jdp1024

jdp1024 commented Aug 24, 2022

Copy link
Copy Markdown

@jdp1024 would the new changes work for you ?

It doesn't work in M1. Call to mprotect seems necessary.

@devnexen

devnexen commented Aug 24, 2022

Copy link
Copy Markdown
Member Author

Ok thx, I m going to put those back.

Could you try again once you get a chance pls ?

@jdp1024

jdp1024 commented Aug 24, 2022

Copy link
Copy Markdown

Ok thx, I m going to put those back.

Could you try again once you get a chance pls ?

mmap() with MAP_JIT along with the removal of two returns worked.

@devnexen

Copy link
Copy Markdown
Member Author

Ok waiting for @dstogov approval.

@dstogov

dstogov commented Aug 24, 2022

Copy link
Copy Markdown
Member

mmap() with MAP_JIT along with the removal of two returns worked.

Does PHP work without the patch (with returns)?

@jdp1024

jdp1024 commented Aug 24, 2022

Copy link
Copy Markdown

mmap() with MAP_JIT along with the removal of two returns worked.

Does PHP work without the patch (with returns)?

It works after the removal of the two returns (without MAP_JIT).

It does not work with MAP_JIT while keeping the two returns.

So it seems that the mprotect calls are necessary in M1 machines.

@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.

OK. Merge this.

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.

4 participants