Message ID | 20181107164402.9380-18-dave.long@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patches@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5387470ljp; Wed, 7 Nov 2018 08:44:25 -0800 (PST) X-Received: by 2002:a37:e20b:: with SMTP id g11mr871329qki.21.1541609065600; Wed, 07 Nov 2018 08:44:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541609065; cv=none; d=google.com; s=arc-20160816; b=mrCDm1ijrR1ShpsObRHYQc4A9rDF5EPAbXj/yFzLE7Fwhi5ahhxwGdztkOYac43GGG 8/yUczvniLreAqm2/SCoI383ylC11YKWcLHteeC9ZbB+GXC5xsstLE1iQaAsC9orM4kQ u6akAUHkEFwrlIKJBTT/UMStJsu+GxCLUq2/fW1BTl6VpaJ8wcijmegteHD5OZmq+ubJ DMScIStuM2mZw9sS3m0ZQdE1u8rw8SQq8uMsuCGIbpuUKL+rboR5j8WA7/dT6YRuWoBb qxqrxr8+7DOVWl9MS+g3doaduDUtBK/EfujHF0t3obFkmb0m81Wul1N6XXcHX1s3ZhJv Wvag== 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=ncWVxdbe4bO5acz4x3mc6lxm3VDI2SBXs3u3TOI2GOG9c266J7anuWGJReZpSjwzb2 TYrQb5Z4N29oFEpn9srChlyRpE/xGV430tGljjroOwPhWo/IcLAbBUwKX/bHr6IOmfUC Roiht+Mr5pElB45HhYcl4hr07JfGh3IQ/pIvJ/htA4gvVL+eaTCvc5AOZ58Eh6Tzxrpw DLpaUDBJylFTnGBXkyC6a7cHsXPbRFheSUtkHx3xcebBOPYlOA/i9JdYOFUsdDVMT9of KOC7kLCNe+680nSaAmnFU5QbUACkqKNq4UwoLNz5eItpoKm0qUxqYRg3b1DhdgV/XWHO IJ8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YjQAgG6K; 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 y127-v6sor577880qkd.96.2018.11.07.08.44.25 for <patches@linaro.org> (Google Transport Security); Wed, 07 Nov 2018 08:44:25 -0800 (PST) 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=YjQAgG6K; 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=YjQAgG6Kjc2Js16v3xlF+Zk6KJQ7RYQvIJ5Wb3FbqvhAnFML74FnvvvGtVY3PWPSp9 ZAXXT6B46JXAAIDQUp1Z5kT4Yy0Vk/jmpW2uOh3lw9hYv2bt7AfFHeVL5SVJH7h/BBpW sEPVqd1lm/L5ANqe00JHvAB5fxX2BeSWhdW1M= 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=R7mTlyHejqn7bNH1s7mfn6tkeKG2mpFrkGVqigdplrjc+xJcwjuksBkBUhmBmviMWA RsTOt8u71Hilc/9q3b7VTvSjJ3kCJQDYcH6qVC/NfJburmyphWyEvQCXc2MBO9dKMpZG S2hyNtu+NWoizHelmEjoE4sFd1sTyVHw5SFa1X0rHC85qGVY5ealpvpYv85rJt52Vmie OheEMFlLiEKxiNB9r3NUI47TZTE7HbjBqGRkXPW1tvb61dXhDwJQE7Dsbu3IBQ+Omk3c NNWuE0LjbH6au0by0E2M2gibbXEN57bVruBsNA8adaKWGlh4tcBLOZwIQ5GxChaGKnzY HlKg== X-Gm-Message-State: AGRZ1gKAS8zIPA2Vu24RQAiuj6RrZqbdLx0KmmIZC3m5GaAHCHAA9Uzn HRLvh3f7rf76FFqoWVksJMmgT0EG X-Google-Smtp-Source: AJdET5dpxD4fsIoLNj4eJs3bnKGCRxplqOv8q7cviqBKvIMxnYstksiy4GiKgh5oUQU0w0+p2qyd9w== X-Received: by 2002:a37:9946:: with SMTP id b67mr907413qke.159.1541609065108; Wed, 07 Nov 2018 08:44:25 -0800 (PST) Return-Path: <dave.long@linaro.org> Received: from localhost.localdomain (pool-72-71-243-63.cncdnh.fast00.myfairpoint.net. [72.71.243.63]) by smtp.googlemail.com with ESMTPSA id 96-v6sm681817qtc.56.2018.11.07.08.44.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Nov 2018 08:44:24 -0800 (PST) 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 V2 17/24] ARM: spectre-v1: add array_index_mask_nospec() implementation Date: Wed, 7 Nov 2018 11:43:55 -0500 Message-Id: <20181107164402.9380-18-dave.long@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181107164402.9380-1-dave.long@linaro.org> References: <20181107164402.9380-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__ */