Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2030285imm; Thu, 24 May 2018 04:49:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpnb4mxIjU3AVQeelup9iq/3qeAz/L/klFEjGQcQ124ufREFh0fHddWQloFksB3PD74deXv X-Received: by 2002:a63:b601:: with SMTP id j1-v6mr5694836pgf.335.1527162542117; Thu, 24 May 2018 04:49:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527162542; cv=none; d=google.com; s=arc-20160816; b=1Ayipo0uqrqgwDdu0HnKMEYX3KzU7m6kXVyslu+lkefwaA4Gw+wb0m/YQcbIKEbHWH ex3aahsB0CzujzpkrlxIu8p0GZpHLyxkwcTObAeM0Itgpnvmr3zEGA/y1SqcrcXikBS8 0Ij5fkc8h67BI91vbivH8TgIfvNv0nlZjv/Ht0VLNhWudhuM/nWkKtMh0yliEitRHYsE aMxPTIMEKqvZKEFwwC7dwcqLNB61BMCtsZbR4z4pHtfey3Xz2ObJjdzG3BjnUUJsmUZK fZ00NrQQv+6LGH1GA72Ih46hs7B1iL0yn49gv8TP0tpEAK+vqzU4n4e40sAVMhWsc+dC /Usg== 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=WxgXJPL5bGA81jZFpe9TiUX3NG0gvH+WGhE6VHjASWc=; b=DirEnLYZ6b0NvhcLKC85U9JvI8pKMEEzQ4deeJeA9QAmc9ycdOp1kLN55C5d9Sd7dY miZ0ioNTz8drOt/5r3HphL+kJAbe95sdwAieABsxBXOuDXf9+GCO07QSa981TNl8rSFa Joa088G3rQK9fkjQ6m03xIrsqquk/ktatBPOEKNmiShoQObbDuH8eM8iZZ0QamCCzrCP IYdKtDvJ311oFWU+5ih2QNfTCVSuvvFeW3g5tMW81g5t5rgVeqRhym2fR0hzjo6U9vDr ds8zBlNNInzMJkxuxrBnZ2jsuiDZhMCIAUl7hMyZHNmajQNRt+shIW74G4Qg8pedzbw4 ZLYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=T/BLfUd4; 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 z128-v6si16771524pgb.28.2018.05.24.04.48.47; Thu, 24 May 2018 04:49: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; dkim=pass header.i=@kernel.org header.s=default header.b=T/BLfUd4; 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 S967207AbeEXLsB (ORCPT + 99 others); Thu, 24 May 2018 07:48:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:59908 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967045AbeEXJrX (ORCPT ); Thu, 24 May 2018 05:47:23 -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 DDA41208DD; Thu, 24 May 2018 09:47:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155242; bh=iLroioesQ7+mOE1d5YwN68uIBPHTIg4iSDNHw4UuTmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T/BLfUd40yxUhcIDInAsNmaBo++SzRV89BUj0lTYVbkzcD7raw5+fpq3j3MyrObKD TlxcQHvsShH9FpbhQLIPaheUTj3wlU/rNDCICW1oq0d+SwewSOrG8T9RSaSQpAUtPR hol8XYgbOcQSamx7GzAedO0lmnENBlfjeQ6t9wgI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Martin Schwidefsky Subject: [PATCH 4.9 15/96] s390: move spectre sysfs attribute code Date: Thu, 24 May 2018 11:37:58 +0200 Message-Id: <20180524093606.452554007@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093605.602125311@linuxfoundation.org> References: <20180524093605.602125311@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 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"); +}