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

Conversation

devnexen
Copy link
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.
Copy link
Member

@cmb69 cmb69 left a comment

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.

Copy link
Member

@dstogov dstogov left a comment

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
Member Author

@jdp1024 would the new changes work for you ?

@jdp1024
Copy link

jdp1024 commented Aug 24, 2022

@jdp1024 would the new changes work for you ?

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

@devnexen
Copy link
Member Author

devnexen commented Aug 24, 2022

Ok thx, I m going to put those back.

Could you try again once you get a chance pls ?

@jdp1024
Copy link

jdp1024 commented Aug 24, 2022

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
Member Author

Ok waiting for @dstogov approval.

@dstogov
Copy link
Member

dstogov commented Aug 24, 2022

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

Does PHP work without the patch (with returns)?

@jdp1024
Copy link

jdp1024 commented Aug 24, 2022

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.

Copy link
Member

@dstogov dstogov left a comment

Choose a reason for hiding this comment

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

OK. Merge this.

@devnexen devnexen closed this in e787d9a Aug 24, 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.

4 participants