Received: by 10.192.165.148 with SMTP id m20csp754506imm; Fri, 27 Apr 2018 07:02:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrMcF/zlqpipPb29AayOZdJcx1xg5d37CHpIMAJvSf/KEr2NlWfL8cTO/o4GlSNcHeyOQrL X-Received: by 2002:a63:8c0e:: with SMTP id m14-v6mr2288439pgd.320.1524837778206; Fri, 27 Apr 2018 07:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524837778; cv=none; d=google.com; s=arc-20160816; b=kCifjRIFLe+hHJVk+zu6beFloU40lZIrvVqowtjhht4klFOO8V7k3m3qxX/q+m0owA Gp/LP4DovdpGK1g19aPf/B7NypJ9XnDTSHJxPTx0wGAscEZQmAp2/rRA/+hDxme5Dbev WdOiQ/SaQddKppee5nMCkrgXHOLmXO7/g8A5E3zeeKIOUANjS7bj7aJPI8JSdpxpgCve lzulpdeGdHdnUnbl00tk4cvafKy1wuQu7QlClxJBUN06AjbWndKqiBNRgszXQioDN8X5 RCCX4We1orDMCOSxQkYs4oAP5Io40IIwCoAXlmDbdYuYkybwDiO1N2eCK7mvP3AiWAPX dviw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=nmw+1LB6lUVxdhEvHUHuwAWWEcU1+nskEvEc95nYkks=; b=a2LNJCUwxLG3WMVyGn8M5Joi+Zzp/DPqpVigU15aolbrPNr7d5sTfNfU9IYTXumFRq YoBhUhdve8q7iK1osxgowIacbVThuoBvli0tjmJyluL6gjIC/8fIYYib7pJOHddN0F74 U8vGBp//y/mMjosrMB7QSGXiu4FWEtrDY+iVve7WtvHq8nNCK08iAydH9F78wb4sR+c7 B06qwvO50EoHcuPM/KHxDgXXmudWM77qUElQcNN5wFH4OK4c4wMq7F+qyMg72l5lS8BV A+dQBrGluWAk8rt7c12ixOiJBgbA+rGt71KiEr6AnwW2T8B0pO7zEuh0YROo/iWEUW9i iu3g== 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 h10-v6si1290396pgn.30.2018.04.27.07.02.43; Fri, 27 Apr 2018 07:02:58 -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 S933132AbeD0OBU (ORCPT + 99 others); Fri, 27 Apr 2018 10:01:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:48292 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932862AbeD0OBR (ORCPT ); Fri, 27 Apr 2018 10:01:17 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 67F1A2189D; Fri, 27 Apr 2018 14:01:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67F1A2189D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Schwidefsky Subject: [PATCH 4.4 25/50] s390: add sysfs attributes for spectre Date: Fri, 27 Apr 2018 15:58:27 +0200 Message-Id: <20180427135657.196294626@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135655.623669681@linuxfoundation.org> References: <20180427135655.623669681@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martin Schwidefsky [ Upstream commit d424986f1d6b16079b3231db0314923f4f8deed1 ] Set CONFIG_GENERIC_CPU_VULNERABILITIES and provide the two functions cpu_show_spectre_v1 and cpu_show_spectre_v2 to report the spectre mitigations. Signed-off-by: Martin Schwidefsky Signed-off-by: Greg Kroah-Hartman --- arch/s390/Kconfig | 1 + arch/s390/kernel/nospec-branch.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -111,6 +111,7 @@ config S390 select GENERIC_CLOCKEVENTS select GENERIC_CPU_AUTOPROBE select GENERIC_CPU_DEVICES if !SMP + select GENERIC_CPU_VULNERABILITIES select GENERIC_FIND_FIRST_BIT select GENERIC_SMP_IDLE_THREAD select GENERIC_TIME_VSYSCALL --- a/arch/s390/kernel/nospec-branch.c +++ b/arch/s390/kernel/nospec-branch.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #include +#include #include #include @@ -43,6 +44,24 @@ static int __init nospec_report(void) } arch_initcall(nospec_report); +#ifdef CONFIG_SYSFS +ssize_t cpu_show_spectre_v1(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "Mitigation: __user pointer sanitization\n"); +} + +ssize_t cpu_show_spectre_v2(struct device *dev, + struct device_attribute *attr, char *buf) +{ + if (IS_ENABLED(CC_USING_EXPOLINE) && !nospec_disable) + return sprintf(buf, "Mitigation: execute trampolines\n"); + if (__test_facility(82, S390_lowcore.alt_stfle_fac_list)) + return sprintf(buf, "Mitigation: limited branch prediction.\n"); + return sprintf(buf, "Vulnerable\n"); +} +#endif + #ifdef CONFIG_EXPOLINE int nospec_disable = IS_ENABLED(CONFIG_EXPOLINE_OFF);