summaryrefslogtreecommitdiffstats
path: root/tools/objtool/check.c
diff options
context:
space:
mode:
authorJulien Thierry <jthierry@redhat.com>2020-03-27 16:28:40 +0100
committerIngo Molnar <mingo@kernel.org>2020-04-22 10:53:49 +0200
commit0699e551af268c9841a205a3e90dc1615fb63d84 (patch)
treef755bb75c5cf0ed37980fa67d8b1dc82d868182d /tools/objtool/check.c
parentobjtool: Remove redundant checks on operand type (diff)
downloadlinux-0699e551af268c9841a205a3e90dc1615fb63d84.tar.xz
linux-0699e551af268c9841a205a3e90dc1615fb63d84.zip
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@redhat.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to '')
-rw-r--r--tools/objtool/check.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index c18eca151b6d..5b67d6150a0b 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);