Bug 1087933 - Valgrind does not recognize bndmov instruction
Summary: Valgrind does not recognize bndmov instruction
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: valgrind
Version: rawhide
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1086986 1091056 (view as bug list)
Depends On:
Blocks: 1147137
TreeView+ depends on / blocked
 
Reported: 2014-04-15 15:46 UTC by Paulo Andrade
Modified: 2014-09-27 09:54 UTC (History)
9 users (show)

Fixed In Version: valgrind-3.9.0-12.svn20140319r13879.fc21.src.rpm
Clone Of:
: 1147137 (view as bug list)
Environment:
Last Closed: 2014-05-08 16:05:42 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


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

Description Paulo Andrade 2014-04-15 15:46:29 UTC
Rawhide updated as of yesterday:

vex amd64->IR: unhandled instruction bytes: 0x66 0xF 0x1B 0x4 0x24 0x66 0xF 0x1B
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=1 PFX.F2=0 PFX.F3=0
==25224== valgrind: Unrecognised instruction at address 0x3e50c17387.
==25224==    at 0x3E50C17387: _dl_runtime_resolve (in /usr/lib64/ld-2.19.90.so)


0000003e50c17360 <_dl_runtime_resolve>:
  3e50c17360:   48 83 ec 78             sub    $0x78,%rsp
  3e50c17364:   48 89 44 24 40          mov    %rax,0x40(%rsp)
  3e50c17369:   48 89 4c 24 48          mov    %rcx,0x48(%rsp)
  3e50c1736e:   48 89 54 24 50          mov    %rdx,0x50(%rsp)
  3e50c17373:   48 89 74 24 58          mov    %rsi,0x58(%rsp)
  3e50c17378:   48 89 7c 24 60          mov    %rdi,0x60(%rsp)
  3e50c1737d:   4c 89 44 24 68          mov    %r8,0x68(%rsp)
  3e50c17382:   4c 89 4c 24 70          mov    %r9,0x70(%rsp)
  3e50c17387:   66 0f 1b 04 24          bndmov %bnd0,(%rsp)                <-- here
  3e50c1738c:   66 0f 1b 4c 24 10       bndmov %bnd1,0x10(%rsp)
  3e50c17392:   66 0f 1b 54 24 20       bndmov %bnd2,0x20(%rsp)
  3e50c17398:   66 0f 1b 5c 24 30       bndmov %bnd3,0x30(%rsp)

Comment 1 Mark Wielaard 2014-04-20 19:59:50 UTC
Confirmed. With vgdb attached and glibc-debuginfo installed:

Program received signal SIGILL, Illegal instruction.
_dl_runtime_resolve () at ../sysdeps/x86_64/dl-trampoline.S:72
72              bndmov %bnd0, REGISTER_SAVE_BND0(%rsp)

(gdb) list
67              movq %r9, REGISTER_SAVE_R9(%rsp)
68      #ifndef __ILP32__
69              # We also have to preserve bound registers.  These are nops if
70              # Intel MPX isn't available or disabled.
71      # ifdef HAVE_MPX_SUPPORT
72              bndmov %bnd0, REGISTER_SAVE_BND0(%rsp)
73              bndmov %bnd1, REGISTER_SAVE_BND1(%rsp)
74              bndmov %bnd2, REGISTER_SAVE_BND2(%rsp)
75              bndmov %bnd3, REGISTER_SAVE_BND3(%rsp)
76      # else
(gdb) 
77              .byte 0x66,0x0f,0x1b,0x44,0x24,REGISTER_SAVE_BND0
78              .byte 0x66,0x0f,0x1b,0x4c,0x24,REGISTER_SAVE_BND1
79              .byte 0x66,0x0f,0x1b,0x54,0x24,REGISTER_SAVE_BND2
80              .byte 0x66,0x0f,0x1b,0x5c,0x24,REGISTER_SAVE_BND3
81      # endif
82      #endif
83              # Copy args pushed by PLT in register.
84              # %rdi: link_map, %rsi: reloc_index
85              movq (REGISTER_SAVE_AREA + 8)(%rsp), %rsi
86              movq REGISTER_SAVE_AREA(%rsp), %rdi
(gdb) 

So in theory this should be easy to implement assuming we can just make bndmov into a NOP for valgrind.

Comment 2 Mark Wielaard 2014-04-20 20:28:20 UTC
Reported upstream https://bugs.kde.org/show_bug.cgi?id=333666

Comment 3 Mark Wielaard 2014-04-24 18:16:39 UTC
*** Bug 1091056 has been marked as a duplicate of this bug. ***

Comment 4 Mark Wielaard 2014-04-27 10:35:03 UTC
*** Bug 1086986 has been marked as a duplicate of this bug. ***

Comment 5 Mark Wielaard 2014-05-08 16:05:42 UTC
I submitted a fix upsteam and included it in the new valgrind-3.9.0-12.svn20140319r13879.fc21

Comment 6 Kalev Lember 2014-05-08 16:11:53 UTC
You are a hero, thanks!


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