Received: by 10.192.165.148 with SMTP id m20csp830626imm; Fri, 27 Apr 2018 08:11:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqJQWzuGy+X5/EqViiBd9IGSpoFYE0h0NcWXO9kwL0aPgbS4P0cud1PX2HgyuqzoIEnIwby X-Received: by 2002:a65:5141:: with SMTP id g1-v6mr2535651pgq.104.1524841862696; Fri, 27 Apr 2018 08:11:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524841862; cv=none; d=google.com; s=arc-20160816; b=PMkBSzcdoFQYG9OEMFY+uxkgpEsi8yPcHwMCHZyeG/iR0E3mVwUvIBPLlI8Gp0pBm0 w1bL3el6FxtjtUhh7HHY1BpIu+clhQFzLniZ+aLki1YcHJyz5NXhBnXMfLodecwqWTn7 +mPl7uPxLbjPTejp/ii65GN7nnP9Vnw6uG+lZCAnyJgIzyrlDlaWtiO7eAE+fXNhk5Mu ch6pF5Cmc0U/X2X46utkMm4JbrLIcTikE8IzNhP4JW5MOFd+6/Cedao+g14kpEjlcjD1 DeMBsyFC1f8lG1lfGNGX9+GA38VREcYnXoD5r5Hb5/5P12cQfdHikdn1blXRyp+cqDLm 24yg== 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=YWP5TC4hPzNbgvsjUHGz3fZWR9mENsIjRLe1yseZaa0=; b=b5bJ6AzoV/pYpD4xc26QA2Z4N1gQ4RmiW27X+ljRgyQYxKQry2qkTH25hx2mu7Qq9S vYwPGYjDQwZS4cfOA8bI3PWscurGO9+9dASoMbXNvWAi23SFc4tof79r4QUsoMlsjA8M WCza6XSicbFIz87AOBUuH8+Ql3Cj0JmsDD2uxHXSHTZ9nNibElJ1ueTShzVIbRQIWShY CigR2oVZdMIsAeHY6tbmyUgRSAYsYUs4MAI54UTiORAKTOPC3FocQUCgA+gCjYn8Viuc 4dGoaB+DUjuiFWH2wKNgjgKU4fUCIxaGdBCm854Pgn3pmIHxGJYIP2lwuUyon3Dnk1DO iYjg== 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 b6-v6si1364814plx.211.2018.04.27.08.10.48; Fri, 27 Apr 2018 08:11:02 -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 S933842AbeD0PJn (ORCPT + 99 others); Fri, 27 Apr 2018 11:09:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:50750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933693AbeD0OEY (ORCPT ); Fri, 27 Apr 2018 10:04:24 -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 084912189D; Fri, 27 Apr 2018 14:04:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 084912189D 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.9 44/74] s390: add sysfs attributes for spectre Date: Fri, 27 Apr 2018 15:58:34 +0200 Message-Id: <20180427135711.750084883@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135709.899303463@linuxfoundation.org> References: <20180427135709.899303463@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.9-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 @@ -118,6 +118,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);