From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-5.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id 08F3C7D2F0 for ; Fri, 4 Oct 2019 12:04:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728962AbfJDMEv (ORCPT ); Fri, 4 Oct 2019 08:04:51 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33081 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726002AbfJDMEv (ORCPT ); Fri, 4 Oct 2019 08:04:51 -0400 Received: by mail-wr1-f67.google.com with SMTP id b9so6899398wrs.0 for ; Fri, 04 Oct 2019 05:04:48 -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=suth/yl7C9uDuKnFfHGvtaLYw1nAU2JE6foMZrBU1qQ=; b=u7JSTFaB3+6rww5bw+3zAh8GYbUYNGvNJBk1J9hUrtPLM7vZElrKeGjaaUd1XJ8PDd euAnU9ckEGTlg7UuDgpIborMmJESaMf9DasD+8yHhFRglwvviGUjeXTpNSZaoXjIAXUU Im3yyNR3PSVhsLhSW3KBut6GiRLjRlEx8HBXG7tTyUYdj6+glb3/aShDgyR8hscPSZ7t s1lEPWbGZ0Vclg5qDq14T1u/BJbqXNN2WwxgVILo1ebNKtqAUauCdBqEKXRONWDpIFq/ TcNXNspgq3oSHlbs/GcR1NeqUhZsD6YLQvRCz16zvaVNMHCPleM68EET/mVU8eGscQ50 Q+XA== 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=suth/yl7C9uDuKnFfHGvtaLYw1nAU2JE6foMZrBU1qQ=; b=S20JqKQWM77mGM45pxTdJySKAe/crWHeriQy1ePoHFD7QpJP5ZSgo6EFfk4Ydkb41/ Rbowo3o+YTFAPAuzXeE8+hJ4KeG58i4oHFt2wZLZ4C/aUREFE3PBoh2vVRCKc3v8rvJO o4ZMg3wqmJ72fsTCakKcVR7fqkqX3uLq5+ztAQwkgH0z0PHJXUDjHmKXb23eUzxM6ySY GoZHGxYotaQSVm40m6ifPstZ2zQ7gOPctWY/kpGLrjIVxdcVvc2bz4cUP8bTGqVcWQE2 SqPj7S0BjQ34djOhHgfr/xRAKv9i2CA8MwqGxcepZlPHx+ImMqPexCfjaMZnUzuTvupc SMow== X-Gm-Message-State: APjAAAWfQuv3hNoHJ9uAdY45wwd+vOVToTTg4tR+bTk+lTpPgGVUtl2E 5REVBEbjugCY+1yffXnXTgzSfg== X-Google-Smtp-Source: APXvYqyY9s67nKyPhoAmHbDhr4NeD9R/VMYYs5ICoX9odFWy6lJ8OkI9K04wXpCG7oQAaWEbrkuGtw== X-Received: by 2002:adf:f58c:: with SMTP id f12mr8665663wro.38.1570190687975; Fri, 04 Oct 2019 05:04:47 -0700 (PDT) Received: from sudo.home ([2a01:cb1d:112:6f00:b51e:3d9d:ec16:def5]) by smtp.gmail.com with ESMTPSA id f8sm5019628wmb.37.2019.10.04.05.04.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Oct 2019 05:04:47 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Will Deacon , Catalin Marinas , Marc Zyngier , Mark Rutland , Suzuki K Poulose , Jeremy Linton , Andre Przywara , Stefan Wahren , Jonathan Corbet , linux-doc@vger.kernel.org, Will Deacon Subject: [RFC/RFT PATCH 09/16] arm64: Provide a command line to disable spectre_v2 mitigation Date: Fri, 4 Oct 2019 14:04:23 +0200 Message-Id: <20191004120430.11929-10-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191004120430.11929-1-ard.biesheuvel@linaro.org> References: <20191004120430.11929-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org From: Jeremy Linton 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 (cherry picked from commit e5ce5e7267ddcbe13ab9ead2542524e1b7993e5a) 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(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index e8ddf0ef232e..cc2f5c9a8161 100644 --- 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 diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index 3758ba538a43..5a7fa90c668f 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -189,6 +189,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) { @@ -200,6 +208,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; -- 2.20.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59F48C47404 for ; Fri, 4 Oct 2019 12:11:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27F5A215EA for ; Fri, 4 Oct 2019 12:11:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cZ4G63bG"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="u7JSTFaB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27F5A215EA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9m8n7FQfyimfwSOj7XAFBVktNmEtLTKl8zQ+kzHxsfc=; b=cZ4G63bGAWgCPa gyefEWo2dq6+gmPRIDhZC48U23ZBqJqBB1m1S8EdRIYtLoIVpx3L05ryFAgQ6qY7JdfqenVY3usm5 z6QTJxxtX/TSzurNvc6iLEmbNpvcaduQ763VvokqgZzFMAyrCBWcp5P8KGnKDodpLfGYmwq+PNwoq tNc+RGOKauTyRSY343e0Wwp/BVFtJZ6G/AqHcUdGPGM+bbwIb0P20ekrp8nyey+I0T5XU2wtY1IsF JOW8xIRqIRx95exfLr487iWin8VDLBv21T/TLlgLTC2dorKqAlDjYpBMvSGWobMf3nR3AJ2DLWSKm AWapiho/B+sOTMcfcGVw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iGMQV-0001V8-Po; Fri, 04 Oct 2019 12:11:15 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iGMKI-0001sc-HS for linux-arm-kernel@lists.infradead.org; Fri, 04 Oct 2019 12:04:55 +0000 Received: by mail-wr1-x444.google.com with SMTP id o18so6814663wrv.13 for ; Fri, 04 Oct 2019 05:04:49 -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=suth/yl7C9uDuKnFfHGvtaLYw1nAU2JE6foMZrBU1qQ=; b=u7JSTFaB3+6rww5bw+3zAh8GYbUYNGvNJBk1J9hUrtPLM7vZElrKeGjaaUd1XJ8PDd euAnU9ckEGTlg7UuDgpIborMmJESaMf9DasD+8yHhFRglwvviGUjeXTpNSZaoXjIAXUU Im3yyNR3PSVhsLhSW3KBut6GiRLjRlEx8HBXG7tTyUYdj6+glb3/aShDgyR8hscPSZ7t s1lEPWbGZ0Vclg5qDq14T1u/BJbqXNN2WwxgVILo1ebNKtqAUauCdBqEKXRONWDpIFq/ TcNXNspgq3oSHlbs/GcR1NeqUhZsD6YLQvRCz16zvaVNMHCPleM68EET/mVU8eGscQ50 Q+XA== 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=suth/yl7C9uDuKnFfHGvtaLYw1nAU2JE6foMZrBU1qQ=; b=O+PIgZ2KSRmi0c2rTVrEuhwNobKTGwlk1t2c/UHj4DFEl/WGpxKe/DsMAQf/Uc+iXY MfPFIl1O9ZsfQoxEekzAHVryP8GvSCj2RZNuopxXfzk5C7+XDtTCOucOrsq2I0UqVcUE 8qRpas4WZWeP3e9KyfOrgNwWZM8xJLB9+0ShcEDqkQ428+wn0R1mbjMTLJy8iDhgtaLj lROWxMa/gBfys/bhNqUpHPQwBIz9sHRtGIKSjDSW0e5Jz2Xc0/8woe11t+18FVLDPaUb 2MyRoVj3AZRfdd9SATwtBqUHDwH1YR7BZ7PqdB0H+6JjTDlbjoreoEXffLJ8ZISJFWIT ZtJw== X-Gm-Message-State: APjAAAWjgatxdAY8c/9f7IOX4Fq7Ds2+TUi52ibegODWHer5cbH6EZBZ lXervIqWXhXYpC3l2wYUI4CB78fHcAN8fr7h X-Google-Smtp-Source: APXvYqyY9s67nKyPhoAmHbDhr4NeD9R/VMYYs5ICoX9odFWy6lJ8OkI9K04wXpCG7oQAaWEbrkuGtw== X-Received: by 2002:adf:f58c:: with SMTP id f12mr8665663wro.38.1570190687975; Fri, 04 Oct 2019 05:04:47 -0700 (PDT) Received: from sudo.home ([2a01:cb1d:112:6f00:b51e:3d9d:ec16:def5]) by smtp.gmail.com with ESMTPSA id f8sm5019628wmb.37.2019.10.04.05.04.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Oct 2019 05:04:47 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Subject: [RFC/RFT PATCH 09/16] arm64: Provide a command line to disable spectre_v2 mitigation Date: Fri, 4 Oct 2019 14:04:23 +0200 Message-Id: <20191004120430.11929-10-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191004120430.11929-1-ard.biesheuvel@linaro.org> References: <20191004120430.11929-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191004_050450_623323_8FA6A289 X-CRM114-Status: GOOD ( 13.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Stefan Wahren , Suzuki K Poulose , Catalin Marinas , Ard Biesheuvel , linux-doc@vger.kernel.org, Jeremy Linton , Andre Przywara , Marc Zyngier , Will Deacon , Jonathan Corbet , Will Deacon Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Jeremy Linton 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 (cherry picked from commit e5ce5e7267ddcbe13ab9ead2542524e1b7993e5a) 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(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index e8ddf0ef232e..cc2f5c9a8161 100644 --- 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 diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index 3758ba538a43..5a7fa90c668f 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -189,6 +189,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) { @@ -200,6 +208,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; -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel