Repository navigation
feat(vex): serve arm64 RNDR and RNDRRS with --deterministic-rng - #56
Open
not-matthias wants to merge 1 commit into
Open
not-matthias wants to merge 1 commit into
not-matthias wants to merge 1 commit into
Conversation
Decode MRS RNDR and RNDRRS (FEAT_RNG). With --deterministic-rng they draw 64 bits from the calling thread's PRNG stream and always report success (NZCV=0000), also on hosts without FEAT_RNG. Otherwise the host register is read and its NZCV is passed through. FEAT_RNG is advertised to the client only when the host has it: AT_HWCAP2 now keeps HWCAP2_RNG instead of being dropped, and the emulated ID_AA64ISAR0_EL1 keeps the RNDR field. Refs COD-4061
Merging this PR will not alter performance
Comparing Footnotes
|
not-matthias
marked this pull request as ready for review
October 30, 2026 09:24
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryAdds ARM64
No actionable issues found. Review used code inspection; no tests were run.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Decode
MRS Xt, RNDRandMRS Xt, RNDRRS(FEAT_RNG) on arm64. With--deterministic-rng=yes, both draw 64 bits from the calling thread's PRNG stream and always succeed (NZCV=0000), like RDRAND/RDSEED on amd64. Without the option, the host register is read and its NZCV is passed through.Before this change, VEX did not decode these registers, so a program that executed RNDR without checking for FEAT_RNG got SIGILL. Programs that check fell back to
getrandom, because Valgrind droppedAT_HWCAP2and masked the RNDR field ofID_AA64ISAR0_EL1.Changes:
AT_HWCAP2now passes throughHWCAP2_RNG(all other bits are still cleared), and the emulatedID_AA64ISAR0_EL1keeps the RNDR field. This keeps client code paths the same as a native run on the same host.--helpline now says "hardware RNG insns" instead of "RDRAND/RDSEED";cmdline1/cmdline2expectations are updated.Verified on a
ubuntu-24.04-armGitHub runner without FEAT_RNG:none/tests/arm64/deterministic_rng,cmdline1andcmdline2pass. The host-passthrough path (host with FEAT_RNG, no--deterministic-rng) has not been run on hardware.Closes COD-4061