Bug 1035704 - valgrind doesn't handle Haswell xabort instruction
Summary: valgrind doesn't handle Haswell xabort instruction
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: valgrind
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Mark Wielaard
QA Contact: Miroslav Franc
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-28 10:18 UTC by Mark Wielaard
Modified: 2016-02-01 02:28 UTC (History)
4 users (show)

Fixed In Version: valgrind-3.9.0-2.2.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 12:49:01 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
KDE Software Compilation 328100 0 None None None Never

Description Mark Wielaard 2013-11-28 10:18:40 UTC
Take the following program:

// gcc -g -Wall -mrtm -o rtm-test rtm-test.c

#include <immintrin.h>
#include <stdio.h>

int
main (int argc, char **argv)
{
  unsigned status;

  if ((status = _xbegin ()) == _XBEGIN_STARTED)
    {
      // Note that under valgrind the transaction will never start.
      // We will jump right into the fallback path.
      printf ("transaction started: %u\n", status);
      _xend ();
    }
  else
    {
      printf ("fallback path: %u\n", status);

      // xtest should tell us no transaction is currently active.
      printf ("xtest: %u\n", _xtest ());
    }
  printf ("transaction done: %u\n", status);

  // Aborting a non-existing transaction is just a NOP.
  _xabort (1);

  // Still no transaction active.
  printf ("xtest: %u\n", _xtest ());

  return 0;
}

$ gcc -g -Wall -mrtm -o rtm-test rtm-test.c
$ valgrind ./rtm-test

==14425== Command: ./rtm-test
==14425== 
fallback path: 8
xtest: 0
transaction done: 8
vex amd64->IR: unhandled instruction bytes: 0xC6 0xF8 0x1 0xF 0x1 0xD6 0xF 0x95
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=NONE
vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=0
==14425== valgrind: Unrecognised instruction at address 0x4005ae.
==14425==    at 0x4005AE: main (rtm-test.c:28)

That is the xabort.

Expected output:

==14468== Memcheck, a memory error detector
==14468== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==14468== Using Valgrind-3.9.0.SVN and LibVEX; rerun with -h for copyright info
==14468== Command: ./rtm-test
==14468== 
fallback path: 8
xtest: 0
transaction done: 8
xtest: 0
==14468== 
==14468== HEAP SUMMARY:
==14468==     in use at exit: 0 bytes in 0 blocks
==14468==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==14468== 
==14468== All heap blocks were freed -- no leaks are possible
==14468== 
==14468== For counts of detected and suppressed errors, rerun with: -v
==14468== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

There is a proposed upstream patch in the upstream bug tracker:
https://bugs.kde.org/show_bug.cgi?id=328100

Comment 4 Ludek Smid 2014-06-13 12:49:01 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


Note You need to log in before you can comment on or make changes to this bug.