summaryrefslogtreecommitdiffstats
path: root/tools/objtool
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@redhat.com>2019-07-17 21:36:51 -0400
committerThomas Gleixner <tglx@linutronix.de>2019-07-18 15:01:08 -0400
commitc9bab22bc449ad2496a6bbbf68acc711d9c5301c (patch)
tree49f72c753cd701dfa520655212504ce689ac6f87 /tools/objtool
parent8e25c9f8b482ea8d8b6fb4f6f5c09bcc5ee18663 (diff)
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: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Nick Desaulniers <ndesaulniers@google.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/aed62fbd60e239280218be623f751a433658e896.1563413318.git.jpoimboe@redhat.com
Diffstat (limited to 'tools/objtool')
-rw-r--r--tools/objtool/check.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index d9d1c9b54947..0d2a8e54a82e 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -133,6 +133,9 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
133 "rewind_stack_do_exit", 133 "rewind_stack_do_exit",
134 }; 134 };
135 135
136 if (!func)
137 return false;
138
136 if (func->bind == STB_WEAK) 139 if (func->bind == STB_WEAK)
137 return false; 140 return false;
138 141
@@ -2071,19 +2074,16 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
2071 if (ret) 2074 if (ret)
2072 return ret; 2075 return ret;
2073 2076
2074 if (insn->type == INSN_CALL) { 2077 if (!no_fp && func && !is_fentry_call(insn) &&
2075 if (is_fentry_call(insn)) 2078 !has_valid_stack_frame(&state)) {
2076 break;
2077
2078 if (dead_end_function(file, insn->call_dest))
2079 return 0;
2080 }
2081
2082 if (!no_fp && func && !has_valid_stack_frame(&state)) {
2083 WARN_FUNC("call without frame pointer save/setup", 2079 WARN_FUNC("call without frame pointer save/setup",
2084 sec, insn->offset); 2080 sec, insn->offset);
2085 return 1; 2081 return 1;
2086 } 2082 }
2083
2084 if (dead_end_function(file, insn->call_dest))
2085 return 0;
2086
2087 break; 2087 break;
2088 2088
2089 case INSN_JUMP_CONDITIONAL: 2089 case INSN_JUMP_CONDITIONAL: