Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2032696imm; Thu, 24 May 2018 04:51:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZodLHP3BDG/p81Cp7f4gaCVISEhhNcvnvVSHC71KlvPeYcXqQflNOGra2gIJwxGj6OVbC9u X-Received: by 2002:a17:902:6503:: with SMTP id b3-v6mr2063895plk.147.1527162698829; Thu, 24 May 2018 04:51:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527162698; cv=none; d=google.com; s=arc-20160816; b=wCMjnZ/6TmQVQ95jGqzWgIwTv1V2UwIZYgRB1KSPEjeQHaCifMDoOkrsqyNpR+KPcN 3gU4hzF2RvDgaCPN1YpyImChX+95A40NvFQ8fPgGDRPiLBpSvMmulOHeaAH2KeidXvem FnrS+sRE8CX9Cv4lc/qZN2MnGKw7+igcqAF43MTJgjEQYaQpV07dxmIBlX3aLjYpPXLm 4Haqw4brds+Zcy2u5Bjwpv8t+AgoAhVWTK97pM655lDgEdQ2tiFUek64ja5aJK76yhLG THUqGoz2zKHp/4hagP1AogENN1pw/sciIMKPECiNHq5ee/e4hwX7IVFPe0y3E7bz6adk flkQ== 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=dF6WCsOd0HyTXb8xze2Am+TBMpURpv+e0a6Fq/o8r3I=; b=g2Z6YrEa3ENZRZS/fGskXJfoimYYQhR2vaR+RHmzddYVp3y1JKRdhJcMheaY4FZQq9 wa1eXMeMNm05GgbohivwnSMnnow59FpTnuKy0d8LPdJqB7jfMOOd8C29+eHnwxIxjbJ+ AzU04ikJo6KylBcp08Qs2QQALqBNFvc50uPNXjUZ0JqSWXiVyPYzTbRqcAa/PWZxncQd v9M1/hY1BpEWEjsoTOf0BugWAAGNao2ZX+HIr4SThSN20mDb8I4UFRoTVAcJ2MpdcIe+ vlmABwnSWo+e/iG+wM8n7J0DEycz4jomtMM7A8zFX83lrTW3I0gr4Jqx9yfjMsg9Brwt ve1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=aiOkgTOE; 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 u1-v6si16581813pgc.388.2018.05.24.04.51.23; Thu, 24 May 2018 04:51:38 -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=aiOkgTOE; 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 S966979AbeEXJqz (ORCPT + 99 others); Thu, 24 May 2018 05:46:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:58386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966955AbeEXJqp (ORCPT ); Thu, 24 May 2018 05:46:45 -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 1AFB1208D9; Thu, 24 May 2018 09:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155204; bh=MtE7iBp5xGQIuVJ8kLtQbjBrTzZ39aLn7RtotIDsmb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aiOkgTOEXzxg11xgLTSB6vFKeOWN+HicO6aqB+DNfrpe29wYt8CDfEgj5viTtgtoi HsRMLYi6w16cGfwm/xCHSFIMadhcL87j0b788d9nBHfHt5yNqDs02NcVgHtOPETjTu RP3Ee3o/+GEljO4wa0Wf2xohWqFCLJgrajb6yKOw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Martin Schwidefsky Subject: [PATCH 4.4 81/92] s390: move spectre sysfs attribute code Date: Thu, 24 May 2018 11:38:58 +0200 Message-Id: <20180524093207.033541347@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093159.286472249@linuxfoundation.org> References: <20180524093159.286472249@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.4-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 @@ -49,6 +49,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) += s390_ksyms.o 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"); +}