Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3986936imm; Mon, 17 Sep 2018 06:31:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY9TvP5IDDMkdpgdr/R4wyNZYVwX0wLsWkJCPxb2lhG3LQcwpENVNiNqMPqNcJ7uAJx0mEZ X-Received: by 2002:a17:902:aa05:: with SMTP id be5-v6mr24810166plb.313.1537191068014; Mon, 17 Sep 2018 06:31:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537191067; cv=none; d=google.com; s=arc-20160816; b=vrj/f86sOnpJanLFqk/ok9beYq97FgEgn9EXUvXPZQyvDgCbt/V5+YEhGnrIVDzgEI OjxMxPmvguXdei/gBEaQcDkWZ6CxFnxgoZiPerv/AMnjM8M774kyxhjjCEbIhMMcCFha Dwskc1acOxaK3auhtFjs4WuYLx+GUMa30Vbbu1lN/WhadQTvJTY5Iu46lAGw2J+BLRbu vAPdmGFWvCnDzIp0JGC1KRWDwwQeEpL3kNTxa1fV7bVOu98RSJGQVc6hGU+fvk31SAHO bTLOzSLTpl0G6Rpu79DKrSiypDki37j7f/zX5NzRm+vEn+SKhcHY0+Ju3+4vdsDT7yuz tBdA== 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=vjqvk/uTGS9hl3sCPWqSGzY5dlzBXoPp7GSGDLaIvF0=; b=nWRItx/VLOMQpfWRHPFS1BwKLdsZzoSQgsKS5rZASsN8VAdfJUlIP6/8EnIE9ynGth WD9bA5pTntI16jEjjk+q85CKQ+H8ckNkU8Y484ZZTUNQjSQ3AopskKKjAHs81ZX0kJm6 kGq2EEo1vpx8arQhg0TywTB3akcPy9kWtVwN7H8f9WHvw1HxOfZpYGAI001o4YbWp3B6 RYy5+pya05fQo7pFPELfE4oO897RuTOQoA/43mkFk5OGP2xviEPXv9U2U+D3yAZh61F8 IB69ZCpzAYOoro3tbEFJkUzYHtS9pUXsuAMLSE51BISNk6MvVLyEXzlxgS/1nxIAmNZh ymfA== 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 g15-v6si15133658plo.284.2018.09.17.06.30.44; Mon, 17 Sep 2018 06:31:07 -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 S1728581AbeIQS5k (ORCPT + 99 others); Mon, 17 Sep 2018 14:57:40 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:59048 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728273AbeIQS5k (ORCPT ); Mon, 17 Sep 2018 14:57:40 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 063937A9; Mon, 17 Sep 2018 06:30:20 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CB0F93F557; Mon, 17 Sep 2018 06:30:19 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 62C191AE3063; Mon, 17 Sep 2018 14:30:38 +0100 (BST) Date: Mon, 17 Sep 2018 14:30:38 +0100 From: Will Deacon To: Mian Yousaf Kaukab Cc: marc.zyngier@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robert.richter@cavium.com, cwu@amperecomputing.com Subject: Re: [PATCH RESEND 2/6] arm64: add sysfs vulnerability show for meltdown Message-ID: <20180917133037.GB23040@arm.com> References: <20180827143310.641-1-ykaukab@suse.de> <20180827143310.641-3-ykaukab@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180827143310.641-3-ykaukab@suse.de> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 27, 2018 at 04:33:06PM +0200, Mian Yousaf Kaukab wrote: > Checking CSV3 support directly in case CONFIG_UNMAP_KERNEL_AT_EL0 > is not enabled. > > Signed-off-by: Mian Yousaf Kaukab > --- > arch/arm64/kernel/cpu_errata.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c > index dec10898d688..996edb4e18ad 100644 > --- a/arch/arm64/kernel/cpu_errata.c > +++ b/arch/arm64/kernel/cpu_errata.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > > static bool __maybe_unused > is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope) > @@ -683,3 +684,26 @@ const struct arm64_cpu_capabilities arm64_errata[] = { > { > } > }; > + > +#ifdef CONFIG_GENERIC_CPU_VULNERABILITIES > + > +ssize_t cpu_show_meltdown(struct device *dev, struct device_attribute *attr, > + char *buf) > +{ > + u64 pfr0; > + u32 csv3; > + > + if (arm64_kernel_unmapped_at_el0()) > + return sprintf(buf, "Mitigation: KPTI\n"); > + > + pfr0 = read_cpuid(ID_AA64PFR0_EL1); > + csv3 = cpuid_feature_extract_unsigned_field(pfr0, > + ID_AA64PFR0_CSV3_SHIFT); > + > + if (csv3 || is_cpu_meltdown_safe()) > + return sprintf(buf, "Not affected\n"); > + > + return sprintf(buf, "Vulnerable\n"); This should say something like "Unknown", since we don't actually have a reliable way to determine that a CPU is vulnerable. That's also a large part of the reason why we haven't bothered implementing the sysfs interface so far. Will