Bug 396220

Summary: vex x86->IR: unhandled instruction bytes: 0xC4 0xE2 0x41 0xF7
Product: [Developer tools] valgrind Reporter: John F.X. Galea <johncesco>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: tom
Priority: NOR    
Version First Reported In: 3.13.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description John F.X. Galea 2018-07-05 19:46:19 UTC
Hi, I am trying to run Valgrind on SPEC CPU benchmark, and encountered the following error:

Essentially, Valgrind aborted with the following error:

vex x86->IR: unhandled instruction bytes: 0xC4 0xE2 0x41 0xF7

I'd be happy to check a patch when available to confirm a fix.

1530817135.71: ==27439== Nulgrind, the minimal Valgrind tool
1530817135.71: ==27439== Copyright (C) 2002-2017, and GNU GPL'd, by Nicholas Nethercote.
1530817135.71: ==27439== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
1530817135.71: ==27439== Command: ../run_base_refrate_mytest-m32.0003/perlbench_r_base.mytest-m32 -I./lib checkspam.pl 2500 5 25 11 150 1 1 1 1
1530817135.71: ==27439==
1530817135.71: vex x86->IR: unhandled instruction bytes: 0xC4 0xE2 0x41 0xF7
1530817135.71: ==27439== valgrind: Unrecognised instruction at address 0x81521dd.
1530817135.71: ==27439==    at 0x81521DD: Perl_sv_upgrade (sv.c:1522)
1530817135.71: ==27439==    by 0x815676F: Perl_sv_setpvn (sv.c:4927)
1530817135.71: ==27439==    by 0x81577F7: Perl_newSVpvn (sv.c:9202)
1530817135.71: ==27439==    by 0x80A756B: perl_construct (perl.c:249)
1530817135.71: ==27439==    by 0x804ADDD: main (perlmain.c:114)
1530817135.71: ==27439== Your program just tried to execute an instruction that Valgrind
1530817135.71: ==27439== did not recognise.  There are two possible reasons for this.
1530817135.71: ==27439== 1. Your program has a bug and erroneously jumped to a non-code
1530817135.71: ==27439==    location.  If you are running Memcheck and you just saw a
1530817135.71: ==27439==    warning about a bad jump, it's probably your program's fault.
1530817135.71: ==27439== 2. The instruction is legitimate but Valgrind doesn't handle it,
1530817135.71: ==27439==    i.e. it's Valgrind's fault.  If you think this is the case or
1530817135.71: ==27439==    you are not sure, please let us know and we'll try to fix it.
1530817135.71: ==27439== Either way, Valgrind will now raise a SIGILL signal which will
1530817135.71: ==27439== probably kill your program.
1530817135.71: ==27439==
1530817135.71: ==27439== Process terminating with default action of signal 4 (SIGILL)
1530817135.71: ==27439==  Illegal opcode at address 0x81521DD
1530817135.71: ==27439==    at 0x81521DD: Perl_sv_upgrade (sv.c:1522)
1530817135.71: ==27439==    by 0x815676F: Perl_sv_setpvn (sv.c:4927)
1530817135.71: ==27439==    by 0x81577F7: Perl_newSVpvn (sv.c:9202)
1530817135.71: ==27439==    by 0x80A756B: perl_construct (perl.c:249)
1530817135.71: ==27439==    by 0x804ADDD: main (perlmain.c:114)
Comment 1 John F.X. Galea 2018-07-05 19:51:44 UTC
The instruction in question is:

81521dd:       c4 e2 41 f7 c0          shlx   %edi,%eax,%eax
Comment 2 Tom Hughes 2018-07-05 19:55:48 UTC
VEX prefixed instructions, and recent additions to the instruction set in general, are not supported by the x86 backend and are unlikely ever to be.

They are generally supported by the amd64/x86_64 backend, so compile in 64 bit mode if you want to use them.