From: Bixuan Cui cuibixuan@huawei.com
hulk inclusion category: bugfix bugzilla: NA CVE: NA
An error is reported during powerpc platform compilation because VERIFY_WRITE is already removed in powerpc platform.
./arch/powerpc/include/asm/uaccess.h: In function ‘clear_user’: ./arch/powerpc/include/asm/uaccess.h:446:48: error: macro "access_ok" passed 3 arguments, but takes just 2 if (likely(access_ok(VERIFY_WRITE, addr, size))) { ^ In file included from ./include/asm-generic/div64.h:25:0, from ./arch/powerpc/include/generated/asm/div64.h:1, from ./include/linux/math64.h:6, from ./include/linux/time64.h:5, from ./include/linux/compat_time.h:6, from ./include/linux/compat.h:10, from arch/powerpc/kernel/asm-offsets.c:16: ./arch/powerpc/include/asm/uaccess.h:446:13: error: ‘access_ok’ undeclared (first use in this function) if (likely(access_ok(VERIFY_WRITE, addr, size))) { ^ ./include/linux/compiler.h:76:40: note: in definition of macro ‘likely’ # define likely(x) __builtin_expect(!!(x), 1) ^ ./arch/powerpc/include/asm/uaccess.h:446:13: note: each undeclared identifier is reported only once for each function it appears in if (likely(access_ok(VERIFY_WRITE, addr, size))) { ^ ./include/linux/compiler.h:76:40: note: in definition of macro ‘likely’ # define likely(x) __builtin_expect(!!(x), 1) ^ Kbuild:56: recipe for target 'arch/powerpc/kernel/asm-offsets.s' failed
Fixes: c824e22c0f96 ("powerpc: Add a framework for user access tracking") Fixes: a29f72fe34fe ("powerpc: Implement user_access_begin and friends")
Signed-off-by: Bixuan Cui cuibixuan@huawei.com Reviewed-by: Hanjun Guo guohanjun@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- arch/powerpc/include/asm/uaccess.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h index 1bcf1b01a873f..f04f5d43496a2 100644 --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h @@ -443,7 +443,7 @@ static inline unsigned long clear_user(void __user *addr, unsigned long size) { unsigned long ret = size; might_fault(); - if (likely(access_ok(VERIFY_WRITE, addr, size))) { + if (likely(access_ok(addr, size))) { allow_write_to_user(addr, size); ret = __arch_clear_user(addr, size); prevent_write_to_user(addr, size); @@ -464,7 +464,7 @@ extern long __copy_from_user_flushcache(void *dst, const void __user *src, extern void memcpy_page_flushcache(char *to, struct page *page, size_t offset, size_t len);
-#define user_access_begin(type, ptr, len) access_ok(type, ptr, len) +#define user_access_begin(ptr, len) access_ok(ptr, len) #define user_access_end() prevent_user_access(NULL, NULL, ~0ul)
#define unsafe_op_wrap(op, err) do { if (unlikely(op)) goto err; } while (0)