https://bugs.kde.org/show_bug.cgi?id=379525
Bug ID: 379525
Summary: Support more x86 nop opcodes
Product: valgrind
Version: 3.13 SVN
Platform: unspecified
OS: Linux
Status: UNCONFIRMED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
For x86, the follow opcodes are NOP with a register or memory operand,
which can take regular prefixes:
0f 19
0f 1c
0f 1d
0f 1e
0f 1f
[hjl@gnu-6 tmp]$ cat x.c
#include <stdio.h>
int main ()
{
asm (".byte 0x67, 0xf2, 0xf3, 0x66, 0x0f, 0x19, 0x44, 0x0, 0x0");
asm (".byte 0x67, 0xf2, 0xf3, 0x66, 0x0f, 0x1c, 0x44, 0x0, 0x0");
asm (".byte 0x67, 0xf2, 0xf3, 0x66, 0x0f, 0x1d, 0x44, 0x0, 0x0");
asm (".byte 0x67, 0xf2, 0xf3, 0x66, 0x0f, 0x1e, 0x44, 0x0, 0x0");
asm (".byte 0x67, 0xf2, 0xf3, 0x66, 0x0f, 0x1f, 0x44, 0x0, 0x0");
printf ("hello\n");
return 0;
}
[hjl@gnu-6 tmp]$ gcc x.c
[hjl@gnu-6 tmp]$
(gdb) r
Starting program: /tmp/a.out
Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.24-5.3.fc25.x86_64
hello
[Inferior 1 (process 26135) exited normally]
(gdb) disass/r main
Dump of assembler code for function main:
0x00000000004004f6 <+0>: 55 push %rbp
0x00000000004004f7 <+1>: 48 89 e5 mov %rsp,%rbp
0x00000000004004fa <+4>: 67 f2 f3 66 0f 19 44 00 00 repnz repz nopw
0x0(%eax,%eax,1)
0x0000000000400503 <+13>: 67 f2 f3 66 0f 1c 44 00 00 repnz repz nopw
0x0(%eax,%eax,1)
0x000000000040050c <+22>: 67 f2 f3 66 0f 1d 44 00 00 repnz repz nopw
0x0(%eax,%eax,1)
0x0000000000400515 <+31>: 67 f2 f3 66 0f 1e 44 00 00 repnz repz nopw
0x0(%eax,%eax,1)
0x000000000040051e <+40>: 67 f2 f3 66 0f 1f 44 00 00 repnz repz nopw
0x0(%eax,%eax,1)
0x0000000000400527 <+49>: bf d0 05 40 00 mov $0x4005d0,%edi
0x000000000040052c <+54>: e8 bf fe ff ff callq 0x4003f0 <puts@plt>
0x0000000000400531 <+59>: b8 00 00 00 00 mov $0x0,%eax
0x0000000000400536 <+64>: 5d pop %rbp
0x0000000000400537 <+65>: c3 retq
End of assembler dump.
(gdb)
[hjl@gnu-6 tmp]$ valgrind ./a.out
==26187== Memcheck, a memory error detector
==26187== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==26187== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==26187== Command: ./a.out
==26187==
vex amd64->IR: unhandled instruction bytes: 0x67 0xF2 0xF3 0x66 0xF 0x19 0x44
0x0 0x0 0x67
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=1 PFX.F2=1 PFX.F3=1
==26187== valgrind: Unrecognised instruction at address 0x4004fa.
==26187== at 0x4004FA: main (in /tmp/a.out)
==26187== Your program just tried to execute an instruction that Valgrind
==26187== did not recognise. There are two possible reasons for this.
==26187== 1. Your program has a bug and erroneously jumped to a non-code
==26187== location. If you are running Memcheck and you just saw a
==26187== warning about a bad jump, it's probably your program's fault.
==26187== 2. The instruction is legitimate but Valgrind doesn't handle it,
==26187== i.e. it's Valgrind's fault. If you think this is the case or
==26187== you are not sure, please let us know and we'll try to fix it.
==26187== Either way, Valgrind will now raise a SIGILL signal which will
==26187== probably kill your program.
==26187==
==26187== Process terminating with default action of signal 4 (SIGILL)
==26187== Illegal opcode at address 0x4004FA
==26187== at 0x4004FA: main (in /tmp/a.out)
==26187==
==26187== HEAP SUMMARY:
==26187== in use at exit: 0 bytes in 0 blocks
==26187== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==26187==
==26187== All heap blocks were freed -- no leaks are possible
==26187==
==26187== For counts of detected and suppressed errors, rerun with: -v
==26187== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Illegal instruction
[hjl@gnu-6 tmp]$
--
You are receiving this mail because:
You are watching all bug changes.