2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/arch/x86/tools
Masami Hiramatsu (Google) 4b626015e1 x86/insn: Stop decoding i64 instructions in x86-64 mode at opcode
In commit 2e044911be ("x86/traps: Decode 0xEA instructions as #UD")
FineIBT starts using 0xEA as an invalid instruction like UD2. But
insn decoder always returns the length of "0xea" instruction as 7
because it does not check the (i64) superscript.

The x86 instruction decoder should also decode 0xEA on x86-64 as
a one-byte invalid instruction by decoding the "(i64)" superscript tag.

This stops decoding instruction which has (i64) but does not have (o64)
superscript in 64-bit mode at opcode and skips other fields.

With this change, insn_decoder_test says 0xea is 1 byte length if
x86-64 (-y option means 64-bit):

   $ printf "0:\tea\t\n" | insn_decoder_test -y -v
   insn_decoder_test: success: Decoded and checked 1 instructions

Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/174580490000.388420.5225447607417115496.stgit@devnote2
2025-05-06 12:03:16 +02:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
cpufeaturemasks.awk x86/cpufeatures: Use AWK to generate {REQUIRED|DISABLED}_MASK_BIT_SET in <asm/cpufeaturemasks.h> 2025-03-19 11:15:12 +01:00
gen-insn-attr-x86.awk x86/insn: Stop decoding i64 instructions in x86-64 mode at opcode 2025-05-06 12:03:16 +02:00
insn_decoder_test.c x86/tools: Drop duplicate unlikely() definition in insn_decoder_test.c 2025-03-28 22:57:44 +01:00
insn_sanity.c x86/tools/insn_sanity: Convert to insn_decode() 2021-03-15 12:21:11 +01:00
Makefile x86/tools: Remove chkobjdump.awk 2023-11-30 09:38:12 +01:00
objdump_reformat.awk x86/tools: objdump_reformat.awk: Skip bad instructions from llvm-objdump 2024-01-04 10:04:02 +01:00
relocs_32.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
relocs_64.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
relocs_common.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
relocs.c x86/percpu/64: Remove INIT_PER_CPU macros 2025-02-18 10:15:50 +01:00
relocs.h x86/tools/relocs: Mark die() with the printf function attr format 2021-08-23 05:58:02 +02:00