Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1993160imm; Thu, 24 May 2018 04:10:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp7s2286QbPvAZGg7tB4eTcCz2J1d2nO5bhFaUZduy7Xt50BYfqBte21/D2AxLpQb+AQjwh X-Received: by 2002:a65:43cb:: with SMTP id n11-v6mr5401944pgp.287.1527160249724; Thu, 24 May 2018 04:10:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527160249; cv=none; d=google.com; s=arc-20160816; b=XQkdx2BP9gU63mp0iqQaKFd2ralQ/TokoG1smHojPMOC5QBFwpQyAIVnT+JmVjJbSQ JQK46M6/MTWjtiAo4vqi0nkm1gXdIZguXAjdljeB3qjde7SbvRVZ7uKy9jPgjRYf5Irq hLdCqh53BO4r7Tj0Yv8px5D8rCIb5v872Kdap1usICib3JyGmpzEsiiNpqNvElUZoiO2 dJbveRPfg7baVIZgRaCOfwLJ63g4G2xeZNlS+yHpOE80Y27JBK4tajZluedVpss/wnfp 5laXZKRO78rRaY2v2YBAe01MIPR3e5+V+ipwfK4a/mKCj3YPQ/R1QhS7Hxyv6L1ZBJx3 sM6w== 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=7FipA9fYZR7x0p5/vs+Lmmot13+qTBltwM0ii3V5wK4=; b=rUqg5w5WU6Zy+kWyuyBwO09QdVfbNoh5LTVHFZUpv9/cvSchGkgioOnAoJo7io67+4 +/qx4+AB93S+7Ps11BQ4fuxrlOX9T6SDSmg1PrmSQybMBMPSnWKG/XdBSIKh2EeMVqTw JpSGCG2om27Vnih4AQp1fqajHfCdmY/tXKMr3W2b7lGkwjSA55BQttAkIR3TLJqNlChm Qkc1zTscT8ykSlJaHYoYXd1yO7iPPuBvhJbt4wf4VHgomOkCyIWUcSS3v4UJ+cS4TL95 I3eIhg7kkLKIgsIaNTBZwUQ2YWB1z/gw2VoT/4SGCPhb0Weocl0Sa8UlZ3E55g2tWbZj oSfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=noWdkTiD; 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 a6-v6si979833pgd.579.2018.05.24.04.10.11; Thu, 24 May 2018 04:10:49 -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=noWdkTiD; 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 S1032963AbeEXLIV (ORCPT + 99 others); Thu, 24 May 2018 07:08:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:34856 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968220AbeEXJyn (ORCPT ); Thu, 24 May 2018 05:54:43 -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 4492C20893; Thu, 24 May 2018 09:54:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155682; bh=xZeXGLBDMlUvXZ+tX4tpLhXvt2wayVVw/gAxqPrrjRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=noWdkTiDnzvVIHhjVGO0Mp/OwFTWOFR7tuGxFh31WYCK98dOpcPhts9dKb6CKnNW5 XbpZ274TLPOKfOaWhj8+7w+ATwb+IFCuY3vYGsq/z2+P6eO2m2/rCN+UpZ3j4ZCeRY PvO1ql9hn7w2P8a2nheMmm3wCd3TVf5r1C54t37E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Martin Schwidefsky Subject: [PATCH 4.14 043/165] s390: move spectre sysfs attribute code Date: Thu, 24 May 2018 11:37:29 +0200 Message-Id: <20180524093623.757568544@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@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 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 @@ -63,6 +63,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 @@ -44,24 +44,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"); +}