Bug 358988

Summary: rdrand support missing: unhandled instruction bytes: 0x48 0xF 0xC7 0xF1 ...
Product: [Developer tools] valgrind Reporter: Daniel Bratell <bratell>
Component: vexAssignee: Julian Seward <jseward>
Status: RESOLVED DUPLICATE    
Severity: crash CC: tom
Priority: NOR    
Version: 3.11.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
URL: https://en.wikipedia.org/wiki/RdRand
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Daniel Bratell 2016-02-04 16:13:51 UTC
I tried to run valgrind 3.11 at chromium but its cryptolib, boringssl, uses the rdrand instruction so valgrind crashed with the output below:

vex amd64->IR: unhandled instruction bytes: 0x48 0xF 0xC7 0xF1 0x73 0x14 0x48 0x89
vex amd64->IR:   REX=1 REX.W=1 REX.R=0 REX.X=0 REX.B=0
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
==5304== valgrind: Unrecognised instruction at address 0xc62e5c.
==5304==    at 0xC62E5C: ??? (rdrand-x86_64.S:32)
==5304==    by 0xBDE6F7: RAND_bytes (rand.c:122)
==5304==    by 0xBEF4FB: SSL_CTX_new (ssl_lib.c:282)



Reproducible: Always

Steps to Reproduce:
1. Build Chromium with gyp flags "build_for_tool=memcheck"
2. Run valgrind out/Release/chromium http://youtube.com/tv/
3. See the message above.

I suspect there are much easier ways to reproduce. Maybe boringssl has some tools?

Actual Results:  
vex amd64->IR: unhandled instruction bytes: 0x48 0xF 0xC7 0xF1 0x73 0x14 0x48 0x89

Expected Results:  
The program should keep running.

In the wikipedia article for radrand ( https://en.wikipedia.org/wiki/RdRand ) it says that ". If supported, bit 30 of the ECX register is set after calling CPUID standard function 01H". I assume boringssl does that check, and that valgrind returns bit 30 set and if so, an alternative fix would be to clear that bit.
Comment 1 Tom Hughes 2016-02-04 16:34:28 UTC

*** This bug has been marked as a duplicate of bug 353370 ***