Skip to content

Commit c721b3f

Browse files
achartrePeter Zijlstra
authored andcommitted
objtool: UNWIND_HINT_RET_OFFSET should not check registers
UNWIND_HINT_RET_OFFSET will adjust a modified stack. However if a callee-saved register was pushed on the stack then the stack frame will still appear modified. So stop checking registers when UNWIND_HINT_RET_OFFSET is used. Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Acked-by: Josh Poimboeuf <jpoimboe@redhat.com> Link: https://lkml.kernel.org/r/20200407073142.20659-3-alexandre.chartre@oracle.com
1 parent 87cf61f commit c721b3f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎tools/objtool/check.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,6 +1507,14 @@ static bool has_modified_stack_frame(struct instruction *insn, struct insn_state
15071507
if (cfi->stack_size != initial_func_cfi.cfa.offset + ret_offset)
15081508
return true;
15091509

1510+
/*
1511+
* If there is a ret offset hint then don't check registers
1512+
* because a callee-saved register might have been pushed on
1513+
* the stack.
1514+
*/
1515+
if (ret_offset)
1516+
return false;
1517+
15101518
for (i = 0; i < CFI_NUM_REGS; i++) {
15111519
if (cfi->regs[i].base != initial_func_cfi.regs[i].base ||
15121520
cfi->regs[i].offset != initial_func_cfi.regs[i].offset)

0 commit comments

Comments
 (0)