Valgrind fails on rdrand when the cpu supports it (haswell)

Bug #1501545 reported by Brandon Schaefer
58
This bug affects 12 people
Affects Status Importance Assigned to Milestone
valgrind (Ubuntu)
Fix Released
Medium
Unassigned
Xenial
Confirmed
Undecided
Unassigned
Yakkety
Fix Released
Undecided
Unassigned
Zesty
Fix Released
Medium
Unassigned

Bug Description

vex amd64->IR: unhandled instruction bytes: 0xF 0xC7 0xF0 0x89 0x6 0xF 0x42 0xC1
vex amd64->IR: REX=0 REX.W=0 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

opcode "rdrand %eax"

Need valgrind 1:3.11.0-1ubuntu1

How to reproduce (need haswell or a cpu that supports rdrand)
http://pastebin.ubuntu.com/12628142/
g++ -std=c++14 test.cpp -o test
valgrind ./test

Bug also needs to be filed upstream

Tags: wily
description: updated
description: updated
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

This upstream bug looks related (affecting rdrand) but the instruction bytes are different:

https://bugs.kde.org/show_bug.cgi?id=353370

no longer affects: valgrind
tags: added: wily
Changed in valgrind (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in valgrind (Ubuntu):
status: New → Confirmed
Revision history for this message
Adrien Béraud (wagaf) wrote :

I get the exact same error and bytes.
unhandled instruction bytes: 0xF 0xC7 0xF0 0x89 0x6 0xF 0x42 0xC1

It happens when using std::random_device with GCC 5.2 on willy.

It's weird GCC stopped using /dev/urandom, a very good randomness source that makes use of RDRAND

Revision history for this message
ccontard (ccontard) wrote :

I also get the same error on Ubuntu Wily + Valgrind 3.11 + g++ 5.2

vex amd64->IR: unhandled instruction bytes: 0xF 0xC7 0xF0 0x89 0x6 0xF 0x42 0xC1
vex amd64->IR: REX=0 REX.W=0 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
==13334== valgrind: Unrecognised instruction at address 0x510dec5.
==13334== at 0x510DEC5: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==13334== by 0x510E061: std::random_device::_M_getval() (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==13334== by 0x477C8D: std::random_device::operator()() (random.h:1619)

Revision history for this message
Martin Ritter (martin-ritter) wrote :

I can confirm the problem on 16.04 and I can also confirm that the patch posted in kde-bugs #353370 report seems to fix the issue (valgrind compiled from source with and without the patch)

Revision history for this message
Sage Weil (sage-newdream) wrote :

We are seeing this bug with valgrind 1:3.11.0-1ubuntu4.1 on 16.04 in our Ceph testing.

Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :

Installing valgrind 1:3.12.0~svn20160714-1ubuntu2 from yakkety onto my xenial machine seems to resolve the issue, too. But probably including the patch from https://bugs.kde.org/show_bug.cgi?id=353370#c9 will be easier than doing an update in xenial, right?

Revision history for this message
Matthias Klose (doko) wrote :

please could somebody confirm that backporting the patch for this issue solved the problem?

Changed in valgrind (Ubuntu Yakkety):
status: New → Fix Released
Changed in valgrind (Ubuntu Zesty):
status: Confirmed → Fix Released
Revision history for this message
Daniel Neugart (dn1212) wrote :

Hi Matthias,
I was affected by this bug and can confirm, that applying the linked patch fixes the issue on ubuntu 16.04 (Xenial Xerus) on a i7-6600U.

It would be nice if the patched could be backported to Xenial as it's tedious to recompile valgrind on every update to get it functional again.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in valgrind (Ubuntu Xenial):
status: New → Confirmed
Revision history for this message
Travis Mick (tmick0) wrote :

I just ran into this problem on xenial, but I wanted to inquire whether there is any plan to backport the patch before I try to compile it myself. Can we expect the fix in xenial any time soon?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.