Commit 406637c1 authored by Tong Tiangen's avatar Tong Tiangen Committed by Ma Wupeng
Browse files

uaccess: add generic fallback version of copy_mc_to_user()

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5GB28


CVE: NA

-------------------------------

x86/powerpc has it's implementation of copy_mc_to_user(), we add generic
fallback in include/linux/uaccess.h prepare for other architechures to
enable CONFIG_ARCH_HAS_COPY_MC.

Signed-off-by: default avatarTong Tiangen <tongtiangen@huawei.com>
parent 54a8cc05
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -388,6 +388,7 @@ copy_mc_to_user(void __user *to, const void *from, unsigned long n)

	return n;
}
#define copy_mc_to_user copy_mc_to_user
#endif

#ifdef __powerpc64__
+1 −0
Original line number Diff line number Diff line
@@ -447,6 +447,7 @@ copy_mc_to_kernel(void *to, const void *from, unsigned len);

unsigned long __must_check
copy_mc_to_user(void *to, const void *from, unsigned len);
#define copy_mc_to_user copy_mc_to_user
#endif

/*
+9 −0
Original line number Diff line number Diff line
@@ -224,6 +224,15 @@ copy_mc_to_kernel(void *dst, const void *src, size_t cnt)
}
#endif

#ifndef copy_mc_to_user
static inline unsigned long __must_check
copy_mc_to_user(void *dst, const void *src, size_t cnt)
{
	check_object_size(src, cnt, true);
	return raw_copy_to_user(dst, src, cnt);
}
#endif

static __always_inline void pagefault_disabled_inc(void)
{
	current->pagefault_disabled++;