mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] objtool: Fix skip_alt_group() for non-alternative STAC/CLAC
@ 2025-10-29 19:54 Josh Poimboeuf
  2025-10-31 11:04 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
  2025-11-01  6:49 ` tip-bot2 for Josh Poimboeuf
  0 siblings, 2 replies; 3+ messages in thread
From: Josh Poimboeuf @ 2025-10-29 19:54 UTC (permalink / raw)
  To: x86; +Cc: linux-kernel, Linus Torvalds, Peter Zijlstra

If an insn->alt points to a STAC/CLAC instruction, skip_alt_group()
assumes it's part of an alternative ("alt group") as opposed to some
other kind of "alt" such as an exception fixup.

While that assumption may hold true in the current code base, Linus has
an out-of-tree patch which breaks that assumption by replacing the
STAC/CLAC alternatives with raw STAC/CLAC instructions.

Make skip_alt_group() more robust by making sure it's actually an alt
group before continuing.

Fixes: 2d12c6fb7875 ("objtool: Remove ANNOTATE_IGNORE_ALTERNATIVE from CLAC/STAC")
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Closes: https://lore.kernel.org/CAHk-=wi6goUT36sR8GE47_P-aVrd5g38=VTRHpktWARbyE-0ow@mail.gmail.com
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 tools/objtool/check.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 620854fdaaf63..9004fbc067693 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -3516,8 +3516,11 @@ static bool skip_alt_group(struct instruction *insn)
 {
 	struct instruction *alt_insn = insn->alts ? insn->alts->insn : NULL;
 
+	if (!insn->alt_group)
+		return false;
+
 	/* ANNOTATE_IGNORE_ALTERNATIVE */
-	if (insn->alt_group && insn->alt_group->ignore)
+	if (insn->alt_group->ignore)
 		return true;
 
 	/*
-- 
2.51.0


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

* [tip: objtool/urgent] objtool: Fix skip_alt_group() for non-alternative STAC/CLAC
  2025-10-29 19:54 [PATCH] objtool: Fix skip_alt_group() for non-alternative STAC/CLAC Josh Poimboeuf
@ 2025-10-31 11:04 ` tip-bot2 for Josh Poimboeuf
  2025-11-01  6:49 ` tip-bot2 for Josh Poimboeuf
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Josh Poimboeuf @ 2025-10-31 11:04 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Linus Torvalds, Josh Poimboeuf, x86, linux-kernel

The following commit has been merged into the objtool/urgent branch of tip:

Commit-ID:     2c132efb3a443ab22f3b05e547ccc42bf2ee5abf
Gitweb:        https://git.kernel.org/tip/2c132efb3a443ab22f3b05e547ccc42bf2ee5abf
Author:        Josh Poimboeuf <jpoimboe@kernel.org>
AuthorDate:    Wed, 29 Oct 2025 12:54:08 -07:00
Committer:     Josh Poimboeuf <jpoimboe@kernel.org>
CommitterDate: Wed, 29 Oct 2025 21:23:49 -07:00

objtool: Fix skip_alt_group() for non-alternative STAC/CLAC

If an insn->alt points to a STAC/CLAC instruction, skip_alt_group()
assumes it's part of an alternative ("alt group") as opposed to some
other kind of "alt" such as an exception fixup.

While that assumption may hold true in the current code base, Linus has
an out-of-tree patch which breaks that assumption by replacing the
STAC/CLAC alternatives with raw STAC/CLAC instructions.

Make skip_alt_group() more robust by making sure it's actually an alt
group before continuing.

Fixes: 2d12c6fb7875 ("objtool: Remove ANNOTATE_IGNORE_ALTERNATIVE from CLAC/STAC")
Closes: https://lore.kernel.org/CAHk-=wi6goUT36sR8GE47_P-aVrd5g38=VTRHpktWARbyE-0ow@mail.gmail.com
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Link: https://patch.msgid.link/3d22415f7b8e06a64e0873b21f48389290eeaa49.1761767616.git.jpoimboe@kernel.org
---
 tools/objtool/check.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 620854f..9004fbc 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -3516,8 +3516,11 @@ static bool skip_alt_group(struct instruction *insn)
 {
 	struct instruction *alt_insn = insn->alts ? insn->alts->insn : NULL;
 
+	if (!insn->alt_group)
+		return false;
+
 	/* ANNOTATE_IGNORE_ALTERNATIVE */
-	if (insn->alt_group && insn->alt_group->ignore)
+	if (insn->alt_group->ignore)
 		return true;
 
 	/*

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

* [tip: objtool/urgent] objtool: Fix skip_alt_group() for non-alternative STAC/CLAC
  2025-10-29 19:54 [PATCH] objtool: Fix skip_alt_group() for non-alternative STAC/CLAC Josh Poimboeuf
  2025-10-31 11:04 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
@ 2025-11-01  6:49 ` tip-bot2 for Josh Poimboeuf
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Josh Poimboeuf @ 2025-11-01  6:49 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Linus Torvalds, Josh Poimboeuf, Ingo Molnar, x86, linux-kernel

The following commit has been merged into the objtool/urgent branch of tip:

Commit-ID:     c44b4b9eeb71f5b0b617abf6fd66d1ef0aab6200
Gitweb:        https://git.kernel.org/tip/c44b4b9eeb71f5b0b617abf6fd66d1ef0aab6200
Author:        Josh Poimboeuf <jpoimboe@kernel.org>
AuthorDate:    Wed, 29 Oct 2025 12:54:08 -07:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Sat, 01 Nov 2025 07:43:20 +01:00

objtool: Fix skip_alt_group() for non-alternative STAC/CLAC

If an insn->alt points to a STAC/CLAC instruction, skip_alt_group()
assumes it's part of an alternative ("alt group") as opposed to some
other kind of "alt" such as an exception fixup.

While that assumption may hold true in the current code base, Linus has
an out-of-tree patch which breaks that assumption by replacing the
STAC/CLAC alternatives with raw STAC/CLAC instructions.

Make skip_alt_group() more robust by making sure it's actually an alt
group before continuing.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Fixes: 2d12c6fb7875 ("objtool: Remove ANNOTATE_IGNORE_ALTERNATIVE from CLAC/STAC")
Closes: https://lore.kernel.org/CAHk-=wi6goUT36sR8GE47_P-aVrd5g38=VTRHpktWARbyE-0ow@mail.gmail.com
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://patch.msgid.link/3d22415f7b8e06a64e0873b21f48389290eeaa49.1761767616.git.jpoimboe@kernel.org
---
 tools/objtool/check.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 620854f..9004fbc 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -3516,8 +3516,11 @@ static bool skip_alt_group(struct instruction *insn)
 {
 	struct instruction *alt_insn = insn->alts ? insn->alts->insn : NULL;
 
+	if (!insn->alt_group)
+		return false;
+
 	/* ANNOTATE_IGNORE_ALTERNATIVE */
-	if (insn->alt_group && insn->alt_group->ignore)
+	if (insn->alt_group->ignore)
 		return true;
 
 	/*

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

end of thread, other threads:[~2025-11-01  6:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-29 19:54 [PATCH] objtool: Fix skip_alt_group() for non-alternative STAC/CLAC Josh Poimboeuf
2025-10-31 11:04 ` [tip: objtool/urgent] " tip-bot2 for Josh Poimboeuf
2025-11-01  6:49 ` tip-bot2 for Josh Poimboeuf

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®