diff options
Diffstat (limited to 'meta/recipes-devtools/valgrind/valgrind/0004-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch')
| -rw-r--r-- | meta/recipes-devtools/valgrind/valgrind/0004-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch | 137 | 
1 files changed, 0 insertions, 137 deletions
diff --git a/meta/recipes-devtools/valgrind/valgrind/0004-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch b/meta/recipes-devtools/valgrind/valgrind/0004-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch deleted file mode 100644 index 4e9185508a..0000000000 --- a/meta/recipes-devtools/valgrind/valgrind/0004-Bug-478624-Valgrind-incompatibility-with-binutils-2..patch +++ /dev/null  | |||
| @@ -1,137 +0,0 @@ | |||
| 1 | From 41ff9aa49f6c54c66d0e6b37f265fd9cb0176057 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Paul Floyd <pjfloyd@wanadoo.fr> | ||
| 3 | Date: Sun, 17 Dec 2023 14:18:51 +0100 | ||
| 4 | Subject: [PATCH 4/4] Bug 478624 - Valgrind incompatibility with binutils-2.42 | ||
| 5 | on x86 with new nop patterns (unhandled instruction bytes: 0x2E 0x8D 0xB4 | ||
| 6 | 0x26) | ||
| 7 | |||
| 8 | It was a bit of a struggle to get the testcase to build | ||
| 9 | with both clang and gcc (oddly enough gcc was more difficult) so | ||
| 10 | I just resorted to using .byte arrays. | ||
| 11 | |||
| 12 | (cherry picked from commit d35005cef8ad8207542738812705ceabf137d7e0) | ||
| 13 | |||
| 14 | Upstream-Status: Backport [https://sourceware.org/git/?p=valgrind.git;a=commit;h=41ff9aa49f6c54c66d0e6b37f265fd9cb0176057] | ||
| 15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 16 | --- | ||
| 17 | .gitignore | 1 + | ||
| 18 | NEWS | 2 ++ | ||
| 19 | VEX/priv/guest_x86_toIR.c | 22 +++++++++++++- | ||
| 20 | none/tests/x86/Makefile.am | 2 ++ | ||
| 21 | none/tests/x86/gnu_binutils_nop.c | 34 ++++++++++++++++++++++ | ||
| 22 | none/tests/x86/gnu_binutils_nop.stderr.exp | 0 | ||
| 23 | none/tests/x86/gnu_binutils_nop.vgtest | 2 ++ | ||
| 24 | 7 files changed, 62 insertions(+), 1 deletion(-) | ||
| 25 | create mode 100644 none/tests/x86/gnu_binutils_nop.c | ||
| 26 | create mode 100644 none/tests/x86/gnu_binutils_nop.stderr.exp | ||
| 27 | create mode 100644 none/tests/x86/gnu_binutils_nop.vgtest | ||
| 28 | |||
| 29 | --- a/NEWS | ||
| 30 | +++ b/NEWS | ||
| 31 | @@ -9,6 +9,8 @@ The following bugs have been fixed or re | ||
| 32 | file produced by mold | ||
| 33 | 476708 valgrind-monitor.py regular expressions should use raw strings | ||
| 34 | 477198 Add fchmodat2 syscall on linux | ||
| 35 | +478624 Valgrind incompatibility with binutils-2.42 on x86 with new nop patterns | ||
| 36 | + (unhandled instruction bytes: 0x2E 0x8D 0xB4 0x26) | ||
| 37 | |||
| 38 | To see details of a given bug, visit | ||
| 39 | https://bugs.kde.org/show_bug.cgi?id=XXXXXX | ||
| 40 | --- a/VEX/priv/guest_x86_toIR.c | ||
| 41 | +++ b/VEX/priv/guest_x86_toIR.c | ||
| 42 | @@ -8198,7 +8198,7 @@ DisResult disInstr_X86_WRK ( | ||
| 43 | delta += 5; | ||
| 44 | goto decode_success; | ||
| 45 | } | ||
| 46 | - /* Don't barf on recent binutils padding, | ||
| 47 | + /* Don't barf on recent (2010) binutils padding, | ||
| 48 | all variants of which are: nopw %cs:0x0(%eax,%eax,1) | ||
| 49 | 66 2e 0f 1f 84 00 00 00 00 00 | ||
| 50 | 66 66 2e 0f 1f 84 00 00 00 00 00 | ||
| 51 | @@ -8222,6 +8222,26 @@ DisResult disInstr_X86_WRK ( | ||
| 52 | goto decode_success; | ||
| 53 | } | ||
| 54 | } | ||
| 55 | + | ||
| 56 | + /* bug478624 GNU binutils uses a leal of esi into itself with | ||
| 57 | + a zero offset and CS prefix as an 8 byte no-op (Dec 2023). | ||
| 58 | + Since the CS prefix is hardly ever used we don't do much | ||
| 59 | + to decode it, just a few cases for conditional branches. | ||
| 60 | + So add handling here with other pseudo-no-ops. | ||
| 61 | + */ | ||
| 62 | + if (code[0] == 0x2E && code[1] == 0x8D) { | ||
| 63 | + if (code[2] == 0x74 && code[3] == 0x26 && code[4] == 0x00) { | ||
| 64 | + DIP("leal %%cs:0(%%esi,%%eiz,1),%%esi\n"); | ||
| 65 | + delta += 5; | ||
| 66 | + goto decode_success; | ||
| 67 | + } | ||
| 68 | + if (code[2] == 0xB4 && code[3] == 0x26 && code[4] == 0x00 | ||
| 69 | + && code[5] == 0x00 && code[6] == 0x00 && code[7] == 0x00) { | ||
| 70 | + DIP("leal %%cs:0(%%esi,%%eiz,1),%%esi\n"); | ||
| 71 | + delta += 8; | ||
| 72 | + goto decode_success; | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | |||
| 76 | // Intel CET requires the following opcodes to be treated as NOPs | ||
| 77 | // with any prefix and ModRM, SIB and disp combination: | ||
| 78 | --- a/none/tests/x86/Makefile.am | ||
| 79 | +++ b/none/tests/x86/Makefile.am | ||
| 80 | @@ -52,6 +52,7 @@ EXTRA_DIST = \ | ||
| 81 | fxtract.stdout.exp fxtract.stderr.exp fxtract.vgtest \ | ||
| 82 | fxtract.stdout.exp-older-glibc \ | ||
| 83 | getseg.stdout.exp getseg.stderr.exp getseg.vgtest \ | ||
| 84 | + gnu_binutils_nop.stderr.exp gnu_binutils_nop.vgtest \ | ||
| 85 | incdec_alt.stdout.exp incdec_alt.stderr.exp incdec_alt.vgtest \ | ||
| 86 | int.stderr.exp int.stdout.exp int.disabled \ | ||
| 87 | $(addsuffix .stderr.exp,$(INSN_TESTS)) \ | ||
| 88 | @@ -100,6 +101,7 @@ check_PROGRAMS = \ | ||
| 89 | fpu_lazy_eflags \ | ||
| 90 | fxtract \ | ||
| 91 | getseg \ | ||
| 92 | + gnu_binutils_nop \ | ||
| 93 | incdec_alt \ | ||
| 94 | $(INSN_TESTS) \ | ||
| 95 | int \ | ||
| 96 | --- /dev/null | ||
| 97 | +++ b/none/tests/x86/gnu_binutils_nop.c | ||
| 98 | @@ -0,0 +1,34 @@ | ||
| 99 | +int main(void) | ||
| 100 | +{ | ||
| 101 | + // GNU binutils uses various opcodes as alternatives for nop | ||
| 102 | + // the idea is that it is faster to execute one large opcode | ||
| 103 | + // with no side-effects than multiple repetitions of the | ||
| 104 | + // single byte 'nop'. This gives more choice when code | ||
| 105 | + // needs to be padded. | ||
| 106 | + | ||
| 107 | + // the following is based on | ||
| 108 | + // https://sourceware.org/cgit/binutils-gdb/tree/gas/config/tc-i386.c#n1256 | ||
| 109 | + | ||
| 110 | + // one byte | ||
| 111 | + __asm__ __volatile__("nop"); | ||
| 112 | + // two bytes | ||
| 113 | + __asm__ __volatile__("xchg %ax,%ax"); | ||
| 114 | + // three bytes | ||
| 115 | + //__asm__ __volatile__("leal 0(%esi),%esi"); | ||
| 116 | + __asm__ __volatile__(".byte 0x8d,0x76,0x00"); | ||
| 117 | + // four bytes | ||
| 118 | + //__asm__ __volatile__("leal 0(%esi,%eiz),%esi"); | ||
| 119 | + __asm__ __volatile__(".byte 0x8d,0x74,0x26,0x00"); | ||
| 120 | + // five bytes | ||
| 121 | + //__asm__ __volatile__("leal %cs:0(%esi,%eiz),%esi"); | ||
| 122 | + __asm__ __volatile__(".byte 0x2e,0x8d,0x74,0x26,0x00"); | ||
| 123 | + // six bytes | ||
| 124 | + //__asm__ __volatile__("leal 0L(%esi),%esi"); | ||
| 125 | + __asm__ __volatile__(".byte 0x8d,0xb6,0x00,0x00,0x00,0x00"); | ||
| 126 | + // seven bytes | ||
| 127 | + //__asm__ __volatile__("leal 0L(%esi,%eiz),%esi"); | ||
| 128 | + __asm__ __volatile__(".byte 0x8d,0xb4,0x26,0x00,0x00,0x00,0x00"); | ||
| 129 | + // eight bytes | ||
| 130 | + //__asm__ __volatile__("leal %cs:0L(%esi,%eiz),%esi"); | ||
| 131 | + __asm__ __volatile__(".byte 0x2e,0x8d,0xb4,0x26,0x00,0x00,0x00,0x00"); | ||
| 132 | +} | ||
| 133 | --- /dev/null | ||
| 134 | +++ b/none/tests/x86/gnu_binutils_nop.vgtest | ||
| 135 | @@ -0,0 +1,2 @@ | ||
| 136 | +prog: gnu_binutils_nop | ||
| 137 | +vgopts: -q | ||
