From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754477AbdHUON6 (ORCPT ); Mon, 21 Aug 2017 10:13:58 -0400 Received: from terminus.zytor.com ([65.50.211.136]:55235 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754413AbdHUON4 (ORCPT ); Mon, 21 Aug 2017 10:13:56 -0400 Date: Mon, 21 Aug 2017 07:10:03 -0700 From: tip-bot for Josh Poimboeuf Message-ID: Cc: hpa@zytor.com, torvalds@linux-foundation.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, fengguang.wu@intel.com, peterz@infradead.org, jpoimboe@redhat.com, mingo@kernel.org Reply-To: hpa@zytor.com, peterz@infradead.org, fengguang.wu@intel.com, tglx@linutronix.de, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, jpoimboe@redhat.com, mingo@kernel.org In-Reply-To: <43e7aae9a7a7710cd6df597fa9dc501da4ba0602.1502472193.git.jpoimboe@redhat.com> References: <43e7aae9a7a7710cd6df597fa9dc501da4ba0602.1502472193.git.jpoimboe@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] objtool: Fix objtool fallthrough detection with function padding Git-Commit-ID: ee97638b5737cc0dba2f12a3bdcda761656b7c01 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 Commit-ID: ee97638b5737cc0dba2f12a3bdcda761656b7c01 Gitweb: http://git.kernel.org/tip/ee97638b5737cc0dba2f12a3bdcda761656b7c01 Author: Josh Poimboeuf AuthorDate: Fri, 11 Aug 2017 12:24:15 -0500 Committer: Ingo Molnar CommitDate: Mon, 21 Aug 2017 16:06:05 +0200 objtool: Fix objtool fallthrough detection with function padding When GCC adds NOP padding between functions, those NOPs aren't associated with a function symbol, which breaks objtool's detection of a function falling through to another function. Instead it shows confusing errors like: drivers/mtd/chips/cfi_util.o: warning: objtool: cfi_qry_mode_on()+0x8b: return with modified stack frame drivers/mtd/chips/cfi_util.o: warning: objtool: cfi_qry_mode_on()+0x0: stack state mismatch: cfa1=-4-32 cfa2=7+8 drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: fixup_use_fwh_lock()+0x8: unknown stack-related register move drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: fixup_use_fwh_lock()+0x0: stack state mismatch: cfa1=6+16 cfa2=7+8 drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: do_otp_write()+0xa: unsupported stack pointer realignment drivers/mtd/chips/cfi_cmdset_0002.o: warning: objtool: do_otp_write()+0x0: stack state mismatch: cfa1=-4-40 cfa2=7+8 Reported-by: kbuild test robot Signed-off-by: Josh Poimboeuf Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/43e7aae9a7a7710cd6df597fa9dc501da4ba0602.1502472193.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar --- tools/objtool/check.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 1737592..3dffeb9 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1536,15 +1536,15 @@ static int validate_branch(struct objtool_file *file, struct instruction *first, while (1) { next_insn = next_insn_same_sec(file, insn); - if (file->c_file && insn->func) { - if (func && func != insn->func) { - WARN("%s() falls through to next function %s()", - func->name, insn->func->name); - return 1; - } + + if (file->c_file && func && insn->func && func != insn->func) { + WARN("%s() falls through to next function %s()", + func->name, insn->func->name); + return 1; } - func = insn->func; + if (insn->func) + func = insn->func; if (func && insn->ignore) { WARN_FUNC("BUG: why am I validating an ignored function?",