From patchwork Thu Oct 10 08:36:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 175720 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1983571ill; Thu, 10 Oct 2019 01:48:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5q8lhl2z0SJmcCMfuSfDJoNeToIE6iPPc787Oeun1r52RZQAcPYo5F3yqV1C7yYvhAHLb X-Received: by 2002:a05:6402:650:: with SMTP id u16mr7020852edx.211.1570697319861; Thu, 10 Oct 2019 01:48:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570697319; cv=none; d=google.com; s=arc-20160816; b=vgLyS0x8yiiMdsjfvprOI/yh13wHZfAZuZQx3cEqYXD12hd7L2wYCyIQ5Xq18EzdUM Vn3k3930DCiWtgKcH6ditt9VpvkdBivrK91ifkaG7mUgepQCIJ3rhtcSCRYtLyz+HwoY Z2Rg3RItoBVIJP+927yxF9Ef7Po0oCfZcY9CdbLX/if93XzdJNsrahlsMZxNLTuZ5TMd AdgCpywiXZ441qO9d6e/MyCgV1HzeNLXH9QtAoXRZnp4LiotFa2lVQB6Q+9wXegRLuaT /AMd+UFqFLpmzssujvVd7YZUUyEzH3cH3PZwDIkn3q2gTtcrbObisKVPTe0pw8zafug9 nmmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=umZi/tPbkdK75xzt7P+xnhytk2AJE6QrZ9qsHwjTvug=; b=0K90FQKjf0RhJZ4wCh61fncs1QT0dpVZwFapKm6C4CvEBhD6ObXCZTbuUDVSycZ+F9 dJbraIINq9IZa/SQa34hRBnz70K3+Soyw3Xk1D96y4mnOoJvp6/+2qma9MUVGPTrtoQR UdkTkDswW8HAE7QNeFSYjy8JZI0XaWHtqGvtUIqpx76oPTnrvs5RMVGUMSe8EEhEnEOc HhY+Nfytt+9kHIdkur63MKQU4AHCVxdjRWcE/bsUpel0fXHRC/Eick0PvLl0eUKT41GX TEWEpk15uriEN2En4BbQlyh6cX+U5nF2l/AYqK69iSF35FFz5mtSlW+HPRg08VfG+vbt 3wcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iJkcT+Dg; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 si30si2807785ejb.92.2019.10.10.01.48.39; Thu, 10 Oct 2019 01:48:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=iJkcT+Dg; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387896AbfJJIsf (ORCPT + 13 others); Thu, 10 Oct 2019 04:48:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:54788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389658AbfJJIse (ORCPT ); Thu, 10 Oct 2019 04:48:34 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 7F784208C3; Thu, 10 Oct 2019 08:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570697313; bh=4jbZCZ8oCBzOUrTMKx+74Dexkyj4kfRpRIGLN0rEjmc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJkcT+Dg1vW7lj80N7aFhcRb3sFQDen8O6inhgjBwytA1s5ANu6arEII9sjOY+DlM rLHkOiZwqRxnoHau3Gn3pnAolNLsk5Kkln1sfWjt+M1fQflhvtO3P+ngwHiTX1Jpoa 0yWso3NtVvFdBlQhCRHIwBVPCyVUl2uflzFlu+Pw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeremy Linton , Suzuki K Poulose , Andre Przywara , Catalin Marinas , Stefan Wahren , Jonathan Corbet , linux-doc@vger.kernel.org, Will Deacon , Ard Biesheuvel Subject: [PATCH 4.19 097/114] arm64: Provide a command line to disable spectre_v2 mitigation Date: Thu, 10 Oct 2019 10:36:44 +0200 Message-Id: <20191010083613.292731617@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083544.711104709@linuxfoundation.org> References: <20191010083544.711104709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jeremy Linton [ Upstream commit e5ce5e7267ddcbe13ab9ead2542524e1b7993e5a ] There are various reasons, such as benchmarking, to disable spectrev2 mitigation on a machine. Provide a command-line option to do so. Signed-off-by: Jeremy Linton Reviewed-by: Suzuki K Poulose Reviewed-by: Andre Przywara Reviewed-by: Catalin Marinas Tested-by: Stefan Wahren Cc: Jonathan Corbet Cc: linux-doc@vger.kernel.org Signed-off-by: Will Deacon Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- Documentation/admin-guide/kernel-parameters.txt | 8 ++++---- arch/arm64/kernel/cpu_errata.c | 13 +++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2866,10 +2866,10 @@ (bounds check bypass). With this option data leaks are possible in the system. - nospectre_v2 [X86,PPC_FSL_BOOK3E] Disable all mitigations for the Spectre variant 2 - (indirect branch prediction) vulnerability. System may - allow data leaks with this option, which is equivalent - to spectre_v2=off. + nospectre_v2 [X86,PPC_FSL_BOOK3E,ARM64] Disable all mitigations for + the Spectre variant 2 (indirect branch prediction) + vulnerability. System may allow data leaks with this + option. nospec_store_bypass_disable [HW] Disable all mitigations for the Speculative Store Bypass vulnerability --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -189,6 +189,14 @@ static void qcom_link_stack_sanitization : "=&r" (tmp)); } +static bool __nospectre_v2; +static int __init parse_nospectre_v2(char *str) +{ + __nospectre_v2 = true; + return 0; +} +early_param("nospectre_v2", parse_nospectre_v2); + static void enable_smccc_arch_workaround_1(const struct arm64_cpu_capabilities *entry) { @@ -200,6 +208,11 @@ enable_smccc_arch_workaround_1(const str if (!entry->matches(entry, SCOPE_LOCAL_CPU)) return; + if (__nospectre_v2) { + pr_info_once("spectrev2 mitigation disabled by command line option\n"); + return; + } + if (psci_ops.smccc_version == SMCCC_VERSION_1_0) return;