lkml.org 
[lkml]   [2020]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 03/10] objtool: check: Clean instruction state before each function validation
Date
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>
---
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 44a3abbb0b0b..0ccf6882d8ce 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2406,13 +2406,6 @@ static int validate_functions(struct objtool_file *file)
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;
-
for_each_sec(file, sec) {
list_for_each_entry(func, &sec->symbol_list, list) {
if (func->type != STT_FUNC)
@@ -2431,6 +2424,12 @@ static int validate_functions(struct objtool_file *file)
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);
--
2.21.1
\
 
 \ /
  Last update: 2020-03-25 09:43    [W:0.147 / U:1.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site