Skip to content

Fix JIT page protection errors being ignored - #359

Merged
SChernykh merged 1 commit into
tevador:masterfrom
thomasbuilds:fix-jit-page-protection
Oct 16, 2026
Merged

SChernykh merged 1 commit into
tevador:masterfrom
thomasbuilds:fix-jit-page-protection

Conversation

@thomasbuilds

Copy link
Copy Markdown
Contributor

Since #241 moved virtual_memory to C, setPagesRW, setPagesRX and setPagesRWX ignore the result of mprotect/VirtualProtect. On systems that don't allow executable JIT pages, for example with systemd's MemoryDenyWriteExecute=yes (monero-project/monero#10180) or Windows' Arbitrary Code Guard, randomx_alloc_cache and randomx_create_vm succeed and the first dataset initialization or hash crashes, instead of returning NULL as documented.

This returns the pageProtect result from these functions and throws in the JIT compilers when it fails, like the allocMemoryPages check. The secure VM constructor and randomx_alloc_cache make the JIT buffer executable once, so randomx_create_vm and randomx_alloc_cache return NULL on such systems.

@SChernykh
SChernykh merged commit c1811ac into tevador:master Oct 16, 2026
8 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants