Both run OK outside of Valgrind. rdseed gives me paulf@freebsd:~/valgrind $ ./vg-in-place ./none/tests/amd64/rdseed ==78559== Memcheck, a memory error detector ==78559== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al. ==78559== Using Valgrind-3.25.0.GIT and LibVEX; rerun with -h for copyright info ==78559== Command: ./none/tests/amd64/rdseed ==78559== vex amd64->IR: unhandled instruction bytes: 0x49 0xF 0xC7 0xFB 0x41 0xF 0x92 0xC4 0x4C 0x89 vex amd64->IR: REX=1 REX.W=1 REX.R=0 REX.X=0 REX.B=1 vex amd64->IR: VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=0F vex amd64->IR: PFX.66=0 PFX.F2=0 PFX.F3=0 That's this 2017c7: 49 0f c7 fb rdseedq %r11 and rdrand paulf@freebsd:~/valgrind $ ./vg-in-place ./none/tests/amd64/rdrand ==78572== Memcheck, a memory error detector ==78572== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al. ==78572== Using Valgrind-3.25.0.GIT and LibVEX; rerun with -h for copyright info ==78572== Command: ./none/tests/amd64/rdrand ==78572== vex amd64->IR: unhandled instruction bytes: 0x49 0xF 0xC7 0xF3 0x41 0xF 0x92 0xC4 0x4C 0x89 vex amd64->IR: REX=1 REX.W=1 REX.R=0 REX.X=0 REX.B=1 vex amd64->IR: VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=0F vex amd64->IR: PFX.66=0 PFX.F2=0 PFX.F3=0 That's 2017c7: 49 0f c7 f3 rdrandq %r11 My guess is that clang is emitting a slight variation of the opcode which VEX doesn't decode.
Linux / GCC generates the same opcode. So this is more likely to be related to something like Bool VG_(machine_get_hwcaps)( void )
This was on a VirtualBox instance. I hadn't realized just how bad the VB virtualization is on a modern amd64 PC. CPU flags in VB Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 cflsh mmx fxsr sse sse2 htt sse3 pclmulqdq ssse3 cx16 sse4_1 sse4_2 popcnt aes rdrnd syscall nx mmxext fxsr_opt rdtscp lm lahf_lm cmp_legacy cr8_legacy lzcnt sse4a misalignsse 3dnowprefetch And natively flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmuldq monitor ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw wdt topoext perfctr_core mwaitx cpb hw_pstate ssbd ibpb ibrs stibp fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves user_shstk avx_vnni avx512_bf16 clzero xsaveerptr rdpru wbnoinvd cppc overflow_recov succor smca sme That's less than half. In gdb I see that CPUID is not setting either rdrand or rdseed. If I set them in gdb then at least rdseed runs OK.
Closing this as it looks like a VB limitation.