[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-c9bab22bc449ad2496a6bbbf68acc711d9c5301c@git.kernel.org>
Date: Thu, 18 Jul 2019 12:18:28 -0700
From: tip-bot for Josh Poimboeuf <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: hpa@...or.com, linux-kernel@...r.kernel.org, peterz@...radead.org,
ndesaulniers@...gle.com, tglx@...utronix.de, jpoimboe@...hat.com,
mingo@...nel.org
Subject: [tip:core/urgent] objtool: Do frame pointer check before dead end
check
Commit-ID: c9bab22bc449ad2496a6bbbf68acc711d9c5301c
Gitweb: https://git.kernel.org/tip/c9bab22bc449ad2496a6bbbf68acc711d9c5301c
Author: Josh Poimboeuf <jpoimboe@...hat.com>
AuthorDate: Wed, 17 Jul 2019 20:36:51 -0500
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Thu, 18 Jul 2019 21:01:08 +0200
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@...hat.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Tested-by: Nick Desaulniers <ndesaulniers@...gle.com>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Link: https://lkml.kernel.org/r/aed62fbd60e239280218be623f751a433658e896.1563413318.git.jpoimboe@redhat.com
---
tools/objtool/check.c | 18 +++++++++---------
1 file 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,
"rewind_stack_do_exit",
};
+ if (!func)
+ return false;
+
if (func->bind == STB_WEAK)
return false;
@@ -2071,19 +2074,16 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
if (ret)
return ret;
- if (insn->type == INSN_CALL) {
- if (is_fentry_call(insn))
- break;
-
- if (dead_end_function(file, insn->call_dest))
- return 0;
- }
-
- if (!no_fp && func && !has_valid_stack_frame(&state)) {
+ if (!no_fp && func && !is_fentry_call(insn) &&
+ !has_valid_stack_frame(&state)) {
WARN_FUNC("call without frame pointer save/setup",
sec, insn->offset);
return 1;
}
+
+ if (dead_end_function(file, insn->call_dest))
+ return 0;
+
break;
case INSN_JUMP_CONDITIONAL:
Powered by blists - more mailing lists