arch/mips/include/asm/uaccess.h:82:10: error: use of undeclared identifier '__UA_LIMIT'

From: kernel test robot
Date: Fri Nov 05 2021 - 07:36:50 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d4439a1189f93d0ac1eaf0197db8e6b3e197d5c7
commit: 04324f44cb69a03fdc8f2ee52386a4fdf6a0043b MIPS: Remove get_fs/set_fs
date: 7 months ago
config: mips-randconfig-r014-20211103 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 264d3b6d4e08401c5b50a85bd76e80b3461d77e6)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=04324f44cb69a03fdc8f2ee52386a4fdf6a0043b
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 04324f44cb69a03fdc8f2ee52386a4fdf6a0043b
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips prepare

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

In file included from arch/mips/kernel/asm-offsets.c:12:
In file included from include/linux/compat.h:14:
In file included from include/linux/sem.h:5:
In file included from include/uapi/linux/sem.h:5:
In file included from include/linux/ipc.h:5:
In file included from include/linux/spinlock.h:61:
In file included from arch/mips/include/asm/mmiowb.h:5:
In file included from arch/mips/include/asm/io.h:29:
arch/mips/include/asm/page.h:196:13: error: use of undeclared identifier 'CAC_BASE'
return x - PAGE_OFFSET + PHYS_OFFSET;
^
arch/mips/include/asm/mach-generic/spaces.h:91:23: note: expanded from macro 'PAGE_OFFSET'
#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)
^
In file included from arch/mips/kernel/asm-offsets.c:12:
In file included from include/linux/compat.h:14:
In file included from include/linux/sem.h:5:
In file included from include/uapi/linux/sem.h:5:
In file included from include/linux/ipc.h:5:
In file included from include/linux/spinlock.h:61:
In file included from arch/mips/include/asm/mmiowb.h:5:
arch/mips/include/asm/io.h:134:28: error: use of undeclared identifier 'CAC_BASE'
return (void *)(address + PAGE_OFFSET - PHYS_OFFSET);
^
arch/mips/include/asm/mach-generic/spaces.h:91:23: note: expanded from macro 'PAGE_OFFSET'
#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)
^
In file included from arch/mips/kernel/asm-offsets.c:12:
In file included from include/linux/compat.h:17:
In file included from include/linux/fs.h:33:
In file included from include/linux/percpu-rwsem.h:7:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:9:
In file included from include/linux/sched/task.h:11:
In file included from include/linux/uaccess.h:11:
>> arch/mips/include/asm/uaccess.h:82:10: error: use of undeclared identifier '__UA_LIMIT'
return (__UA_LIMIT & (addr | (addr + size) | __ua_size(size))) == 0;
^
arch/mips/include/asm/uaccess.h:464:3: error: expected ')'
__UA_ADDU "\t$1, %1, %2\n\t"
^
arch/mips/include/asm/uaccess.h:514:3: error: expected ')'
__UA_ADDU "\t$1, %1, %2\n\t"
^
arch/mips/include/asm/uaccess.h:558:5: error: expected string literal in 'asm'
: bzero_clobbers);
^
arch/mips/include/asm/uaccess.h:546:42: note: expanded from macro 'bzero_clobbers'
#define bzero_clobbers "$4", "$5", "$6", __UA_t0, __UA_t1, "$31"
^
arch/mips/include/asm/uaccess.h:558:5: error: expected ')'
arch/mips/include/asm/uaccess.h:546:42: note: expanded from macro 'bzero_clobbers'
#define bzero_clobbers "$4", "$5", "$6", __UA_t0, __UA_t1, "$31"
^
arch/mips/include/asm/uaccess.h:609:35: error: expected string literal in 'asm'
: "$2", "$3", "$4", "$5", "$6", __UA_t0, "$31", "memory");
^
arch/mips/include/asm/uaccess.h:609:35: error: expected ')'
arch/mips/include/asm/uaccess.h:644:23: error: expected string literal in 'asm'
: "$2", "$4", "$5", __UA_t0, "$31");
^
arch/mips/include/asm/uaccess.h:644:23: error: expected ')'
In file included from arch/mips/kernel/asm-offsets.c:15:
In file included from include/linux/mm.h:33:
In file included from include/linux/pgtable.h:6:
>> arch/mips/include/asm/pgtable.h:232:29: error: implicit declaration of function 'pte_pfn' [-Werror,-Wimplicit-function-declaration]
if (pte_present(*ptep) && (pte_pfn(*ptep) == pte_pfn(pteval)))
^
>> arch/mips/include/asm/pgtable.h:550:25: error: unknown type name 'pmd_t'
unsigned long address, pmd_t *pmdp)
^
In file included from arch/mips/kernel/asm-offsets.c:15:
In file included from include/linux/mm.h:33:
In file included from include/linux/pgtable.h:14:
>> include/asm-generic/pgtable_uffd.h:10:40: error: unknown type name 'pmd_t'
static __always_inline int pmd_uffd_wp(pmd_t pmd)
^
include/asm-generic/pgtable_uffd.h:20:24: error: unknown type name 'pmd_t'
static __always_inline pmd_t pmd_mkuffd_wp(pmd_t pmd)
^
include/asm-generic/pgtable_uffd.h:20:44: error: unknown type name 'pmd_t'
static __always_inline pmd_t pmd_mkuffd_wp(pmd_t pmd)
^
include/asm-generic/pgtable_uffd.h:30:24: error: unknown type name 'pmd_t'
static __always_inline pmd_t pmd_clear_uffd_wp(pmd_t pmd)
^
include/asm-generic/pgtable_uffd.h:30:48: error: unknown type name 'pmd_t'
static __always_inline pmd_t pmd_clear_uffd_wp(pmd_t pmd)
^
include/asm-generic/pgtable_uffd.h:50:15: error: unknown type name 'pmd_t'
static inline pmd_t pmd_swp_mkuffd_wp(pmd_t pmd)
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [scripts/Makefile.build:116: arch/mips/kernel/asm-offsets.s] Error 1
make[2]: Target '__build' not remade because of errors.
make[1]: *** [Makefile:1233: prepare0] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:215: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.


vim +/__UA_LIMIT +82 arch/mips/include/asm/uaccess.h

44
45 /*
46 * Is a address valid? This does a straightforward calculation rather
47 * than tests.
48 *
49 * Address valid if:
50 * - "addr" doesn't have any high-bits set
51 * - AND "size" doesn't have any high-bits set
52 * - AND "addr+size" doesn't have any high-bits set
53 * - OR we are in kernel mode.
54 *
55 * __ua_size() is a trick to avoid runtime checking of positive constant
56 * sizes; for those we already know at compile time that the size is ok.
57 */
58 #define __ua_size(size) \
59 ((__builtin_constant_p(size) && (signed long) (size) > 0) ? 0 : (size))
60
61 /*
62 * access_ok: - Checks if a user space pointer is valid
63 * @addr: User space pointer to start of block to check
64 * @size: Size of block to check
65 *
66 * Context: User context only. This function may sleep if pagefaults are
67 * enabled.
68 *
69 * Checks if a pointer to a block of memory in user space is valid.
70 *
71 * Returns true (nonzero) if the memory block may be valid, false (zero)
72 * if it is definitely invalid.
73 *
74 * Note that, depending on architecture, this function probably just
75 * checks that the pointer is in the user space range - after calling
76 * this function, memory access functions may still return -EFAULT.
77 */
78
79 static inline int __access_ok(const void __user *p, unsigned long size)
80 {
81 unsigned long addr = (unsigned long)p;
> 82 return (__UA_LIMIT & (addr | (addr + size) | __ua_size(size))) == 0;
83 }
84

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip