Skip to content

Commit fa94111

Browse files
Christoph Hellwigtorvalds
authored andcommitted
x86: use non-set_fs based maccess routines
Provide arch_kernel_read and arch_kernel_write routines to implement the maccess routines without messing with set_fs and without stac/clac that opens up access to user space. [[email protected]: coding style fixes] Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent b58294e commit fa94111

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

arch/x86/include/asm/uaccess.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,5 +523,21 @@ do { \
523523
unsafe_copy_loop(__ucu_dst, __ucu_src, __ucu_len, u8, label); \
524524
} while (0)
525525

526+
#define HAVE_GET_KERNEL_NOFAULT
527+
528+
#define __get_kernel_nofault(dst, src, type, err_label) \
529+
do { \
530+
int __kr_err; \
531+
\
532+
__get_user_size(*((type *)dst), (__force type __user *)src, \
533+
sizeof(type), __kr_err); \
534+
if (unlikely(__kr_err)) \
535+
goto err_label; \
536+
} while (0)
537+
538+
#define __put_kernel_nofault(dst, src, type, err_label) \
539+
__put_user_size(*((type *)(src)), (__force type __user *)(dst), \
540+
sizeof(type), err_label)
541+
526542
#endif /* _ASM_X86_UACCESS_H */
527543

0 commit comments

Comments
 (0)