Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5976508imm; Mon, 27 Aug 2018 07:37:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZaAQKjn7fNSUIkeTwBmjWaIvOQy1Hf3ywDMUy3SFi0I/msgiG3pwYHza39hIKpMBC+R0NA X-Received: by 2002:a65:5c83:: with SMTP id a3-v6mr12852159pgt.164.1535380632945; Mon, 27 Aug 2018 07:37:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535380632; cv=none; d=google.com; s=arc-20160816; b=OYdR+jbVfLcsfWNr33maZ0FZGPpYaqeE+Saqo/9BRSGnnyzbXSRAgiNYQXoQNdYpRN Y2Eqn5Y+uj04oL+HUnW+aBHpjOfYzp/Kff8/i0vLwEUYhcu0jACih1joPii/kVbrJH/8 peqZDF6QQCOc6Ex/ifOrpaluygtdNsVhg2D18eEcWQADLdgE5s35glpV1RBfsZprOw5q WEQg4APRW2OB7g+ccedIuhLg2gOTn5cSoh+ov/sZfy8+i/2G3LLNTKx7Ii9++KOU9i5m 1lVgY9BST1Rghz+YEWICv5x2EaNuI8V8XkKaMOn+uHs6B1LsyNLCTLE7BO4YSuxl+G9g KmQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=y/N1Ha7x2OfFa7fyx9/T0UTPr4udM1TUMbKSir4MdA4=; b=NeqCTeEHhmvWLjjMMRKFnt9Pn4SUY62wLYYbcfCJvu5K1coxFTShxzOXV/Rpa4wmcy 9tR6Ic55ZdDhnnDOI/jlI1apG5qTBTnb3M4nHJNI64COWr3DSHVUiNFB76J+RA52vrgO lOMZJZCQTPdANi7E0aiHODvzz/nMRhaAWdCHnq5E19Wi3B40130UfVhAvYKNJ3yTVKU7 zx7/Cz4LEHcq5Q3S6EzoBmE3BUOuB1pqsbIVUpy0eMEcw93RbuU0UgZaS6xUecPeEfSL BFoP+OzjSkypiqnJhnzhhCm0fDdcw3NlNVOFEobDxDbNgjUS5GrNj8HtYhi2Xdl8NCnW hWtQ== 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 m24-v6si15954896pfk.56.2018.08.27.07.36.34; Mon, 27 Aug 2018 07:37:12 -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 S1727702AbeH0SUm (ORCPT + 99 others); Mon, 27 Aug 2018 14:20:42 -0400 Received: from mx2.suse.de ([195.135.220.15]:50054 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727594AbeH0SUf (ORCPT ); Mon, 27 Aug 2018 14:20:35 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 34CFAAFEB; Mon, 27 Aug 2018 14:33:42 +0000 (UTC) From: Mian Yousaf Kaukab To: will.deacon@arm.com, marc.zyngier@arm.com Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robert.richter@cavium.com, cwu@amperecomputing.com, Mian Yousaf Kaukab Subject: [PATCH RESEND 5/6] arm64: add sysfs vulnerability show for speculative store bypass Date: Mon, 27 Aug 2018 16:33:09 +0200 Message-Id: <20180827143310.641-6-ykaukab@suse.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180827143310.641-1-ykaukab@suse.de> References: <20180827143310.641-1-ykaukab@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return status based no ssbd_state. Return string "Unknown" in case CONFIG_ARM64_SSBD is disabled or arch workaround2 is not available in the firmware. Signed-off-by: Mian Yousaf Kaukab --- arch/arm64/kernel/cpu_errata.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index 8469d3be7b15..8b60aa30a3fa 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -744,4 +744,24 @@ ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute *attr, return sprintf(buf, "Not affected\n"); } +ssize_t cpu_show_spec_store_bypass(struct device *dev, + struct device_attribute *attr, char *buf) +{ + switch (arm64_get_ssbd_state()) { + case ARM64_SSBD_MITIGATED: + return sprintf(buf, "Not affected\n"); + + case ARM64_SSBD_KERNEL: + case ARM64_SSBD_FORCE_ENABLE: + return sprintf(buf, + "Mitigation: Speculative Store Bypass disabled"); + + case ARM64_SSBD_FORCE_DISABLE: + return sprintf(buf, "Vulnerable\n"); + + default: /* ARM64_SSBD_UNKNOWN*/ + return sprintf(buf, "Unknown\n"); + } +} + #endif -- 2.11.0