From patchwork Thu Oct 24 12:48:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 177461 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2143071ill; Thu, 24 Oct 2019 05:49:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqycM0HYRQeKSOIHnQhkqjvWW+TiuRCCaSJ1n+ZeJBlTSLGpnbF5a2pmhnnxm/9uOrQyeRmY X-Received: by 2002:aa7:c513:: with SMTP id o19mr42570969edq.75.1571921395674; Thu, 24 Oct 2019 05:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571921395; cv=none; d=google.com; s=arc-20160816; b=o4mMzmQYdCfp5b8Fh3yC+3fob+J95QgUArSyXK+wSAjVApHil8qe3SYiEdtZFo8s6B Ox57R/ZHRHhkP1AmBnsik/g3NFgNRPmlHvg2sL7Yjq9GVXQ8Glx0GknGNlKEJgyTlHUU J7mE+5R9cgpMpCp2VPqR3KF7WQABUD75zcvCTiAVizDf3kp9eCqW0JFqmlcCA4idYFyy Lj3tfYNOIuhn18QADLbEYkjT+mQMgfmtMEv1ubA53ETiD/mz3pQ38gmhEq5vddKqUwiK iaoay07DhI5ZCHqSh+E1i6ifYN9Q9rtsdlr04+Ri/WX+KhFlHmaiCNZaGpRye02YoAsQ Idzg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/lIuF/ezia5URppvDTy2wPaSCGFyV345zyFYH80xshs=; b=gKJ68pv1+PyyzZJ14/CCNv5zzD8EH8bV6wgAPM62+4JZ8X1DJXWU4W2ZCJweLQBegy dHSaK0rQh7vzkp4x1JzainAv2w+4T+7oQpOTmby5FS9zPMn+ccP2LqHMlQG9Kf7xTS9a l2WejEGJmjyZ7en09Trk36/I2pSbM+c6AgoTq3RURLTgTsg6qKuha2eVINKcuU1AjstQ lC8u+YAkBU13rQd57z4CTc4L298Wi6JKxEwpyvQiM6pk8EE3nDdJsCtxQ50sQpi2eZ7X B/HFY8oQhVdCetqDTznvO59pJvNje+Sz9q89+iHqIgqZLt6CUm3s0nEduXvT6bpI4gKR INtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wUmcKdCD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y71si17602216ede.135.2019.10.24.05.49.55; Thu, 24 Oct 2019 05:49:55 -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=@linaro.org header.s=google header.b=wUmcKdCD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502142AbfJXMty (ORCPT + 14 others); Thu, 24 Oct 2019 08:49:54 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46824 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502137AbfJXMtx (ORCPT ); Thu, 24 Oct 2019 08:49:53 -0400 Received: by mail-wr1-f67.google.com with SMTP id n15so15146773wrw.13 for ; Thu, 24 Oct 2019 05:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/lIuF/ezia5URppvDTy2wPaSCGFyV345zyFYH80xshs=; b=wUmcKdCDLFOU3WI4mQyG72BQ/sCbZK0fVZYTbhauo9LIuuY7z1qZ4wRcJqnvpmPqvp CahvGBvDuixgdWvs4hV6qEBk1DfpK1FZWzClyFY4BjWEPUoeYfspA5cWOXBmiHNRIFmt 3gmw0LiwM89BbWtmzMd/AnUGq7JcBEJi+fS31Y65r5BVbANtCa7xqYITgF46y0AzbOIy 5G4gIY1haug3bkxoqV8wVCJE5P6PZzrzMbCxWSJS+68E+LtsoEQWmE7Kdo6nn0xIuFgy VsYdRfTtHUEATikf3sbk5DUQB0WFApe77UdbolKjNrgsiFtXWltmt1/Nh3BdndovV1xF NXhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/lIuF/ezia5URppvDTy2wPaSCGFyV345zyFYH80xshs=; b=BXV7qgVKR7YBfoDTQL4lZXzwTexmULuZAyNWWSqyg9MPgOYOI11yUf5HrlN0z39qM5 n4VuPMeO1z5WhGym2fnMtHzfSJga2eb+VUwcWuqKm1y6CCEal0tO0NF0N5qkyEKPpRc+ mZpcxvz/8W0f0yFI1mYggaiA3gQdqO9WT6nwbjiOz5dl2ncp3YjlgsgeqRHuHo343gxq NnG5dQ5jtOFUzrCpOFfOQTUY56Q6C8J7XTynFG828Y0YBz1PO/wAJvDNs/AlDqAwHYfz uamIT+016Ry53ZE5QcaVgEMtBCK1gHGFO6np2pcCmd81YNJ+bVcB/H+Irnsyi7kMs626 a/lw== X-Gm-Message-State: APjAAAXqB9mv/RWYTDHQCEiGl90ErhGU+Eq34qQP9JlV42g6Momy0V6Y 3eOVntmcOSnkhw+jSgrGdu1Bmwh3aXDGa9kh X-Received: by 2002:adf:f90d:: with SMTP id b13mr3617307wrr.316.1571921391452; Thu, 24 Oct 2019 05:49:51 -0700 (PDT) Received: from localhost.localdomain (aaubervilliers-681-1-126-126.w90-88.abo.wanadoo.fr. [90.88.7.126]) by smtp.gmail.com with ESMTPSA id j22sm29111038wrd.41.2019.10.24.05.49.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 05:49:50 -0700 (PDT) From: Ard Biesheuvel To: stable@vger.kernel.org Cc: Ard Biesheuvel , Will Deacon , Catalin Marinas , Marc Zyngier , Mark Rutland , Suzuki K Poulose , Jeremy Linton , Andre Przywara , Alexandru Elisei , Stefan Wahren , Jonathan Corbet , linux-doc@vger.kernel.org, Will Deacon Subject: [PATCH for-stable-4.14 40/48] arm64: Provide a command line to disable spectre_v2 mitigation Date: Thu, 24 Oct 2019 14:48:25 +0200 Message-Id: <20191024124833.4158-41-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191024124833.4158-1-ard.biesheuvel@linaro.org> References: <20191024124833.4158-1-ard.biesheuvel@linaro.org> 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 --- Documentation/admin-guide/kernel-parameters.txt | 8 ++++---- arch/arm64/kernel/cpu_errata.c | 13 +++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 188a7db8501b..5205740ed39b 100644 --- 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 diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index 86c4f4e51427..5c3f8c712aae 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -181,6 +181,14 @@ static void qcom_link_stack_sanitization(void) : "=&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 struct arm64_cpu_capabilities *entry) 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;