From 0d4d18b277398876e54ec777b407bd413ddb3a78 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Jul 27 2020 22:19:55 +0000 Subject: Add valgrind-3.16.1-REX-prefix-JMP.patch --- diff --git a/valgrind-3.16.1-REX-prefix-JMP.patch b/valgrind-3.16.1-REX-prefix-JMP.patch new file mode 100644 index 0000000..f780fb1 --- /dev/null +++ b/valgrind-3.16.1-REX-prefix-JMP.patch @@ -0,0 +1,38 @@ +commit e2dec0ff9b1e071779bee2c4e6fc82f8194b1c1d +Author: Mark Wielaard +Date: Sun Jul 26 21:17:23 2020 +0200 + + Handle REX prefixed JMP instruction. + + The NET Core runtime might generate a JMP with a REX prefix. + For Jv (32bit offset) and Jb (8bit offset) this is valid. + Prefixes that change operand size are ignored for such JMPs. + So remove the check for sz == 4 and force sz = 4 for Jv. + + https://bugs.kde.org/show_bug.cgi?id=422174 + +diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c +index fadf47d41..7888132eb 100644 +--- a/VEX/priv/guest_amd64_toIR.c ++++ b/VEX/priv/guest_amd64_toIR.c +@@ -21392,8 +21392,8 @@ Long dis_ESC_NONE ( + + case 0xE9: /* Jv (jump, 16/32 offset) */ + if (haveF3(pfx)) goto decode_failure; +- if (sz != 4) +- goto decode_failure; /* JRS added 2004 July 11 */ ++ sz = 4; /* Prefixes that change operand size are ignored for this ++ instruction. Operand size is forced to 32bit. */ + if (haveF2(pfx)) DIP("bnd ; "); /* MPX bnd prefix. */ + d64 = (guest_RIP_bbstart+delta+sz) + getSDisp(sz,delta); + delta += sz; +@@ -21404,8 +21404,7 @@ Long dis_ESC_NONE ( + + case 0xEB: /* Jb (jump, byte offset) */ + if (haveF3(pfx)) goto decode_failure; +- if (sz != 4) +- goto decode_failure; /* JRS added 2004 July 11 */ ++ /* Prefixes that change operand size are ignored for this instruction. */ + if (haveF2(pfx)) DIP("bnd ; "); /* MPX bnd prefix. */ + d64 = (guest_RIP_bbstart+delta+1) + getSDisp8(delta); + delta++; diff --git a/valgrind.spec b/valgrind.spec index 40ad728..141f77f 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -93,6 +93,9 @@ Patch5: valgrind-3.16.0-some-stack-protector.patch # Add some -Wl,z,now. Patch6: valgrind-3.16.0-some-Wl-z-now.patch +# KDE#422174 unhandled instruction bytes: 0x48 0xE9 (REX prefix JMP instr) +Patch7: valgrind-3.16.1-REX-prefix-JMP.patch + BuildRequires: glibc-devel %if %{build_openmpi} @@ -224,6 +227,8 @@ Valgrind User Manual for details. %patch6 -p1 %endif +%patch7 -p1 + %build # LTO triggers undefined symbols in valgrind. Valgrind has a --enable-lto # configure time option, but that doesn't seem to help. @@ -447,6 +452,9 @@ fi %endif %changelog +* Mon Jul 27 2020 Mark Wielaard +- Add valgrind-3.16.1-REX-prefix-JMP.patch + * Tue Jul 14 2020 Tom Stellard - 3.16.1-3 - Use make macros - https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro