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>,
Julien Thierry <julien.thierry@arm.com>,
Tony Lindgren <tony@atomide.com>,
Marc Zyngier <marc.zyngier@arm.com>,
Greg KH <gregkh@linuxfoundation.org>,
Mark Rutland <mark.rutland@arm.com>
Cc: Will Deacon <will.deacon@arm.com>,
Mark Brown <broonie@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 4.9 05/16] ARM: 8794/1: uaccess: Prevent speculative use of the current addr_limit
Date: Thu, 14 Feb 2019 09:49:19 -0500 [thread overview]
Message-ID: <20190214144930.27539-6-dave.long@linaro.org> (raw)
In-Reply-To: <20190214144930.27539-1-dave.long@linaro.org>
From: Julien Thierry <julien.thierry@arm.com>
Commit 621afc677465db231662ed126ae1f355bf8eac47 upstream.
A mispredicted conditional call to set_fs could result in the wrong
addr_limit being forwarded under speculation to a subsequent access_ok
check, potentially forming part of a spectre-v1 attack using uaccess
routines.
This patch prevents this forwarding from taking place, but putting heavy
barriers in set_fs after writing the addr_limit.
Porting commit c2f0ad4fc089cff8 ("arm64: uaccess: Prevent speculative use
of the current addr_limit").
Signed-off-by: Julien Thierry <julien.thierry@arm.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David A. Long <dave.long@linaro.org>
---
arch/arm/include/asm/uaccess.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index 7b17460127fd..9ae888775743 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -99,6 +99,14 @@ extern int __put_user_bad(void);
static inline void set_fs(mm_segment_t fs)
{
current_thread_info()->addr_limit = fs;
+
+ /*
+ * Prevent a mispredicted conditional call to set_fs from forwarding
+ * the wrong address limit to access_ok under speculation.
+ */
+ dsb(nsh);
+ isb();
+
modify_domain(DOMAIN_KERNEL, fs ? DOMAIN_CLIENT : DOMAIN_MANAGER);
}
--
2.17.1
next prev parent reply other threads:[~2019-02-14 14:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-14 14:49 [PATCH 4.9 00/16] V4.9 backport of more 32-bit arm spectre patches David Long
2019-02-14 14:49 ` [PATCH 4.9 01/16] ARM: 8789/1: signal: copy registers using __copy_to_user() David Long
2019-02-14 14:49 ` [PATCH 4.9 02/16] ARM: 8791/1: vfp: use __copy_to_user() when saving VFP state David Long
2019-02-14 14:49 ` [PATCH 4.9 03/16] ARM: 8792/1: oabi-compat: copy oabi events using __copy_to_user() David Long
2019-02-14 14:49 ` [PATCH 4.9 04/16] ARM: 8793/1: signal: replace __put_user_error with __put_user David Long
2019-02-14 14:49 ` David Long [this message]
2019-02-14 14:49 ` [PATCH 4.9 06/16] ARM: 8795/1: spectre-v1.1: use put_user() for __put_user() David Long
2019-02-14 14:49 ` [PATCH 4.9 07/16] ARM: 8796/1: spectre-v1,v1.1: provide helpers for address sanitization David Long
2019-02-14 14:49 ` [PATCH 4.9 08/16] ARM: 8797/1: spectre-v1.1: harden __copy_to_user David Long
2019-02-14 14:49 ` [PATCH 4.9 09/16] ARM: 8810/1: vfp: Fix wrong assignement to ufp_exc David Long
2019-02-14 14:49 ` [PATCH 4.9 10/16] ARM: make lookup_processor_type() non-__init David Long
2019-02-14 14:49 ` [PATCH 4.9 11/16] ARM: split out processor lookup David Long
2019-02-14 14:49 ` [PATCH 4.9 12/16] ARM: clean up per-processor check_bugs method call David Long
2019-02-14 14:49 ` [PATCH 4.9 13/16] ARM: add PROC_VTABLE and PROC_TABLE macros David Long
2019-02-14 14:49 ` [PATCH 4.9 14/16] ARM: spectre-v2: per-CPU vtables to work around big.Little systems David Long
2019-02-14 14:49 ` [PATCH 4.9 15/16] ARM: ensure that processor vtables is not lost after boot David Long
2019-02-14 14:49 ` [PATCH 4.9 16/16] ARM: fix the cockup in the previous patch David Long
2019-02-14 18:02 ` [PATCH 4.9 00/16] V4.9 backport of more 32-bit arm spectre patches Julien Thierry
2019-02-17 19:09 ` Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190214144930.27539-6-dave.long@linaro.org \
--to=dave.long@linaro.org \
--cc=broonie@kernel.org \
--cc=f.fainelli@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=julien.thierry@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=stable@vger.kernel.org \
--cc=tony@atomide.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox