mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: x86@kernel.org, hpa@zytor.com, ludloff@gmail.com,
	andrew.cooper3@citrix.com, mhiramat@kernel.org
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	andrii@kernel.org, olsajiri@gmail.com, jpoimboe@kernel.org
Subject: [RFC][PATCH 0/2] x86: Unify/extend insn_is_nop()
Date: Mon, 29 Sep 2025 10:18:53 +0200	[thread overview]
Message-ID: <20250929081853.230968966@infradead.org> (raw)

Hi all, welcome to an x86 instruction encoding quest.

I realized I implemented insn_is_nop() twice, obviously they have different bugs.
Additionally, I was made aware of another uprobe use-case.

As such, unify and extend insn_is_nop().

While doing this, I went down the rabbit hole of REX2/*VEX* encoded
instructions (because REX2.b4 NOP). The Intel APX document is clear as mud on
what exactly VEX/EVEX Map0 is, but the way I read it, it is the normal single
byte opcode map, no exceptions. Similarly Map1 is the 0f second byte opcode
map. So VEX prefixed NOPs should just work.

REX2 has a similar Map0/Map1 scheme, except it excludes a number of opcode
ranges -- notable not including NOP/NOPL. So REX2 prefixed NOPs are fine too.

Because I had to figure it all out anyway, I've made the function deal with
them, but perhaps the more prudent option is to simply reject all REX2/VEX
prefixed instructions entirely.

(although EVEX NOPL can hit 11 bytes without additional prefixes, so maybe
someone will start using them at some point).



             reply	other threads:[~2025-09-29  8:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-29  8:18 Peter Zijlstra [this message]
2025-09-29  8:18 ` [RFC][PATCH 1/2] x86/insn,uprobes,alternative: Unify insn_is_nop() Peter Zijlstra
2025-09-29  8:18 ` [RFC][PATCH 2/2] x86/insn: Simplify for_each_insn_prefix() Peter Zijlstra

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=20250929081853.230968966@infradead.org \
    --to=peterz@infradead.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=andrii@kernel.org \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ludloff@gmail.com \
    --cc=mhiramat@kernel.org \
    --cc=olsajiri@gmail.com \
    --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

all inboxes | Powered by JetHome®