From patchwork Sun Oct 27 21:00:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 177851 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2532453ill; Sun, 27 Oct 2019 14:10:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyctxv/6WbStz1BW1ZCmoTLWKhNl0GOGMU+1ET9hrjI78z7APZOaTWvcyVa5ucj8DRc+IIE X-Received: by 2002:a05:6402:13c5:: with SMTP id a5mr15827940edx.106.1572210619466; Sun, 27 Oct 2019 14:10:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572210619; cv=none; d=google.com; s=arc-20160816; b=bOZQMvB/6FQno3uQ7x7ABVFOrWW2lYb9iEQu5bzYHBVPkO9EnCkm15CaX81kB+l3vA jy4FcBFswSQtS307Uwb/QAKEKoHJ+fSuBMtGptvFPPNEduzDQoqP+tHWJqavbC/FIuXq WbvOeo8VEhAPNKpFuiuTCogYNMs2GF1kxteIXfg2YW902WJisuRIEKPGEL4Z/C5P1PDW +60bwHH13EuLTdQSE/5Q7q/Am5gCzJTJ11ql1iy7aoYMpW4w5Ne0GloCtgoQ+t2FDdBy jpwj5q/zYIqrFR7L5NFU/79oykZg4AJuHBi2lmcW2jpNg2UQIcyll+QL0PomfBtnsu/D XhUg== 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=dUkQCJ3aHiMYN4EkDBSpmbWyXptiS3ca+kX38SJsPXs=; b=kgJTrKubyvjSJT+1gPOuAu2YmQMw/ovuvFaUjiHcfCsmvRz6G/PU3DlwM86IGfiV6d fyNPV1fyzVheHHzqZFJR/9L5BATy+K/745To9WKcL09sGcyeaT0FX56gTtkIZ3I7ej+q aQXAeuiISCjDXOLpBjDFR3ccVjw1k55hk68AgsF67yQFt+7cGnGwaFy+UzBl/2QnpZy/ f1P1mjgxqwA8MbWMPSrFUMQm4IVudtjawlYhHM40Ll/rQCE4VBcUkQYz7bUw/uc+xF0o QoQkOZSiC0lIBaxwBldSz2bhGfu+DKYDKz0YXO71rpYyZjunK7f/hlzr0isfqiQaHw2C 8oVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AqRnr2WP; 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 k19si6202812ede.293.2019.10.27.14.10.19; Sun, 27 Oct 2019 14:10:19 -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=AqRnr2WP; 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 S1729667AbfJ0VKP (ORCPT + 14 others); Sun, 27 Oct 2019 17:10:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:56622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729659AbfJ0VKO (ORCPT ); Sun, 27 Oct 2019 17:10:14 -0400 Received: from localhost (100.50.158.77.rev.sfr.net [77.158.50.100]) (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 DB7D22064A; Sun, 27 Oct 2019 21:10:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572210613; bh=0gr3NY6N99eU/D68NrZCCTp+jlsGqPArsdEQMYjHC6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AqRnr2WPYjLD38gxjv5lmmo5l+VP08YHmi8HgaFH4FOkC4wNlZCMBWTAZu8VZPcQB XWUWJO5czh4oTbrsQYaPPeQSp6MuAdoETIAghvxSO0Hn6dvQzZuMomrU1boD+XG9Tz 90KrFRTcx5y24nnO12Zx8g/t5d597kWmkW9GKHW8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , 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.14 076/119] arm64: Provide a command line to disable spectre_v2 mitigation Date: Sun, 27 Oct 2019 22:00:53 +0100 Message-Id: <20191027203342.881904911@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027203259.948006506@linuxfoundation.org> References: <20191027203259.948006506@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 @@ -2745,10 +2745,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 @@ -181,6 +181,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) { @@ -192,6 +200,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;