Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3512492imm; Tue, 29 May 2018 08:28:48 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr8ObrNuyk0eSOlCB3FAoh+45g1dYFKBZQBP2TpdPIaJVANRxYqgR1GOtd9VIVmYHXqahQ1 X-Received: by 2002:a17:902:5851:: with SMTP id f17-v6mr18343636plj.32.1527607728642; Tue, 29 May 2018 08:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527607728; cv=none; d=google.com; s=arc-20160816; b=TpsAu/+BauPtNS35Ko+KiZglPhguK7P13r56kSFeJl/x6tuSwi6YJ5rCScZ/HI9T41 nHx/1bTPjoD+HNHarbY2Cenupw00J1kPhdVf8AiNsSS0QdTaPX2fsRbDQsuZ2VFBokeN +GTn4a74YtxoMIWEgRJYpCep/i4JITS83hTzlXNEBcyfLxUau5IbfIqhT73AW85hPeZm 0IkyAgQCCEMtLtb48b8h2JwIwVeCsKAYgReSD/4B+ZvN3EDR+0gCOMqW/3WPZmLqxgOg 7PUMO1p8oJ+cs0c+lFW6mbUvFFU+gXPswtgCIoGZMCSnXGv5/5N5+DcprRHR1IHKKYF7 MA9Q== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=EQYQivOeIVKwQbB11FLV7/neTS58kPkQuRshq054pGE=; b=WC+lifizgFqc6wP2pGVj9kfHi5NFdnBojK6hV3LRf7Nbk89V3MWdXYtABNkPv9yRdu qksxZVOExdSf2bQCvE5Aq/7onFsK99lVnlLBWUg7/af8b8NHH/6tSdSdHJFCbw83+aay l1FcpUsmKOgYH3nIsVBzKERV81is63PmVUXYKXHLDKXdTIngVxC9E66K/WDNHzloOq7D 8mActaACDX/PkJTxvkIdydaLpjfvygjM+oqy0UWPFy6ZtQY3jH3ys/8LFVUpBP9YY0VK qvwhX4mNH3DPfLL/2cLozbkWYL26vTDHYfzxIoQQxyC9tugOpX37l1M0PpOL5TBbC7AA BrBg== ARC-Authentication-Results: i=1; mx.google.com; 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 y7-v6si2121998pgo.81.2018.05.29.08.28.33; Tue, 29 May 2018 08:28:48 -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; 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 S936493AbeE2P2K (ORCPT + 99 others); Tue, 29 May 2018 11:28:10 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:61799 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935620AbeE2P2A (ORCPT ); Tue, 29 May 2018 11:28:00 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 40wHfj0MKLz9v0XD; Tue, 29 May 2018 17:27:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id HAOpi1E0agmR; Tue, 29 May 2018 17:27:56 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 40wHfh6szdz9v0XC; Tue, 29 May 2018 17:27:56 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 9468B8BB31; Tue, 29 May 2018 17:27:58 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id MCjw4pQYF_2X; Tue, 29 May 2018 17:27:58 +0200 (CEST) Received: from po14934vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.2]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4C8DA8BB2F; Tue, 29 May 2018 17:27:58 +0200 (CEST) Subject: Re: [PATCH] powerpc/64s: Enhance the information in cpu_show_spectre_v1() To: =?UTF-8?Q?Michal_Such=c3=a1nek?= Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Mauricio Faria de Oliveira , Nicholas Piggin , Michael Neuling , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20180424041559.32410-1-mpe@ellerman.id.au> <20180528131914.32231-1-msuchanek@suse.de> <1b720765-faf1-719e-ab76-b3eafa559896@c-s.fr> <20180529164640.02faedcd@kitsune.suse.cz> From: Christophe Leroy Message-ID: <59492aa2-a12d-4f74-0a5a-14f89de64908@c-s.fr> Date: Tue, 29 May 2018 15:24:42 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180529164640.02faedcd@kitsune.suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/29/2018 02:46 PM, Michal Suchánek wrote: > On Tue, 29 May 2018 16:13:49 +0200 > Christophe LEROY wrote: > >> Le 28/05/2018 à 15:19, Michal Suchanek a écrit : >>> We now have barrier_nospec as mitigation so print it in >>> cpu_show_spectre_v1 when enabled. >>> >>> Signed-off-by: Michal Suchanek >>> --- >>> arch/powerpc/kernel/security.c | 5 ++++- >>> 1 file changed, 4 insertions(+), 1 deletion(-) >>> >>> diff --git a/arch/powerpc/kernel/security.c >>> b/arch/powerpc/kernel/security.c index 0239383c7e4d..a0c32d53980b >>> 100644 --- a/arch/powerpc/kernel/security.c >>> +++ b/arch/powerpc/kernel/security.c >>> @@ -120,7 +120,10 @@ ssize_t cpu_show_spectre_v1(struct device >>> *dev, struct device_attribute *attr, c if >>> (!security_ftr_enabled(SEC_FTR_BNDS_CHK_SPEC_BAR)) return >>> sprintf(buf, "Not affected\n"); >>> - return sprintf(buf, "Vulnerable\n"); >>> + if (barrier_nospec_enabled) >> >>> + return sprintf(buf, "Mitigation: __user pointer >>> sanitization\n"); >>> + else >>> + return sprintf(buf, "Vulnerable\n"); >> >> Checkpatch would tell you that an else is unneeded after a return. So >> just leave it as it was before. > > Where did you get your copy of checkpatch? The one in Linux tree does > not do that. Strange, it should, as checkpatch.pl includes the following code: # check indentation of any line with a bare else # (but not if it is a multiple line "if (foo) return bar; else return baz;") # if the previous line is a break or return and is indented 1 tab more... if ($sline =~ /^\+([\t]+)(?:}[ \t]*)?else(?:[ \t]*{)?\s*$/) { my $tabs = length($1) + 1; if ($prevline =~ /^\+\t{$tabs,$tabs}break\b/ || ($prevline =~ /^\+\t{$tabs,$tabs}return\b/ && defined $lines[$linenr] && $lines[$linenr] !~ /^[ \+]\t{$tabs,$tabs}return/)) { WARN("UNNECESSARY_ELSE", "else is not generally useful after a break or return\n" . $hereprev); } } Anyway, you should remove that 'else' in your patch. And the other sprintf line is over 80 characters. Christophe > > Thanks > > Michal >