Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp222992yba; Mon, 20 May 2019 07:40:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXkyjeiSGMnq6aXGi0Z8wxiAtftTpFnaumEY772H8IDFXHNxo9CTWWM6nPps9UO9Xsiq02 X-Received: by 2002:a62:1b85:: with SMTP id b127mr52651383pfb.165.1558363215825; Mon, 20 May 2019 07:40:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558363215; cv=none; d=google.com; s=arc-20160816; b=tm12NXDiRuRf14QMEcyh18oHJMS6VwmrLm0cID3Xcpv8WRIPAvAxnSxpWUm1Ku55Ml UiAvhT5xMbAbxdBPWm310EVkr+IChUjJ7yGxt+2nt6UkVBOUFvIxVRKCFk30pRGBkEVD TyBq89cIB3auGqJY3eLZW2IkDrveokEJTJhUVrHvPYSmZ0j2DVGV8QoOZVmfGRrKP8iq yrCXq1XEcKwr0Sp5ZomX5MmGm6QEwH+T9omR36FVru0hPcYKWO07ogl2z6gP891+55re Anj4byVfTetLTMIV0YI5zzRl4U59wwJ+ufXtZRsbbxG2SAb3//IaysufFzb0w+TzzAQe HTZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K2XrojiCyn1FtEIbNf4jSq9sVBgcnWVGLfHZ72t18Dk=; b=acFCcPUFXaBTpvrd2yP9EvgSd3YtFcOGwnYoowsjhazCFCpKNeqS3WqEMosAQnMJpS sL2lK8x9K6Gh2CILe6p0wCB/+fcBRbI6WyCaZUPEChOLW8qWAxNM5G9mCoWK83cz8zzT Ur1RINgpXUHKVxDwcGEwk1WgtPyFOAZCU8k6XKr7voEBNS39HRMozrQY8lok8/XMGHHv zh+WdmdjuQ8sElgOvI6KCTlQjx6692wgeSNMy2Yv7u4b3gUkk1RZg9CZYgrvNyNW2/Op QEzw/ki9aahMIX0w01hUc1hp4NW9fQQMdFtiBIZBVn+unctmbCU/vJgAWdmvu+v3wCRV SdRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qYRqJh6z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f2si19471517pln.360.2019.05.20.07.40.00; Mon, 20 May 2019 07:40:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qYRqJh6z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387750AbfETMSw (ORCPT + 99 others); Mon, 20 May 2019 08:18:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:59926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387733AbfETMSp (ORCPT ); Mon, 20 May 2019 08:18:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1E092208C3; Mon, 20 May 2019 12:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558354724; bh=sL+t5AjFEQojtzLpmh7ftp1Yt8bKym9IQMcQwFTwJEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qYRqJh6zw7CBGG0yR0qAes5HBRtMpCKHgdTSrdy9Z3YL4kMKrb0ygtGozG1q6vkoA g2s939mFkSpYBliCwhxrI5ryLPG+mHtnBlTY4fGWw5MqcO4RIQXC78ekX8EEMjujp6 fij/52ptWFMDFICkRibc58eyshprucySXcsLSF8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kbuild test robot , Josh Poimboeuf , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Ingo Molnar Subject: [PATCH 4.14 08/63] objtool: Fix function fallthrough detection Date: Mon, 20 May 2019 14:13:47 +0200 Message-Id: <20190520115232.235909099@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115231.137981521@linuxfoundation.org> References: <20190520115231.137981521@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josh Poimboeuf commit e6f393bc939d566ce3def71232d8013de9aaadde upstream. When a function falls through to the next function due to a compiler bug, objtool prints some obscure warnings. For example: drivers/regulator/core.o: warning: objtool: regulator_count_voltages()+0x95: return with modified stack frame drivers/regulator/core.o: warning: objtool: regulator_count_voltages()+0x0: stack state mismatch: cfa1=7+32 cfa2=7+8 Instead it should be printing: drivers/regulator/core.o: warning: objtool: regulator_supply_is_couple() falls through to next function regulator_count_voltages() This used to work, but was broken by the following commit: 13810435b9a7 ("objtool: Support GCC 8's cold subfunctions") The padding nops at the end of a function aren't actually part of the function, as defined by the symbol table. So the 'func' variable in validate_branch() is getting cleared to NULL when a padding nop is encountered, breaking the fallthrough detection. If the current instruction doesn't have a function associated with it, just consider it to be part of the previously detected function by not overwriting the previous value of 'func'. Reported-by: kbuild test robot Signed-off-by: Josh Poimboeuf Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Fixes: 13810435b9a7 ("objtool: Support GCC 8's cold subfunctions") Link: http://lkml.kernel.org/r/546d143820cd08a46624ae8440d093dd6c902cae.1557766718.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- tools/objtool/check.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1779,7 +1779,8 @@ static int validate_branch(struct objtoo return 1; } - func = insn->func ? insn->func->pfunc : NULL; + if (insn->func) + func = insn->func->pfunc; if (func && insn->ignore) { WARN_FUNC("BUG: why am I validating an ignored function?",