Message ID | 20181031135713.2873-18-dave.long@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patches@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp6826689ljp; Wed, 31 Oct 2018 06:57:38 -0700 (PDT) X-Received: by 2002:a9f:3048:: with SMTP id i8mr1367396uab.9.1540994258796; Wed, 31 Oct 2018 06:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540994258; cv=none; d=google.com; s=arc-20160816; b=xpw7xdB85shQ2UVtjv+XdNWc3kri9M4oaPGV1prniATzJA9oV8DFVbWxwc+5rFRZHF QyStrR4yuKjTiD3DvJUtrS82DjM0n4qvwXui8lCMXh0R3vcoHJAFHG3O2QCCvrlT6suf Ky+oAvmIcm75lazbVDTZ4ZA+GnFFVyXONiDhtrCTS2bfC5JgqEzwKr77YMRtmEqmlYU2 kQ0DX0M/AntYUAqi+jR6UKsOp0Bi8kqCZk3ieyHGbk4A08IbgwpfBmiW4oZ+H+R6SFSu zjx2560H581zLxv/9gltukmcc1sm6TvvKm81+trV4PQDZs2QmC/EFOaXeu4Aku4VcVwI ri/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3bJG+4cU8AeqqGR8tf+B9dvHx+CHuHIpKs9xqRKYlW4=; b=goe1d23qjQ1vLkZ7JjzE+TO5i1GYN0/9suAePp+hjvZxZ6nyC9CpVWqjKTltIGlaKi qXqJL4u4edW3v6LfpIV/gYFG0uZ0ynd3izld/qJur3hRzySwSDkTuceMjg/vgYDULn9H N+xHo4YueMtrygKsHCSsAk/jHxmxFDw+ejAIND/VQx4GOHAT6V/oMl7JLD3AdoDQ9yF+ T7SJNqg7/1RPWHuy1LNwKcpzXKvQU5S96r0etoI4L/BNi4YZ/GdeKAzMm+gikRI/A+u4 C9r4cpOZJOUlPUheSJf/t1DYeCo72oy+vx+L+ndtx01lrG/dVD1fN5MAaOD2Mn64AzW1 6OkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q+Do7RPs; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <dave.long@linaro.org> Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id c16sor10903163uaq.50.2018.10.31.06.57.38 for <patches@linaro.org> (Google Transport Security); Wed, 31 Oct 2018 06:57:38 -0700 (PDT) Received-SPF: pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q+Do7RPs; spf=pass (google.com: domain of dave.long@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=dave.long@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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; bh=3bJG+4cU8AeqqGR8tf+B9dvHx+CHuHIpKs9xqRKYlW4=; b=Q+Do7RPsiaW7/iDvEv6uV0HXX/RCXunNl3+kM93JM3MsuRVtG79QnBMYJsh/jH9vqq USy6t9mKT99nRAob34wPfiQ4T3WrCSnQ+qc9syQH0xAwtqRgMBN0Br9ZkndljrFykqNg 79BeNw7ZV9BDV96lYMwOkfDxbgRE+Uwxr+WRE= 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; bh=3bJG+4cU8AeqqGR8tf+B9dvHx+CHuHIpKs9xqRKYlW4=; b=RUwIwTMJOIDP9EygEWKOalAHGxG0F+iBTa7FymfhJ1ib2jNhqz0UHN8DoHeqeNhjVW My3hl3yRNNtjX+rmZqOlwI5YT5FaEHf5+aYy24E6jcgEcIBQQdEy4nK/kpaKBXWXD0xB hWregU7I0cytLlNnexCkgLpFWHKsQVUaqMacNeDgNFyq4zkZZ+m1PjPhThFcQ/A/4Y08 t94yoGMnoeAUEkks7grIU2yudBWh+43bdwfX0IHtVapjWvg+okTEBgvHDxwQKx6inzTk MzcvA3B4h8io+sos5mg43YTjD7Ip4WipXoakejLoegn38PL3rocyzNi7kxQ9h46IZCxN 0Elw== X-Gm-Message-State: AGRZ1gIQxw848S5lV056T8JwBlXioDfeORMFi2uOwn/3sBnTIIaxq7gS +QlQJoE3U8ihnbQFwjPsPbFF5MMq X-Google-Smtp-Source: AJdET5cockaAXiuH7WRya7xTHfSK7Wqs5YSET9xsN40BcbRN6ZvHpXAi4RDlwiEnQfxGCqznI59PDg== X-Received: by 2002:ab0:4a14:: with SMTP id q20mr1364209uae.4.1540994258307; Wed, 31 Oct 2018 06:57:38 -0700 (PDT) Return-Path: <dave.long@linaro.org> Received: from dave-Dell-System-XPS-L502X.hsd1.nh.comcast.net ([2603:3005:3403:7100:2c71:8680:34e1:a6aa]) by smtp.googlemail.com with ESMTPSA id s85-v6sm2275624vse.29.2018.10.31.06.57.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Oct 2018 06:57:37 -0700 (PDT) From: David Long <dave.long@linaro.org> To: stable@vger.kernel.org, Russell King - ARM Linux <linux@armlinux.org.uk>, Florian Fainelli <f.fainelli@gmail.com>, Tony Lindgren <tony@atomide.com>, Marc Zyngier <marc.zyngier@arm.com>, Mark Rutland <mark.rutland@arm.com> Cc: Greg KH <gregkh@linuxfoundation.org>, Mark Brown <broonie@kernel.org> Subject: [PATCH 4.9 17/24] ARM: spectre-v1: add array_index_mask_nospec() implementation Date: Wed, 31 Oct 2018 09:57:06 -0400 Message-Id: <20181031135713.2873-18-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031135713.2873-1-dave.long@linaro.org> References: <20181031135713.2873-1-dave.long@linaro.org> |
Series |
V4.9 backport of 32-bit arm spectre patches
|
expand
|
diff --git a/arch/arm/include/asm/barrier.h b/arch/arm/include/asm/barrier.h index 6f00dac6ad8e..513e03d138ea 100644 --- a/arch/arm/include/asm/barrier.h +++ b/arch/arm/include/asm/barrier.h @@ -75,6 +75,25 @@ extern void arm_heavy_mb(void); #define __smp_rmb() __smp_mb() #define __smp_wmb() dmb(ishst) +#ifdef CONFIG_CPU_SPECTRE +static inline unsigned long array_index_mask_nospec(unsigned long idx, + unsigned long sz) +{ + unsigned long mask; + + asm volatile( + "cmp %1, %2\n" + " sbc %0, %1, %1\n" + CSDB + : "=r" (mask) + : "r" (idx), "Ir" (sz) + : "cc"); + + return mask; +} +#define array_index_mask_nospec array_index_mask_nospec +#endif + #include <asm-generic/barrier.h> #endif /* !__ASSEMBLY__ */