Message ID | 1539617538-22328-18-git-send-email-dave.long@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patches@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp3934018lji; Mon, 15 Oct 2018 08:32:39 -0700 (PDT) X-Received: by 2002:ac8:3775:: with SMTP id p50-v6mr16583820qtb.220.1539617559786; Mon, 15 Oct 2018 08:32:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539617559; cv=none; d=google.com; s=arc-20160816; b=Sgf3VKkiYhoXUAE3s2osbItPve0cSZV6HmKyfr1UtPcuHPJaGZGNt/yqvbQQx1S3O9 3Gf0K0keT5zkAdE3Vvi5dtXp394SoENm4l0mTZFkopmbO8KnArjLc+1SVC1tbwiFF/a8 4UQHnMS8Hivpkvu2nKVUI+U41aZZU60OrSdyW6If3Z4ZtEBFtmPZ5O3VuerWQtUKbWEI 0do9IV0Hm5ps6xrpUFjtZ24fj6JNssA/Dd81vJe4ItvIpWPATCIKdk0LO4xFNvzB93kt F6gVIDrxF7l30IbahZHjPzBzX3AtqoKR1vjosUOMPLGmwdy6O5f/dsZ6nf9e7SDXRfwD 9WLQ== 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=IK07FGdiT49t5RG4yYBjI5Av5y7V6yw5Er9ypNEcTYs=; b=0ofLcR0N9UCZauxypZ+R94rDdTG+t/H2xDV813z9cxozY8LTzedH+nU+TP+gLT3hNh Uvmg1ryfxJiXWDixPbriabAfL9HCgyBeYFfmAYzkCHxUmMTYJxgBG3w6ZjIIV+r5HmyZ /IF6S6S4BaRp22T8cFYxb+DkwW/tfDg3pOUPNRr9gGkWjuNBiJekJcl2f7d68wG10+AE 6WtCfW1D5WhNg9aYMjX8mJAGu3KgJOX3S0wBnF47K2GMgdYNvKSqPpTs/ePrS003Uv7p goa4avpRnpFGxYtMeb6sJlDBD3lkn1QzGPphDMFGK3HNPXS+sfDcd9e6kuiM8L7NBTGD 2AMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M09IRZhO; 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 t7-v6sor4262804qkb.40.2018.10.15.08.32.39 for <patches@linaro.org> (Google Transport Security); Mon, 15 Oct 2018 08:32:39 -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=M09IRZhO; 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=IK07FGdiT49t5RG4yYBjI5Av5y7V6yw5Er9ypNEcTYs=; b=M09IRZhOm4+Lf8/oNiVVvpTNUSuhgWskMBwLK7Ve+/ommLAzmQpLrSXJ0QS6Ga7fbQ dxvC0jVwJ1bsMRBOy1NITgH0HwEEWirMHczOKBB7WSVyGsIIeaFKYhxF5o5YzVu1Ixl6 jEmEoBgwF/rJ+wW1toiwfLOOXnOI3n1qVgESI= 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=IK07FGdiT49t5RG4yYBjI5Av5y7V6yw5Er9ypNEcTYs=; b=k4VZS0RT4BhtoN8piT+FsJrEcmFSTFcIX9I0gq4IBLwug5SffHYGjFNHhU5ETiaLHo lurBCiJOBhUqI+JdyEMexO4hVWIJxoS6ILhW5A1QfVZ9QLxYpgj+muEyrMRT7P7/lOIX klo/+l/g8bbA09bQMyLFGJMJB/wtPju8TPWqrsbAcQMla5udRvvmu21j8wdXcavsKJYU IV9Ji6aYEdKgVDLk9IE6cKfGfa+Rnkg5VNj0sLQYd6LjfQtvXdgrjOIhofL4erVxy5uV dH4neG0Sa8nK6385c8xdzNDx1xIjuWRgmH5Ey0DFVd1/KkUmQ8Bp+kArGqnC2S8YHxHV igoQ== X-Gm-Message-State: ABuFfoiaTuTMlPJVPIAT8OTCYwrnrXWpWbAFzRP1IosOiFubzFwstQ+o pNOYkpodhIS2K9PXcMTgRMYLcq6E X-Google-Smtp-Source: ACcGV6103iVVV2eI4H/0tnuvYoPXykTvDdHd0DE8sepFlcvH39fdpPXsQuZ/n6yWHL7pp3vZTpl/xQ== X-Received: by 2002:a37:bc03:: with SMTP id m3-v6mr16472508qkf.114.1539617559385; Mon, 15 Oct 2018 08:32:39 -0700 (PDT) Return-Path: <dave.long@linaro.org> Received: from localhost.localdomain ([72.71.243.63]) by smtp.googlemail.com with ESMTPSA id g82-v6sm10087768qkh.24.2018.10.15.08.32.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Oct 2018 08:32:38 -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.14 17/24] ARM: spectre-v1: add array_index_mask_nospec() implementation Date: Mon, 15 Oct 2018 11:32:11 -0400 Message-Id: <1539617538-22328-18-git-send-email-dave.long@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1539617538-22328-1-git-send-email-dave.long@linaro.org> References: <1539617538-22328-1-git-send-email-dave.long@linaro.org> |
Series |
V4.14 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 3d9c1d4..69772e7 100644 --- a/arch/arm/include/asm/barrier.h +++ b/arch/arm/include/asm/barrier.h @@ -76,6 +76,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__ */