Received: by 10.192.165.148 with SMTP id m20csp803768imm; Fri, 27 Apr 2018 07:47:12 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpc9WfIRnmRkcz0FHRlzTfei0gO+TOtB8eQLg+crbWRh/E/Lae5MtujdgqEppG4S88b0fRH X-Received: by 2002:a63:91c4:: with SMTP id l187-v6mr2369410pge.261.1524840432896; Fri, 27 Apr 2018 07:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524840432; cv=none; d=google.com; s=arc-20160816; b=GLffw+B8llKCG/0n/qLha9K8Py3BnoHw8GITVYTdvbx2KIjhTTgchWGO4zt7bwLcSQ VbsWOVAA8q8+IqVl4AAP0Rzl76qFr43QWa8CDO0myxZg3oQt43paNh9EfVQrF6I9woYB lSgjeirJr8Ri4mD5pIuv/gYrqQcMPW8Dm30Xl7h5mlVfgP9oXnkNu9iZq8s4fc0bcJW8 Rn8JNIFn3durd6pKLfMD/F01VoTmZeSXHlabW0UeO9VeSZ9nFmw8HMTOVMgQIAsp63H0 TXoqNbZFkjPTAG2Xii0sdCNEljGK6fSR08N/pWVfApdFNDFrKX9UCDnBjA/2jpJkpJJz ujXw== 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=+lTDjlQSb87htV9LUr934oKBySe5/YMgjJzwSOL5xIk=; b=QJnsHkjQ0P4T6Dp0svC2h9iekdoIJFf5snYnioh4Zcg4t8hz1ZROy6cXoYIMAZsRK8 nfj1WvjVUfWOh67FbohCf0MtFsXBuD3WG3pEoeOQkXdYckTWq8/A4THJZM8SivnjWDdA xfHaQbjDUgxBPOboJTuBiPj/D5NRi1R1EDxRRBvg2azwNKtxVojmdzirp+DwPbIW4oj5 JHx3Tc11yusHcYyUG9AxogtQUkv8zK3pSSsB7lFoTjrS2C6+Ill7UM1pUXrf6ppAGwmd o7fjdTdczCTiNw2dMkk0eVGQ6M/xys0eTY4N1aVqC0zYvt8t+VdHeTX3fUvxZ03cFA4E gTEQ== 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 i35-v6si1344420plg.504.2018.04.27.07.46.58; Fri, 27 Apr 2018 07:47: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 S934468AbeD0OIR (ORCPT + 99 others); Fri, 27 Apr 2018 10:08:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:53864 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934455AbeD0OIO (ORCPT ); Fri, 27 Apr 2018 10:08:14 -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 75EF521864; Fri, 27 Apr 2018 14:08:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 75EF521864 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.14 58/80] s390: add sysfs attributes for spectre Date: Fri, 27 Apr 2018 15:58:51 +0200 Message-Id: <20180427135735.892417405@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135732.928644313@linuxfoundation.org> References: <20180427135732.928644313@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.14-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 @@ -121,6 +121,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);