Skip to content

Commit c44b4b9

Browse files
jpoimboeIngo Molnar
authored andcommitted
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: 2d12c6f ("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
1 parent ba36dd5 commit c44b4b9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/objtool/check.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3516,8 +3516,11 @@ static bool skip_alt_group(struct instruction *insn)
35163516
{
35173517
struct instruction *alt_insn = insn->alts ? insn->alts->insn : NULL;
35183518

3519+
if (!insn->alt_group)
3520+
return false;
3521+
35193522
/* ANNOTATE_IGNORE_ALTERNATIVE */
3520-
if (insn->alt_group && insn->alt_group->ignore)
3523+
if (insn->alt_group->ignore)
35213524
return true;
35223525

35233526
/*

0 commit comments

Comments
 (0)