Skip to content

Commit e3aa624

Browse files
Julien ThierryRussell King
authored andcommitted
ARM: 8795/1: spectre-v1.1: use put_user() for __put_user()
When Spectre mitigation is required, __put_user() needs to include check_uaccess. This is already the case for put_user(), so just make __put_user() an alias of put_user(). Signed-off-by: Julien Thierry <julien.thierry@arm.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
1 parent 621afc6 commit e3aa624

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

arch/arm/include/asm/uaccess.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,19 +370,21 @@ do { \
370370
__pu_err; \
371371
})
372372

373+
#ifdef CONFIG_CPU_SPECTRE
374+
/*
375+
* When mitigating Spectre variant 1.1, all accessors need to include
376+
* verification of the address space.
377+
*/
378+
#define __put_user(x, ptr) put_user(x, ptr)
379+
380+
#else
373381
#define __put_user(x, ptr) \
374382
({ \
375383
long __pu_err = 0; \
376384
__put_user_switch((x), (ptr), __pu_err, __put_user_nocheck); \
377385
__pu_err; \
378386
})
379387

380-
#define __put_user_error(x, ptr, err) \
381-
({ \
382-
__put_user_switch((x), (ptr), (err), __put_user_nocheck); \
383-
(void) 0; \
384-
})
385-
386388
#define __put_user_nocheck(x, __pu_ptr, __err, __size) \
387389
do { \
388390
unsigned long __pu_addr = (unsigned long)__pu_ptr; \
@@ -462,6 +464,7 @@ do { \
462464
: "r" (x), "i" (-EFAULT) \
463465
: "cc")
464466

467+
#endif /* !CONFIG_CPU_SPECTRE */
465468

466469
#ifdef CONFIG_MMU
467470
extern unsigned long __must_check

0 commit comments

Comments
 (0)