[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <158759426944.28353.2192916542303185665.tip-bot2@tip-bot2>
Date: Wed, 22 Apr 2020 22:24:29 -0000
From: "tip-bot2 for Peter Zijlstra" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: "Peter Zijlstra (Intel)" <peterz@...radead.org>,
Miroslav Benes <mbenes@...e.cz>,
Alexandre Chartre <alexandre.chartre@...cle.com>,
Josh Poimboeuf <jpoimboe@...hat.com>, x86 <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: [tip: objtool/core] objtool: Rearrange validate_section()
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: 0e7f7f7c11588dd778f702da1405f0cc33cfea8c
Gitweb: https://git.kernel.org/tip/0e7f7f7c11588dd778f702da1405f0cc33cfea8c
Author: Peter Zijlstra <peterz@...radead.org>
AuthorDate: Mon, 23 Mar 2020 21:17:50 +01:00
Committer: Peter Zijlstra <peterz@...radead.org>
CommitterDate: Wed, 22 Apr 2020 23:10:08 +02:00
objtool: Rearrange validate_section()
In preparation of further changes, once again break out the loop body.
No functional changes intended.
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: Miroslav Benes <mbenes@...e.cz>
Reviewed-by: Alexandre Chartre <alexandre.chartre@...cle.com>
Acked-by: Josh Poimboeuf <jpoimboe@...hat.com>
Link: https://lkml.kernel.org/r/20200416115119.405863817@infradead.org
---
tools/objtool/check.c | 51 +++++++++++++++++++++++-------------------
1 file changed, 29 insertions(+), 22 deletions(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index ef082a3..1d455d6 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2502,12 +2502,37 @@ static bool ignore_unreachable_insn(struct instruction *insn)
return false;
}
-static int validate_section(struct objtool_file *file, struct section *sec)
+static int validate_symbol(struct objtool_file *file, struct section *sec,
+ struct symbol *sym, struct insn_state *state)
{
- struct symbol *func;
struct instruction *insn;
+ int ret;
+
+ if (!sym->len) {
+ WARN("%s() is missing an ELF size annotation", sym->name);
+ return 1;
+ }
+
+ if (sym->pfunc != sym || sym->alias != sym)
+ return 0;
+
+ insn = find_insn(file, sec, sym->offset);
+ if (!insn || insn->ignore || insn->visited)
+ return 0;
+
+ state->uaccess = sym->uaccess_safe;
+
+ ret = validate_branch(file, insn->func, insn, *state);
+ if (ret && backtrace)
+ BT_FUNC("<=== (sym)", insn);
+ return ret;
+}
+
+static int validate_section(struct objtool_file *file, struct section *sec)
+{
struct insn_state state;
- int ret, warnings = 0;
+ struct symbol *func;
+ int warnings = 0;
/*
* We need the full vmlinux for noinstr validation, otherwise we can
@@ -2521,31 +2546,13 @@ static int validate_section(struct objtool_file *file, struct section *sec)
if (func->type != STT_FUNC)
continue;
- if (!func->len) {
- WARN("%s() is missing an ELF size annotation",
- func->name);
- warnings++;
- }
-
- if (func->pfunc != func || func->alias != func)
- continue;
-
- insn = find_insn(file, sec, func->offset);
- if (!insn || insn->ignore || insn->visited)
- continue;
-
clear_insn_state(&state);
state.cfi.cfa = initial_func_cfi.cfa;
memcpy(&state.cfi.regs, &initial_func_cfi.regs,
CFI_NUM_REGS * sizeof(struct cfi_reg));
state.cfi.stack_size = initial_func_cfi.cfa.offset;
- state.uaccess = func->uaccess_safe;
-
- ret = validate_branch(file, func, insn, state);
- if (ret && backtrace)
- BT_FUNC("<=== (func)", insn);
- warnings += ret;
+ warnings += validate_symbol(file, sec, func, &state);
}
return warnings;
Powered by blists - more mailing lists