Bug 1087933

Summary: Valgrind does not recognize bndmov instruction
Product: [Fedora] Fedora Reporter: Paulo Andrade <paulo.cesar.pereira.de.andrade>
Component: valgrindAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: abeekhof, dodji, jakub, kalevlember, matteo, mjw, mjw, redhat-bugzilla, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: valgrind-3.9.0-12.svn20140319r13879.fc21.src.rpm Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1147137 (view as bug list) Environment:
Last Closed: 2014-05-08 16:05:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1147137    

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!