Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3567857imm; Wed, 5 Sep 2018 02:15:00 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZzsVFTZjCK8PZq8OJyWqPPHxOYqI9pMVacjeYcF8GMrhZjMArZNwzPxiEDRHDJPJZIzpos X-Received: by 2002:a65:6398:: with SMTP id h24-v6mr35902471pgv.245.1536138900207; Wed, 05 Sep 2018 02:15:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536138900; cv=none; d=google.com; s=arc-20160816; b=Xtbh1M/LLKebtZdyHSyv+t7UyYAl5Njd6WoQyzJFCr8qVsxX22V1FX9E7VVfrIIfQ5 IUVGIcmOhanyX2bS+seEWTxxh8qtefg3ij7lVJVUNdb1pq3NoiftPvkqK+aASWGr0SfX Nzl0eKlIPcOssFcVQdpM97ItYIABGSiDPhx1ZOB+S8KuAmYIfSbCw7exiJV4OhH8q+0g JMKbYeMrPO4tsfpmSHK0RMZ8grUsvA9VfF3ftSC1RBvuVU12tXyVVIrVzbABRuRLwUS5 0R/w1vxjBSd1eWJibFHNNvzJWwUfAWXC8yl5RvZL61FDSE2xpGVQoHbRINHgh1PnZRJP V4zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Dn4IXkDa828fNFocx+IZqqpKwauhWpzrQA8B1kw1MXs=; b=wKPM82flqRgEOZtRSXegqhkJP2I6ICmoAqZhSwIxZTULoQ7affNDWYk+urmXCGB1mu cIkTZcOYVQDcUSNIBOTUQoJ13j/9Xn9QWR7eWqgUfhApaIdaCu+e0mR7gNqMDMgh43BT OXUw0IQ6CCk20Rt3eN+mZO6nQc9Q1TKYJhtN3E2hJdeoLi+x1/UDOgAhlahar4Kz5JRg 5MpKlYMlARc58IxVRSQ7821O3MzHSQ0QG/H6exoPFWt8m7muVWWcIiKY/rHM3dSo/FW2 us45zMZpSp/hHq5zTubPWu+HjzevO0DBRh3nbGf7UtBGwpOyYJ/SUlBARB6bMKLqSeEN FCPQ== 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 b5-v6si1367695ple.241.2018.09.05.02.14.44; Wed, 05 Sep 2018 02:15: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; 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 S1727956AbeIENm4 (ORCPT + 99 others); Wed, 5 Sep 2018 09:42:56 -0400 Received: from mail.skyhub.de ([5.9.137.197]:54096 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726272AbeIENm4 (ORCPT ); Wed, 5 Sep 2018 09:42:56 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id NyJjGhX7WFYN; Wed, 5 Sep 2018 11:13:21 +0200 (CEST) Received: from zn.tnic (p200300EC2BCBB900329C23FFFEA6A903.dip0.t-ipconnect.de [IPv6:2003:ec:2bcb:b900:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 1460F1EC01AF; Wed, 5 Sep 2018 11:13:21 +0200 (CEST) Date: Wed, 5 Sep 2018 11:13:09 +0200 From: Borislav Petkov To: Pu Wen Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, thomas.lendacky@amd.com, pbonzini@redhat.com, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: Re: [PATCH v5 09/16] x86/bugs: add lfence mitigation to spectre v2 and no meltdown for Hygon Message-ID: <20180905091309.GB2237@zn.tnic> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 29, 2018 at 08:44:41PM +0800, Pu Wen wrote: > To share codes between AMD and Hygon to mitigate Spectre V2 Retpoline > vulnerability, rename macros SPECTRE_V2_RETPOLINE_MINIMAL_AMD to > SPECTRE_V2_RETPOLINE_MINIMAL_LFENCE, and SPECTRE_V2_CMD_RETPOLINE_AMD > to SPECTRE_V2_CMD_RETPOLINE_LFENCE. > > As Hygon processors are not affected by meltdown vulnerability as AMD's, > so add exception in array cpu_no_meltdown[] for Hygon. > > Signed-off-by: Pu Wen > --- > arch/x86/include/asm/nospec-branch.h | 4 ++-- > arch/x86/kernel/cpu/bugs.c | 28 +++++++++++++++------------- > arch/x86/kernel/cpu/common.c | 1 + > 3 files changed, 18 insertions(+), 15 deletions(-) > > diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h > index fd2a8c1..6763f9b 100644 > --- a/arch/x86/include/asm/nospec-branch.h > +++ b/arch/x86/include/asm/nospec-branch.h > @@ -211,9 +211,9 @@ > enum spectre_v2_mitigation { > SPECTRE_V2_NONE, > SPECTRE_V2_RETPOLINE_MINIMAL, > - SPECTRE_V2_RETPOLINE_MINIMAL_AMD, > + SPECTRE_V2_RETPOLINE_MINIMAL_LFENCE, > SPECTRE_V2_RETPOLINE_GENERIC, > - SPECTRE_V2_RETPOLINE_AMD, > + SPECTRE_V2_RETPOLINE_LFENCE, > SPECTRE_V2_IBRS_ENHANCED, > }; > > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c > index 4c2313d..15be045 100644 > --- a/arch/x86/kernel/cpu/bugs.c > +++ b/arch/x86/kernel/cpu/bugs.c > @@ -132,15 +132,15 @@ enum spectre_v2_mitigation_cmd { > SPECTRE_V2_CMD_FORCE, > SPECTRE_V2_CMD_RETPOLINE, > SPECTRE_V2_CMD_RETPOLINE_GENERIC, > - SPECTRE_V2_CMD_RETPOLINE_AMD, > + SPECTRE_V2_CMD_RETPOLINE_LFENCE, > }; > > static const char *spectre_v2_strings[] = { > [SPECTRE_V2_NONE] = "Vulnerable", > [SPECTRE_V2_RETPOLINE_MINIMAL] = "Vulnerable: Minimal generic ASM retpoline", > - [SPECTRE_V2_RETPOLINE_MINIMAL_AMD] = "Vulnerable: Minimal AMD ASM retpoline", > + [SPECTRE_V2_RETPOLINE_MINIMAL_LFENCE] = "Vulnerable: Minimal LFENCE ASM retpoline", > [SPECTRE_V2_RETPOLINE_GENERIC] = "Mitigation: Full generic retpoline", > - [SPECTRE_V2_RETPOLINE_AMD] = "Mitigation: Full AMD retpoline", > + [SPECTRE_V2_RETPOLINE_LFENCE] = "Mitigation: Full LFENCE retpoline", > [SPECTRE_V2_IBRS_ENHANCED] = "Mitigation: Enhanced IBRS", > }; This is user-visible and with all the back'n'forth and backporting and the whole security fiasco, I don't want to have another source of confusion. You'll have to live with it saying "AMD" in dmesg. > @@ -272,7 +272,7 @@ static const struct { > { "off", SPECTRE_V2_CMD_NONE, false }, > { "on", SPECTRE_V2_CMD_FORCE, true }, > { "retpoline", SPECTRE_V2_CMD_RETPOLINE, false }, > - { "retpoline,amd", SPECTRE_V2_CMD_RETPOLINE_AMD, false }, > + { "retpoline,lfence", SPECTRE_V2_CMD_RETPOLINE_LFENCE, false }, > { "retpoline,generic", SPECTRE_V2_CMD_RETPOLINE_GENERIC, false }, > { "auto", SPECTRE_V2_CMD_AUTO, false }, > }; This even more so. Those are command line strings which we're still communicating to people, even. So no, it needs to remain "retpoline,amd" on Hygon. And then to not confuse people staring at the code either, we can drop this change too: - SPECTRE_V2_CMD_RETPOLINE_AMD, + SPECTRE_V2_CMD_RETPOLINE_LFENCE, Which leaves this patch only with the addition of the vendor tests. The other stuff you can drop. Thx. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.