Commit c9bab22b authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Thomas Gleixner

objtool: Do frame pointer check before dead end check

Even calls to __noreturn functions need the frame pointer setup first.
Such functions often dump the stack.
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/aed62fbd60e239280218be623f751a433658e896.1563413318.git.jpoimboe@redhat.com
parent 8e25c9f8
...@@ -133,6 +133,9 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func, ...@@ -133,6 +133,9 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
"rewind_stack_do_exit", "rewind_stack_do_exit",
}; };
if (!func)
return false;
if (func->bind == STB_WEAK) if (func->bind == STB_WEAK)
return false; return false;
...@@ -2071,19 +2074,16 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, ...@@ -2071,19 +2074,16 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
if (ret) if (ret)
return ret; return ret;
if (insn->type == INSN_CALL) { if (!no_fp && func && !is_fentry_call(insn) &&
if (is_fentry_call(insn)) !has_valid_stack_frame(&state)) {
break;
if (dead_end_function(file, insn->call_dest))
return 0;
}
if (!no_fp && func && !has_valid_stack_frame(&state)) {
WARN_FUNC("call without frame pointer save/setup", WARN_FUNC("call without frame pointer save/setup",
sec, insn->offset); sec, insn->offset);
return 1; return 1;
} }
if (dead_end_function(file, insn->call_dest))
return 0;
break; break;
case INSN_JUMP_CONDITIONAL: case INSN_JUMP_CONDITIONAL:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment