Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1948051imm; Thu, 24 May 2018 03:26:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrydG3MII8uIGvawV9a9JJ/HCi+B/6sE4u2a2CANWl8uRHm0H1yxZbXgnqOgf0WbIUHI8sj X-Received: by 2002:a62:9b8d:: with SMTP id e13-v6mr6704454pfk.157.1527157573965; Thu, 24 May 2018 03:26:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527157573; cv=none; d=google.com; s=arc-20160816; b=0GkapAXolzIDUQKMEVsaYivyw7ameFQbEZ8+kqVHUXldFeCOfeDMrKAwClaws8H70G n4bIX4+aU+DVfK7tip29/Ln8RhPDqOMRi3thKOghTqntunWQmYbTEvf3hSIBzQQhFnLR DvQrlX3rfRLDTfzt3+jflt+TwaVuZWhjheVZcIESYc/IXc4BZBMdqu1hIcWdP0mIFooJ Hr2xzdLjrAp/9X32RLqgdA6LN/ogM+gMqSrSAh6YYvVzHHkWiBtOa4lxgmBHjNUN/9im TGNJlZJYemvuD3wnBlzYy/LaHOMDvx+g047PupPxIOVUt9Jcwp11Iwj7Z6wGxYW6vAqj R+Gg== 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:dkim-signature :arc-authentication-results; bh=ZYBjqHz/rt3qCBLsQvPYCHIajIGL6+3W/Zv1UKmcjHk=; b=xWqoBIZ3WmdfwuCHrXLHdUtzZsoJtHVdtZ4qTqbYVFpojn2TbNLAbfQs8aMFChIICo MZ6H80K5FcxNoaryEQ6lmlg7n761R17ervL7J4/pC7TK9b0vyzGOgjEsALzpi3GDKXCx ee7oQEbuiRvuwkD8kTQKHpSsGcaJeEqsghUSllX1hDU1T6rBeu0D9dEMyUVHdw//SvTV hDeHPvwp2nP3/9D7Oq0f5NzUuoA2Ql/iHnxMWL0GnrlZoUWHSC0yhqSW+9ZAR0nAnWjO 6Ek6ehj4G95f34SWjX+B5/w8v73hQCJexmqI2/JsYLQi2LA0zNLhGRzNrvI0Bc8aBGpA s6/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nB3PdG4k; 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 u10-v6si20091727pfn.44.2018.05.24.03.25.59; Thu, 24 May 2018 03:26:13 -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; dkim=pass header.i=@kernel.org header.s=default header.b=nB3PdG4k; 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 S1031053AbeEXKCH (ORCPT + 99 others); Thu, 24 May 2018 06:02:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:48128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030570AbeEXKBy (ORCPT ); Thu, 24 May 2018 06:01:54 -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 5CA8A20891; Thu, 24 May 2018 10:01:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156113; bh=z1+FgNf5W7HnSZ+UXIbO1CAZ5dXaE+ZXPypKxAGdB18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nB3PdG4kKAAXNFF/32xFeyhei7nTbsQweEXUkiFvWRrFKlxAxQ1fweegDHtYb2EMj enfWdAQfTBZgdJ1vs9uEifjsM+4rKc34cYAESR8XIf8LzjBWpIs9H1sA2b6fT+oSaI UVKCOydWXUm6JihKLWpi1O2h3gI8zrRozWLQDkDA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Martin Schwidefsky Subject: [PATCH 4.16 061/161] s390: move spectre sysfs attribute code Date: Thu, 24 May 2018 11:38:06 +0200 Message-Id: <20180524093025.818538316@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@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.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martin Schwidefsky [ Upstream commit 4253b0e0627ee3461e64c2495c616f1c8f6b127b ] The nospec-branch.c file is compiled without the gcc options to generate expoline thunks. The return branch of the sysfs show functions cpu_show_spectre_v1 and cpu_show_spectre_v2 is an indirect branch as well. These need to be compiled with expolines. Move the sysfs functions for spectre reporting to a separate file and loose an '.' for one of the messages. Cc: stable@vger.kernel.org # 4.16 Fixes: d424986f1d ("s390: add sysfs attributes for spectre") Signed-off-by: Martin Schwidefsky Signed-off-by: Greg Kroah-Hartman --- arch/s390/kernel/Makefile | 1 + arch/s390/kernel/nospec-branch.c | 18 ------------------ arch/s390/kernel/nospec-sysfs.c | 21 +++++++++++++++++++++ 3 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 arch/s390/kernel/nospec-sysfs.c --- a/arch/s390/kernel/Makefile +++ b/arch/s390/kernel/Makefile @@ -65,6 +65,7 @@ obj-y += nospec-branch.o extra-y += head.o head64.o vmlinux.lds +obj-$(CONFIG_SYSFS) += nospec-sysfs.o CFLAGS_REMOVE_nospec-branch.o += $(CC_FLAGS_EXPOLINE) obj-$(CONFIG_MODULES) += module.o --- a/arch/s390/kernel/nospec-branch.c +++ b/arch/s390/kernel/nospec-branch.c @@ -43,24 +43,6 @@ 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); --- /dev/null +++ b/arch/s390/kernel/nospec-sysfs.c @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include +#include +#include + +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"); +}