[<prev] [next>] [day] [month] [year] [list]
Message-ID: <158762818609.28353.2034599219939179134.tip-bot2@tip-bot2>
Date: Thu, 23 Apr 2020 07:49:46 -0000
From: "tip-bot2 for Julien Thierry" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Julien Thierry <jthierry@...hat.com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Miroslav Benes <mbenes@...e.cz>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Ingo Molnar <mingo@...nel.org>, x86 <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: [tip: objtool/core] objtool: Clean instruction state before each
function validation
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: 0699e551af268c9841a205a3e90dc1615fb63d84
Gitweb: https://git.kernel.org/tip/0699e551af268c9841a205a3e90dc1615fb63d84
Author: Julien Thierry <jthierry@...hat.com>
AuthorDate: Fri, 27 Mar 2020 15:28:40
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Wed, 22 Apr 2020 10:53:49 +02:00
objtool: Clean instruction state before each function validation
When a function fails its validation, it might leave a stale state
that will be used for the validation of other functions. That would
cause false warnings on potentially valid functions.
Reset the instruction state before the validation of each individual
function.
Signed-off-by: Julien Thierry <jthierry@...hat.com>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: Miroslav Benes <mbenes@...e.cz>
Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
tools/objtool/check.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index c18eca1..5b67d61 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2411,13 +2411,6 @@ static int validate_section(struct objtool_file *file, struct section *sec)
struct insn_state state;
int ret, warnings = 0;
- clear_insn_state(&state);
-
- state.cfa = initial_func_cfi.cfa;
- memcpy(&state.regs, &initial_func_cfi.regs,
- CFI_NUM_REGS * sizeof(struct cfi_reg));
- state.stack_size = initial_func_cfi.cfa.offset;
-
list_for_each_entry(func, &sec->symbol_list, list) {
if (func->type != STT_FUNC)
continue;
@@ -2435,6 +2428,12 @@ static int validate_section(struct objtool_file *file, struct section *sec)
if (!insn || insn->ignore || insn->visited)
continue;
+ clear_insn_state(&state);
+ state.cfa = initial_func_cfi.cfa;
+ memcpy(&state.regs, &initial_func_cfi.regs,
+ CFI_NUM_REGS * sizeof(struct cfi_reg));
+ state.stack_size = initial_func_cfi.cfa.offset;
+
state.uaccess = func->uaccess_safe;
ret = validate_branch(file, func, insn, state);
Powered by blists - more mailing lists