Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752052AbdF3Rxo (ORCPT ); Fri, 30 Jun 2017 13:53:44 -0400 Received: from terminus.zytor.com ([65.50.211.136]:50299 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751754AbdF3Rxm (ORCPT ); Fri, 30 Jun 2017 13:53:42 -0400 Date: Fri, 30 Jun 2017 10:49:13 -0700 From: tip-bot for Josh Poimboeuf Message-ID: Cc: tglx@linutronix.de, torvalds@linux-foundation.org, jpoimboe@redhat.com, jslaby@suse.cz, luto@kernel.org, mingo@kernel.org, linux-kernel@vger.kernel.org, peterz@infradead.org, hpa@zytor.com Reply-To: linux-kernel@vger.kernel.org, peterz@infradead.org, hpa@zytor.com, mingo@kernel.org, luto@kernel.org, tglx@linutronix.de, torvalds@linux-foundation.org, jpoimboe@redhat.com, jslaby@suse.cz In-Reply-To: <20170630140934.mmwtpockvpupahro@treble> References: <20170630140934.mmwtpockvpupahro@treble> To: linux-tip-commits@vger.kernel.org Subject: [tip:core/objtool] objtool: Silence warnings for functions which use IRET Git-Commit-ID: 2513cbf9d622d85268655bfd787d4f004342cfc9 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3117 Lines: 79 Commit-ID: 2513cbf9d622d85268655bfd787d4f004342cfc9 Gitweb: http://git.kernel.org/tip/2513cbf9d622d85268655bfd787d4f004342cfc9 Author: Josh Poimboeuf AuthorDate: Fri, 30 Jun 2017 09:09:34 -0500 Committer: Ingo Molnar CommitDate: Fri, 30 Jun 2017 19:43:50 +0200 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: Ingo Molnar Signed-off-by: Josh Poimboeuf Cc: Andy Lutomirski Cc: Jiri Slaby Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: live-patching@vger.kernel.org Fixes: baa41469a7b9 ("objtool: Implement stack validation 2.0") Link: http://lkml.kernel.org/r/20170630140934.mmwtpockvpupahro@treble Signed-off-by: Ingo Molnar --- tools/objtool/check.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 2f80aa51..fea2221 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -100,6 +100,7 @@ static bool gcov_enabled(struct objtool_file *file) static bool ignore_func(struct objtool_file *file, struct symbol *func) { struct rela *rela; + struct instruction *insn; /* check for STACK_FRAME_NON_STANDARD */ if (file->whitelist && file->whitelist->rela) @@ -112,6 +113,11 @@ static bool ignore_func(struct objtool_file *file, struct symbol *func) 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; } @@ -1446,14 +1452,6 @@ static int validate_branch(struct objtool_file *file, struct instruction *first, 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: if (update_insn_state(insn, &state)) return -1;