@@ -370,6 +370,20 @@ static inline void set_fs(mm_segment_t fs)
__pu_err; \
})
+#ifdef CONFIG_CPU_SPECTRE
+/*
+ * When mitigating Spectre variant 1.1, all accessors need to include
+ * verification of the address space.
+ */
+#define __put_user(x, ptr) put_user(x, ptr)
+
+#define __put_user_error(x, ptr, err) \
+({ \
+ __put_user_switch((x), (ptr), (err), __put_user_check); \
+ (void) 0; \
+})
+
+#else
#define __put_user(x, ptr) \
({ \
long __pu_err = 0; \
@@ -462,6 +476,7 @@ static inline void set_fs(mm_segment_t fs)
: "r" (x), "i" (-EFAULT) \
: "cc")
+#endif /* !CONFIG_CPU_SPECTRE */
#ifdef CONFIG_MMU
extern unsigned long __must_check
When Spectre mitigation is required, define __put_user() and __put_user_error() to include check_uaccess, ensuring user address is sanitized. Signed-off-by: Julien Thierry <julien.thierry@arm.com> Cc: Russell King <linux@armlinux.org.uk> --- arch/arm/include/asm/uaccess.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 1.9.1