Skip to content

cpu: x64: drop write permissions after JIT complete - #5690

Open
thiagomacieira wants to merge 1 commit into
uxlfoundation:mainfrom
thiagomacieira:cpu_x64_drop_write_permissions_after_JIT_complete
Open

cpu: x64: drop write permissions after JIT complete#5690
thiagomacieira wants to merge 1 commit into
uxlfoundation:mainfrom
thiagomacieira:cpu_x64_drop_write_permissions_after_JIT_complete

Conversation

@thiagomacieira

Copy link
Copy Markdown
Contributor

Xbyak::CodeGenerator allocates RW pages for us when used in AutoGrow mode (good). Since we don't need to write to the JIT'ted content after we've finished our initial pass, we can drop the PROT_WRITE permissions and retain only Read-Execute. This is required in some locked down systems that forbid RWX for security reasons.

Checklist

General

  • Do all unit and benchdnn tests (make test and make test_benchdnn_*) pass locally for each commit?

There are no new failures. Before and after:

29% tests passed, 68 tests failed out of 96
  • Have you formatted the code using clang-format?

Performance improvements

  • Have you submitted performance data that demonstrates performance improvements?

Bug fixes

  • Have you included information on how to reproduce the issue (either in a github issue or in this PR)?
  • Have you added relevant regression tests?

This is not easy to unit-test. I caught this when intercepting mmap() and mprotect() when the protection arguments had PROT_WRITE|PROT_EXEC.

`Xbyak::CodeGenerator` allocates RW pages for us when used in AutoGrow
mode (good). Since we don't need to write to the JIT'ted content after
we've finished our initial pass, we can drop the `PROT_WRITE`
permissions and retain only Read-Execute. This is required in some
locked down systems that forbid RWX for security reasons.
@thiagomacieira
thiagomacieira requested a review from a team as a code owner July 27, 2026 17:24
@github-actions github-actions Bot added the platform:cpu-x64 Intel64/AMD64 processors. Codeowner: @oneapi-src/onednn-cpu-x64 label Jul 27, 2026

@densamoilov densamoilov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform:cpu-x64 Intel64/AMD64 processors. Codeowner: @oneapi-src/onednn-cpu-x64

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants