Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1953590imm; Thu, 24 May 2018 03:31:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrFtPz57Ph1sHu2V/06v2t2V6rA5+IvE+23MG1cLPVeJjGulKmt5NwTPYSRYQkYvxc0tkr0 X-Received: by 2002:a62:105:: with SMTP id 5-v6mr6632668pfb.1.1527157919443; Thu, 24 May 2018 03:31:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527157919; cv=none; d=google.com; s=arc-20160816; b=BYVQUJ9u17n8dWFiUxFMeVphOEuugr8VlvOQfncNJ1tZitUiqp5LYSjK59pIeRtfmw lv22xzDijkhy7R/qokoPpe3mNMANoEeKbgzlgaGg8tBDdOQpuYTL41g4tuuJqa8qtymN ISkY74SW5QPQw1BzkBBJJYLD41ia7yFeltV4qOrneS9uxkJligAuMmwhIydJcxVqt3gc P96+SpP28Ac3xnlXaM/lYuzaRdRIgiyDoSObnOGVK2ECOBMcAS55KMZ6h62bBdDts1uI NFWwg08cGZLIglaZdYwLQbDl3+/kT825oKt9+Whkeh9S9iRpPuWxPsr+MQttDcbFQw95 Z1bA== 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=x8g4AXx81xef/7suzxuvRwJjoVYD9/hCKF8YXQ7Fs4M=; b=QIs+ybmMKE0dtOlNYvDdgMPALmCYN2x15MJhUYvB33ualXnOa9Fdmgl5DQeAlPIK7f 3OCc2NES5eEQDHhixjLJuZpzv3M8aGMjwvujcqkGsnOp2OR8Tx6bWgLMQLSyc3dxN9O9 0w+9UPrAE/gyF7wip6pqiJtCl6Qxht9O5QQFKCB6238wd5vOpXgRnlk+kxu0GA+yC1iZ m0s6KLGjPOut1M+2yLy4Xff4tzDIeUV/lQ2R09CFS0B3Pj/Z0/HaVlzVIaw9JLDwTkB7 luT9W2mV0fXdatXIsEt+U7yTuJzuk8If0SxeqkFle+9ACd4m+PX9ssohU3yBnR3HuZ96 IJug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xoCQHjfH; 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 34-v6si21115696plp.409.2018.05.24.03.31.44; Thu, 24 May 2018 03:31:59 -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=xoCQHjfH; 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 S1032149AbeEXKaz (ORCPT + 99 others); Thu, 24 May 2018 06:30:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:46108 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030891AbeEXKBM (ORCPT ); Thu, 24 May 2018 06:01:12 -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 3F9C920899; Thu, 24 May 2018 10:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156071; bh=InpF0gjCVQieTzkgZlmWEjNbFZV+CXhSDHe7V2X5xn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xoCQHjfH8FdKbgc1KbhBJdfNev8B24KIblaz/OjWmmJ99+u9ufAI725OP91gAH7CA NtGc4CqaSO9vOvKSoA2ukUQPnf2mQOOgN2UCXpI/zPGTchdN5qKHWgpZjEiuaGDoxe HFCvsZPHrmU+Lz6LGbkrrvjmTSC5OhFHr97MXUQs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Martin Schwidefsky Subject: [PATCH 4.16 052/161] s390: add sysfs attributes for spectre Date: Thu, 24 May 2018 11:37:57 +0200 Message-Id: <20180524093024.685628974@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 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 @@ -120,6 +120,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 static int __init nobp_setup_early(char *str) @@ -42,6 +43,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);