Skip to content

Commit

Permalink
ARM: 8795/1: spectre-v1.1: use put_user() for __put_user()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Julien Thierry authored and Russell King committed Oct 5, 2018
1 parent 621afc6 commit e3aa624
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions arch/arm/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,19 +370,21 @@ do { \
__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)

#else
#define __put_user(x, ptr) \
({ \
long __pu_err = 0; \
__put_user_switch((x), (ptr), __pu_err, __put_user_nocheck); \
__pu_err; \
})

#define __put_user_error(x, ptr, err) \
({ \
__put_user_switch((x), (ptr), (err), __put_user_nocheck); \
(void) 0; \
})

#define __put_user_nocheck(x, __pu_ptr, __err, __size) \
do { \
unsigned long __pu_addr = (unsigned long)__pu_ptr; \
Expand Down Expand Up @@ -462,6 +464,7 @@ do { \
: "r" (x), "i" (-EFAULT) \
: "cc")

#endif /* !CONFIG_CPU_SPECTRE */

#ifdef CONFIG_MMU
extern unsigned long __must_check
Expand Down

0 comments on commit e3aa624

Please sign in to comment.