Skip to content

x86: Fix insn decoder to support 0xEA as UD

Masami Hiramatsu (Google) lkml 1 version Applied

Status from this message: The following commit has been merged into the x86/asm branch of tip:

Get series with b4
b4 am 174580488057.388420.1338751162448700082.stgit@devnote2

Versions newest first

  1. v1 Latest2 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2x86: Fix opcode map (!REX2) superscript tagsarch/x86/lib/x86-opcode-map.txt tools/arch/x86/lib/x86-opcode-map.txt+50 -500 replies
2/2x86: Stop decoding i64 instructions in x86-64 mode at opcodearch/x86/include/asm/inat.h arch/x86/lib/insn.c arch/x86/lib/x86-opcode-map.txt +5 more+44 -81 reply

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchPeter Zijlstra (Intel)
1/2
2/2T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] x86: Fix insn decoder to support 0xEA as UD

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) <[email protected]>