Skip to content

Commit dbf4600

Browse files
Peter Zijlstrabp3tk0v
authored andcommitted
objtool/x86: Fixup frame-pointer vs rethunk
For stack-validation of a frame-pointer build, objtool validates that every CALL instruction is preceded by a frame-setup. The new SRSO return thunks violate this with their RSB stuffing trickery. Extend the __fentry__ exception to also cover the embedded_insn case used for this. This cures: vmlinux.o: warning: objtool: srso_untrain_ret+0xd: call without frame pointer save/setup Fixes: 4ae68b2 ("objtool/x86: Fix SRSO mess") Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Acked-by: Josh Poimboeuf <jpoimboe@kernel.org> Link: https://lore.kernel.org/r/20230816115921.GH980931@hirez.programming.kicks-ass.net
1 parent 9dbd23e commit dbf4600

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

tools/objtool/check.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,12 +2650,17 @@ static int decode_sections(struct objtool_file *file)
26502650
return 0;
26512651
}
26522652

2653-
static bool is_fentry_call(struct instruction *insn)
2653+
static bool is_special_call(struct instruction *insn)
26542654
{
2655-
if (insn->type == INSN_CALL &&
2656-
insn_call_dest(insn) &&
2657-
insn_call_dest(insn)->fentry)
2658-
return true;
2655+
if (insn->type == INSN_CALL) {
2656+
struct symbol *dest = insn_call_dest(insn);
2657+
2658+
if (!dest)
2659+
return false;
2660+
2661+
if (dest->fentry || dest->embedded_insn)
2662+
return true;
2663+
}
26592664

26602665
return false;
26612666
}
@@ -3656,7 +3661,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
36563661
if (ret)
36573662
return ret;
36583663

3659-
if (opts.stackval && func && !is_fentry_call(insn) &&
3664+
if (opts.stackval && func && !is_special_call(insn) &&
36603665
!has_valid_stack_frame(&state)) {
36613666
WARN_INSN(insn, "call without frame pointer save/setup");
36623667
return 1;

0 commit comments

Comments
 (0)