Skip to content

Fix dynamic code loading operations - #75

Merged
slipher merged 6 commits into
masterfrom
slipher/dynamicload
Oct 7, 2026
Merged

slipher merged 6 commits into
masterfrom
slipher/dynamicload

Conversation

@slipher

@slipher slipher commented Oct 6, 2026

Copy link
Copy Markdown
Member

Fix the dyncode syscalls, which permit implementation of JIT compilation in an NaCl app, on Rosetta. Also fix an instruction cache clearing bug in one of these which would affect ARM.

We don't need this dynamic code feature; in fact I think I will disable it for Daemon (there is an env var to do that), since we don't need JIT and that just makes more potential holes in the sandbox. But I want the tests to pass at least.

Check in NaCl object files built from the assembly "template" files
using a non-Saigo toolchain. This lets run_dynamic_modify_test work,
which I want for attempting a fix for this feature on Mac.
__builtin___clear_cache can now be used on Mac.
guest_addr was the in-sandbox address of the code but it needs to be
the real system mapped-as-executable address.
Once some thread has started executing code on a page, Rosetta apparently
assumes that the code will not be modified until the PROT_EXEC bit is
removed. The dyncode syscalls violate that assumption

Caveat: dyncode_modify does not sync threads so this means PROT_EXEC
can be toggled for code in use, which might make it crash (not tested).
@slipher slipher changed the title Slipher/dynamicload Fix dynamic code loading operations Oct 6, 2026

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

Thanks a lot! LGTM.

@slipher
slipher merged commit ab09db9 into master Oct 7, 2026
8 checks passed
@slipher
slipher deleted the slipher/dynamicload branch October 7, 2026 03:56
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