diff options
author | Christophe Leroy <christophe.leroy@c-s.fr> | 2020-04-03 07:20:53 +0000 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2020-05-01 12:37:15 +1000 |
commit | 4fe5cda9f89d0aea8e915b7c96ae34bda4e12e51 (patch) | |
tree | e727d7a8db04f52ecb7d9f0ca6e372520867d26d /arch/powerpc/include/asm/kup.h | |
parent | 1f59cc3482c645c956a06e1b587e49df8d42ebab (diff) | |
download | linux-next-4fe5cda9f89d0aea8e915b7c96ae34bda4e12e51.tar.gz |
powerpc/uaccess: Implement user_read_access_begin and user_write_access_begin
Add support for selective read or write user access with
user_read_access_begin/end and user_write_access_begin/end.
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/6c83af0f0809ef2a955c39ac622767f6cbede035.1585898438.git.christophe.leroy@c-s.fr
Diffstat (limited to 'arch/powerpc/include/asm/kup.h')
-rw-r--r-- | arch/powerpc/include/asm/kup.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/kup.h b/arch/powerpc/include/asm/kup.h index 92bcd1a26d73..c745ee41ad66 100644 --- a/arch/powerpc/include/asm/kup.h +++ b/arch/powerpc/include/asm/kup.h @@ -10,7 +10,9 @@ * Use the current saved situation instead of the to/from/size params. * Used on book3s/32 */ -#define KUAP_CURRENT 4 +#define KUAP_CURRENT_READ 4 +#define KUAP_CURRENT_WRITE 8 +#define KUAP_CURRENT (KUAP_CURRENT_READ | KUAP_CURRENT_WRITE) #ifdef CONFIG_PPC64 #include <asm/book3s/64/kup-radix.h> @@ -101,6 +103,16 @@ static inline void prevent_current_access_user(void) prevent_user_access(NULL, NULL, ~0UL, KUAP_CURRENT); } +static inline void prevent_current_read_from_user(void) +{ + prevent_user_access(NULL, NULL, ~0UL, KUAP_CURRENT_READ); +} + +static inline void prevent_current_write_to_user(void) +{ + prevent_user_access(NULL, NULL, ~0UL, KUAP_CURRENT_WRITE); +} + #endif /* !__ASSEMBLY__ */ #endif /* _ASM_POWERPC_KUAP_H_ */ |