All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] x86: Fix insn decoder to support 0xEA as UD
@ 2025-04-28  1:48 Masami Hiramatsu (Google)
  2025-04-28  1:48 ` [PATCH 1/2] x86: Fix opcode map (!REX2) superscript tags Masami Hiramatsu (Google)
  2025-04-28  1:48 ` [PATCH 2/2] x86: Stop decoding i64 instructions in x86-64 mode at opcode Masami Hiramatsu (Google)
  0 siblings, 2 replies; 6+ messages in thread
From: Masami Hiramatsu (Google) @ 2025-04-28  1:48 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar
  Cc: Thomas Gleixner, Borislav Petkov, Dave Hansen, x86,
	H . Peter Anvin, linux-kernel, Adrian Hunter

Hi,

Peter found that the current x86 instruction decoder reports the 0xEA
instruction as "JMP Ap" always. But objdump says that is invalid on
64bit mode. Thus there is a difference of lenght of 0xEA between
objdump and x86 insn decoder.

I found the opcodes which have (i64) superscript are invalid in 64bit
mode, if it is not paired with (o64). Thus this stops decoding such
instructions if insn->x86_64 is set.

With this fix, the single "0xEA" is correctly decoded as 1 byte
instruction in 64bit mode.
------
printf "0:\tea\t\n" | insn_decoder_test -y -v
insn_decoder_test: success: Decoded and checked 1 instructions
------

In this series, I also found a bug in previous (!REX2) tag. The first
commit fixes that.

---

Masami Hiramatsu (Google) (2):
      x86: Fix opcode map (!REX2) superscript tags
      x86: Stop decoding i64 instructions in x86-64 mode at opcode


 arch/x86/include/asm/inat.h                |    6 +++
 arch/x86/lib/insn.c                        |    7 +++-
 arch/x86/lib/x86-opcode-map.txt            |   56 ++++++++++++++--------------
 arch/x86/tools/gen-insn-attr-x86.awk       |    7 ++++
 tools/arch/x86/include/asm/inat.h          |    6 +++
 tools/arch/x86/lib/insn.c                  |    7 +++-
 tools/arch/x86/lib/x86-opcode-map.txt      |   56 ++++++++++++++--------------
 tools/arch/x86/tools/gen-insn-attr-x86.awk |    7 ++++
 8 files changed, 94 insertions(+), 58 deletions(-)

--
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-05-06 10:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-28  1:48 [PATCH 0/2] x86: Fix insn decoder to support 0xEA as UD Masami Hiramatsu (Google)
2025-04-28  1:48 ` [PATCH 1/2] x86: Fix opcode map (!REX2) superscript tags Masami Hiramatsu (Google)
2025-05-06 10:35   ` [tip: x86/asm] x86/insn: " tip-bot2 for Masami Hiramatsu (Google)
2025-04-28  1:48 ` [PATCH 2/2] x86: Stop decoding i64 instructions in x86-64 mode at opcode Masami Hiramatsu (Google)
2025-04-29  8:50   ` Peter Zijlstra
2025-05-06 10:35   ` [tip: x86/asm] x86/insn: " tip-bot2 for Masami Hiramatsu (Google)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.