Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp10493ybm; Mon, 20 May 2019 10:58:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqzmVGZWFsgEol71sX+nwnEgZyNerVEL9or+xOgVOkRemzzYWnjBw+V+vGSHMkbKdf5dYz4A X-Received: by 2002:a63:5516:: with SMTP id j22mr73114233pgb.370.1558375080140; Mon, 20 May 2019 10:58:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558375080; cv=none; d=google.com; s=arc-20160816; b=EnwArZ59T5eEkoH4wzWIoO0gEsLx4rhiUk/h+o/W2yuoMI/Mj05mh7LmZIIRM7oQ8M PUL/4SRx6I3QHa1ZPPGgUNnk/AS9BUvfJKUWludzHV4PwVTQd9Ms3lszwFZhKk22DJvl E+DspP/TF37l4mccF7PlTG4KCClWV3HG1dvTlr3bVpDm1Jl748BahjW8S+he8K/RqXdu +Ysam25M+cHXzWvM1mpYfzRNecroIbaIZgG7bpQ6SZ6783FpO/2bkNyJ2DW2R7MH94AB OxdZzV+HeHVNPCoqBJs/eRbSQPq7bHKlPuDOQ9RxndSTAjiAX83690O/j08S+DGTdNrh 11zg== 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=ikC5DAN/0qw3HLJxZtFZ2vQ19kvTxLoQPQGsAKgFcP4=; b=vTE4zpg4N1Pw82YYIhUzBZtoEbnLW5n6fTzxtNsoI1ec8uhYqDqO2TlsgfeljkPXYF zZX4A2YwvYJXWwrXkOchNuClMyWz+7ulrGJ/uyd4Th1+xoOit+U2m3L8QInwQW9QRHY7 0Bgapk9OzkPbwtW6a0qX6lSUJjsldORNqZIQwnP65Pdnp6xWldzs3i/HrliktvPSHytv JqhjcEVlsuvELwFQhY3DcIBaw/83xhVvWqxrh3unuG0O7niBmqTMoDZyC5iIHm8ndSyJ ZUSgxVLGSgA9nvVdzMLeZEFScUY8BXQgJxAj8LR1cp1BbMd7ky2j2YfYZN1/j8QuG7NJ 7cvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JmvzfRwc; 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 d35si8659048pla.419.2019.05.20.10.57.44; Mon, 20 May 2019 10:58:00 -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=JmvzfRwc; 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 S2388859AbfETMtY (ORCPT + 99 others); Mon, 20 May 2019 08:49:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:35462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388217AbfETMVl (ORCPT ); Mon, 20 May 2019 08:21:41 -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 DB623214DA; Mon, 20 May 2019 12:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558354900; bh=OqHY8Qw7LegAJ5t/eeqWdM5SLO1JP6d63q0FvuMvqvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JmvzfRwcFsSE9eMEFWBw3J0C1Rt76aZmb3CNA9hZTSp9A28RpkJVs/+FT8YobiR7z H/cBdDZh/56SpSnFmQ0iplGQfmrGCetWx4QD4QHU8LeQgbeehq6tW7GzlOd9NfdjfD rUof4Fx8m1fh5WP4tzV+SB+IIJKGEFWABcXnXBzE= 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.19 004/105] objtool: Fix function fallthrough detection Date: Mon, 20 May 2019 14:13:10 +0200 Message-Id: <20190520115247.360646287@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115247.060821231@linuxfoundation.org> References: <20190520115247.060821231@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 @@ -1805,7 +1805,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?",