]> git.itanic.dy.fi Git - linux-stable/commitdiff
x86/tools: objdump_reformat.awk: Skip bad instructions from llvm-objdump
authorNathan Chancellor <nathan@kernel.org>
Tue, 5 Dec 2023 19:53:08 +0000 (12:53 -0700)
committerBorislav Petkov (AMD) <bp@alien8.de>
Thu, 4 Jan 2024 09:04:02 +0000 (10:04 +0100)
When running the instruction decoder selftest with LLVM=1 and
CONFIG_PVH=y, there is a series of warnings:

  arch/x86/tools/insn_decoder_test: warning: Found an x86 instruction decoder bug, please report this.
  arch/x86/tools/insn_decoder_test: warning: ffffffff81000050     ea                      <unknown>
  arch/x86/tools/insn_decoder_test: warning: objdump says 1 bytes, but insn_get_length() says 7
  arch/x86/tools/insn_decoder_test: warning: Decoded and checked 7214721 instructions with 1 failures

GNU objdump outputs "(bad)" instead of "<unknown>", which is already
handled in the bad_expr regex, so there is no warning.

  $ objdump -d arch/x86/platform/pvh/head.o | grep -E '50:\s+ea'
  50:   ea                      (bad)

  $ llvm-objdump -d arch/x86/platform/pvh/head.o | grep -E '50:\s+ea'
        50: ea                            <unknown>

Add "<unknown>" to the bad_expr regex to clear up the warning, allowing
the instruction decoder selftest to fully pass with llvm-objdump.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20231205-objdump_reformat-awk-handle-llvm-objdump-bad_expr-v1-1-b4a74f39396f@kernel.org
arch/x86/tools/objdump_reformat.awk

index a4120d907277a5bdc8c9336c8889264cb8a2bddb..20b08a6c4d33376ce55e4cd2d0650fb04ef1b663 100644 (file)
@@ -11,7 +11,7 @@ BEGIN {
        prev_addr = ""
        prev_hex = ""
        prev_mnemonic = ""
-       bad_expr = "(\\(bad\\)|^rex|^.byte|^rep(z|nz)$|^lock$|^es$|^cs$|^ss$|^ds$|^fs$|^gs$|^data(16|32)$|^addr(16|32|64))"
+       bad_expr = "(\\(bad\\)|<unknown>|^rex|^.byte|^rep(z|nz)$|^lock$|^es$|^cs$|^ss$|^ds$|^fs$|^gs$|^data(16|32)$|^addr(16|32|64))"
        fwait_expr = "^9b[ \t]*fwait"
        fwait_str="9b\tfwait"
 }