]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - arch/x86/lib/usercopy.c
Merge branch 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszer...
[mirror_ubuntu-bionic-kernel.git] / arch / x86 / lib / usercopy.c
CommitLineData
1ac2e6ca
RR
1/*
2 * User address space access functions.
3 *
4 * For licencing details see kernel-base/COPYING
5 */
6
beba3a20 7#include <linux/uaccess.h>
e683014c 8#include <linux/export.h>
1ac2e6ca
RR
9
10/*
e00b12e6
PZ
11 * We rely on the nested NMI work to allow atomic faults from the NMI path; the
12 * nested NMI paths are careful to preserve CR2.
1ac2e6ca
RR
13 */
14unsigned long
15copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
16{
e00b12e6 17 unsigned long ret;
1ac2e6ca 18
25f42985 19 if (__range_not_ok(from, n, TASK_SIZE))
ebf2d268 20 return n;
e00b12e6
PZ
21
22 /*
23 * Even though this function is typically called from NMI/IRQ context
24 * disable pagefaults so that its behaviour is consistent even when
25 * called form other contexts.
26 */
27 pagefault_disable();
28 ret = __copy_from_user_inatomic(to, from, n);
29 pagefault_enable();
30
0a196848 31 return ret;
1ac2e6ca
RR
32}
33EXPORT_SYMBOL_GPL(copy_from_user_nmi);