Commit 2513cbf9 authored by Josh Poimboeuf's avatar Josh Poimboeuf Committed by Ingo Molnar

objtool: Silence warnings for functions which use IRET

Previously, objtool ignored functions which have the IRET instruction
in them.  That's because it assumed that such functions know what
they're doing with respect to frame pointers.

With the new "objtool 2.0" changes, it stopped ignoring such functions,
and started complaining about them:

  arch/x86/kernel/alternative.o: warning: objtool: do_sync_core()+0x1b: unsupported instruction in callable function
  arch/x86/kernel/alternative.o: warning: objtool: text_poke()+0x1a8: unsupported instruction in callable function
  arch/x86/kernel/ftrace.o: warning: objtool: do_sync_core()+0x16: unsupported instruction in callable function
  arch/x86/kernel/cpu/mcheck/mce.o: warning: objtool: machine_check_poll()+0x166: unsupported instruction in callable function
  arch/x86/kernel/cpu/mcheck/mce.o: warning: objtool: do_machine_check()+0x147: unsupported instruction in callable function

Silence those warnings for now.  They can be re-enabled later, once we
have unwind hints which will allow the code to annotate the IRET usages.
Reported-by: default avatarIngo Molnar <mingo@kernel.org>
Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: live-patching@vger.kernel.org
Fixes: baa41469 ("objtool: Implement stack validation 2.0")
Link: http://lkml.kernel.org/r/20170630140934.mmwtpockvpupahro@trebleSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent baa41469
...@@ -100,6 +100,7 @@ static bool gcov_enabled(struct objtool_file *file) ...@@ -100,6 +100,7 @@ static bool gcov_enabled(struct objtool_file *file)
static bool ignore_func(struct objtool_file *file, struct symbol *func) static bool ignore_func(struct objtool_file *file, struct symbol *func)
{ {
struct rela *rela; struct rela *rela;
struct instruction *insn;
/* check for STACK_FRAME_NON_STANDARD */ /* check for STACK_FRAME_NON_STANDARD */
if (file->whitelist && file->whitelist->rela) if (file->whitelist && file->whitelist->rela)
...@@ -112,6 +113,11 @@ static bool ignore_func(struct objtool_file *file, struct symbol *func) ...@@ -112,6 +113,11 @@ static bool ignore_func(struct objtool_file *file, struct symbol *func)
return true; return true;
} }
/* check if it has a context switching instruction */
func_for_each_insn(file, func, insn)
if (insn->type == INSN_CONTEXT_SWITCH)
return true;
return false; return false;
} }
...@@ -1446,14 +1452,6 @@ static int validate_branch(struct objtool_file *file, struct instruction *first, ...@@ -1446,14 +1452,6 @@ static int validate_branch(struct objtool_file *file, struct instruction *first,
return 0; return 0;
case INSN_CONTEXT_SWITCH:
if (func) {
WARN_FUNC("unsupported instruction in callable function",
sec, insn->offset);
return 1;
}
return 0;
case INSN_STACK: case INSN_STACK:
if (update_insn_state(insn, &state)) if (update_insn_state(insn, &state))
return -1; return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment