From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org,
Adrian Hunter <adrian.hunter@intel.com>
Subject: [PATCH 0/2] x86: Fix insn decoder to support 0xEA as UD
Date: Mon, 28 Apr 2025 10:48:00 +0900 [thread overview]
Message-ID: <174580488057.388420.1338751162448700082.stgit@devnote2> (raw)
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>
next reply other threads:[~2025-04-28 1:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-28 1:48 Masami Hiramatsu (Google) [this message]
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)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=174580488057.388420.1338751162448700082.stgit@devnote2 \
--to=mhiramat@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox