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

Bug #1501545 reported by Brandon Schaefer on 2015-09-30
56
This bug affects 12 people
Affects Status Importance Assigned to Milestone
valgrind (Ubuntu)
Medium
Unassigned
Xenial
Undecided
Unassigned
Yakkety
Undecided
Unassigned
Zesty
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

description: updated
description: updated
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
Launchpad Janitor (janitor) wrote :

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

Changed in valgrind (Ubuntu):
status: New → Confirmed
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

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)

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)

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.

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?

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
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.

Launchpad Janitor (janitor) wrote :

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

Changed in valgrind (Ubuntu Xenial):
status: New → Confirmed
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  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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