@@ -512,6 +512,15 @@ do { \
extern unsigned long __must_check
arm_copy_from_user(void *to, const void __user *from, unsigned long n);
+#ifdef CONFIG_UACCESS_GUP_KMAP_MEMCPY
+extern unsigned long __must_check
+gup_kmap_copy_from_user(void *to, const void __user *from, unsigned long n);
+static inline __must_check unsigned long
+raw_copy_from_user(void *to, const void __user *from, unsigned long n)
+{
+ return gup_kmap_copy_from_user(to, from, n);
+}
+#else
static inline unsigned long __must_check
raw_copy_from_user(void *to, const void __user *from, unsigned long n)
{
@@ -522,12 +531,22 @@ raw_copy_from_user(void *to, const void __user *from, unsigned long n)
uaccess_restore(__ua_flags);
return n;
}
+#endif
extern unsigned long __must_check
arm_copy_to_user(void __user *to, const void *from, unsigned long n);
extern unsigned long __must_check
__copy_to_user_std(void __user *to, const void *from, unsigned long n);
+#ifdef CONFIG_UACCESS_GUP_KMAP_MEMCPY
+extern unsigned long __must_check
+gup_kmap_copy_to_user(void __user *to, const void *from, unsigned long n);
+static inline __must_check unsigned long
+raw_copy_to_user(void __user *to, const void *from, unsigned long n)
+{
+ return gup_kmap_copy_to_user(to, from, n);
+}
+#else
static inline unsigned long __must_check
raw_copy_to_user(void __user *to, const void *from, unsigned long n)
{
@@ -541,6 +560,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n)
return arm_copy_to_user(to, from, n);
#endif
}
+#endif
extern unsigned long __must_check
arm_clear_user(void __user *addr, unsigned long n);
@@ -96,8 +96,10 @@ EXPORT_SYMBOL(mmiocpy);
#ifdef CONFIG_MMU
EXPORT_SYMBOL(copy_page);
+#ifndef CONFIG_UACCESS_GUP_KMAP_MEMCPY
EXPORT_SYMBOL(arm_copy_from_user);
EXPORT_SYMBOL(arm_copy_to_user);
+#endif
EXPORT_SYMBOL(arm_clear_user);
EXPORT_SYMBOL(__get_user_1);
@@ -16,8 +16,11 @@ lib-y := changebit.o csumipv6.o csumpartial.o \
io-readsb.o io-writesb.o io-readsl.o io-writesl.o \
call_with_stack.o bswapsdi2.o
-mmu-y := clear_user.o copy_page.o getuser.o putuser.o \
- copy_from_user.o copy_to_user.o
+mmu-y := clear_user.o copy_page.o getuser.o putuser.o
+
+ifndef CONFIG_UACCESS_GUP_KMAP_MEMCPY
+ mmu-y += copy_from_user.o copy_to_user.o
+endif
ifdef CONFIG_CC_IS_CLANG
lib-y += backtrace-clang.o
Turn off existing raw_copy_{from,to}_user() using arm_copy_{from,to}_user() when CONFIG_UACCESS_GUP_KMAP_MEMCPY is enabled. Signed-off-by: afzal mohammed <afzal.mohd.ma@gmail.com> --- Resending to linux-arm-kernel ml(only), as received a mail that it is waiting for moderator approval, trying the resend by adding 'PATCH' in subject after 'RFC', in the hope it will hit ml with this manipulation arch/arm/include/asm/uaccess.h | 20 ++++++++++++++++++++ arch/arm/kernel/armksyms.c | 2 ++ arch/arm/lib/Makefile | 7 +++++-- 3 files changed, 27 insertions(+), 2 deletions(-)