trap and emulate cpuid, disabling rdrand and rdseed#3619
trap and emulate cpuid, disabling rdrand and rdseed#3619sporksmith merged 14 commits intoshadow:mainfrom
Conversation
trinity-1686a
left a comment
There was a problem hiding this comment.
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! |
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.