diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c index 47a99ea52..34ebcbdf9 100644 --- a/VEX/priv/guest_amd64_toIR.c +++ b/VEX/priv/guest_amd64_toIR.c @@ -22079,12 +22079,8 @@ Long dis_ESC_0F ( if (fAddr == &amd64g_dirtyhelper_CPUID_avx2 || fAddr == &amd64g_dirtyhelper_CPUID_avx_and_cx16) { Bool hasF16C = (archinfo->hwcaps & VEX_HWCAPS_AMD64_F16C) != 0; - /* A deterministic RNG still serves RDRAND/RDSEED but hides them. */ - Bool advertiseRng = vex_random32 == NULL; - Bool hasRDRAND = advertiseRng - && (archinfo->hwcaps & VEX_HWCAPS_AMD64_RDRAND) != 0; - Bool hasRDSEED = advertiseRng - && (archinfo->hwcaps & VEX_HWCAPS_AMD64_RDSEED) != 0; + Bool hasRDRAND = (archinfo->hwcaps & VEX_HWCAPS_AMD64_RDRAND) != 0; + Bool hasRDSEED = (archinfo->hwcaps & VEX_HWCAPS_AMD64_RDSEED) != 0; args = mkIRExprVec_4(IRExpr_GSPTR(), mkIRExpr_HWord(hasF16C ? 1 : 0), mkIRExpr_HWord(hasRDRAND ? 1 : 0), diff --git a/VEX/pub/libvex.h b/VEX/pub/libvex.h index 1149038d0..564fe941d 100644 --- a/VEX/pub/libvex.h +++ b/VEX/pub/libvex.h @@ -689,8 +689,7 @@ extern void LibVEX_Init ( ); /* Install before guest execution. NULL preserves host RDRAND/RDSEED. - Otherwise CPUID hides them, and they return bits from this callback, - which runs on the executing guest thread. */ + The callback runs on the executing guest thread and returns 32 random bits. */ extern void LibVEX_SetRandom32 ( UInt (*random32)(void) ); diff --git a/docs/xml/manual-core.xml b/docs/xml/manual-core.xml index e7b97474b..d82bea4b8 100644 --- a/docs/xml/manual-core.xml +++ b/docs/xml/manual-core.xml @@ -810,11 +810,10 @@ in most cases. We group the available options by rough categories. /dev/random and /dev/urandom (resolved through /proc/self/fd, so - symlinks count). On amd64, CPUID does not report - RDRAND and - RDSEED. On hosts that support them, - programs that execute them anyway draw from the calling thread's PRNG - stream, which always reports success. On arm64, + symlinks count). On amd64, RDRAND + and RDSEED draw from the calling + thread's PRNG stream and always report success. CPUID still + reports them only when the host supports them. On arm64, RNDR and RNDRRS draw from the same stream and always report success, also on hosts without FEAT_RNG. diff --git a/none/tests/amd64/deterministic_rng.stdout.exp b/none/tests/amd64/deterministic_rng.stdout.exp index a462030cb..cb97b860b 100644 --- a/none/tests/amd64/deterministic_rng.stdout.exp +++ b/none/tests/amd64/deterministic_rng.stdout.exp @@ -1,5 +1,5 @@ -cpuid rdrand: 0 -cpuid rdseed: 0 +cpuid rdrand: 1 +cpuid rdseed: 1 rdrand16: 555555555555d78e rdrand16: 555555555555b519 rdrand32: 00000000131a7a6b