-
Notifications
You must be signed in to change notification settings - Fork 261
trap and emulate cpuid, disabling rdrand and rdseed #3619
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
Conversation
trinity-1686a
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like if a tested program does syscall(SYS_arch_prctl, ARCH_SET_CPUID, 1);, CPUID isn't intercepted (on Intel). This syscall should probably be intercepted, logged, and maybe ignored?
Ooh, good catch. Yeah I'll add a handler for that. |
4ded682 to
947d1fa
Compare
|
(I'm running PETS 2025 next week, so I don't think I'll be able to get to this for a bit. Hope that's OK!) |
No problem. Using this fix locally (to debug a flaky arti test) is good enough for me for the moment :) Have a good PETS! |
stevenengler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! LGTM!
This is in preparation to widen the scope of this module to include other asm utilities (for cpuid).
In preparation to expand this to include cpuid emulation.
This was incorrectly checking the mode instead of the flags to test whether the file was being opened read-only.
Workaround for shadow#3626
This drops some testing that was orthogonal to determinism, including trying to open files with multiple libc APIs and reverse DNS lookups.
Occasionally having a different-length name here results in different read-amounts in strace logs for programs that read `/proc/self/maps`, which includes all rust programs during the runtime initialization.
tor_llcrypto::rng::CautionRng(which usesrdrandwhen its available) is deterministic under shadow, on platforms where trapping the cpuid instruction is supported.Fixes #1561 and #3610.