diff options
author | Christoph Hellwig <hch@lst.de> | 2020-09-03 16:22:41 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2020-09-08 22:21:36 -0400 |
commit | c33165253492b91337f88c84b11733a4a2d55b60 (patch) | |
tree | dee16f97a31c37d5a40e12e16729e820aa2f5e05 /arch/powerpc/include/asm/uaccess.h | |
parent | 47058bb54b57962b3958a936ddbc59355e4c5504 (diff) | |
download | lwn-c33165253492b91337f88c84b11733a4a2d55b60.tar.gz lwn-c33165253492b91337f88c84b11733a4a2d55b60.zip |
powerpc: use non-set_fs based maccess routines
Provide __get_kernel_nofault and __put_kernel_nofault routines to
implement the maccess routines without messing with set_fs and without
opening up access to user space.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/powerpc/include/asm/uaccess.h')
-rw-r--r-- | arch/powerpc/include/asm/uaccess.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h index 00699903f1ef..7fe3531ad36a 100644 --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h @@ -623,4 +623,20 @@ do { \ __put_user_goto(*(u8*)(_src + _i), (u8 __user *)(_dst + _i), e);\ } while (0) +#define HAVE_GET_KERNEL_NOFAULT + +#define __get_kernel_nofault(dst, src, type, err_label) \ +do { \ + int __kr_err; \ + \ + __get_user_size_allowed(*((type *)(dst)), (__force type __user *)(src),\ + sizeof(type), __kr_err); \ + if (unlikely(__kr_err)) \ + goto err_label; \ +} while (0) + +#define __put_kernel_nofault(dst, src, type, err_label) \ + __put_user_size_goto(*((type *)(src)), \ + (__force type __user *)(dst), sizeof(type), err_label) + #endif /* _ARCH_POWERPC_UACCESS_H */ |