[mcgrof:modules-next 6/10] arch/riscv/include/asm/set_memory.h:25:18: error: implicit declaration of function 'PAGE_ALIGN'

From: kernel test robot
Date: Sun Feb 20 2022 - 18:27:06 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git modules-next
head: c55dc78176e6fe97a9e92d24a7ff3015b14ac858
commit: e5973a14d18785b893d383fbd9dc2f98edc16f1b [6/10] module: Move strict rwx support to a separate file
config: riscv-randconfig-r032-20220220 (https://download.01.org/0day-ci/archive/20220221/202202210752.fpjFZ4sv-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/commit/?id=e5973a14d18785b893d383fbd9dc2f98edc16f1b
git remote add mcgrof https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git
git fetch --no-tags mcgrof modules-next
git checkout e5973a14d18785b893d383fbd9dc2f98edc16f1b
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash

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 kernel/module/strict_rwx.c:10:
In file included from include/linux/set_memory.h:9:
>> arch/riscv/include/asm/set_memory.h:25:18: error: implicit declaration of function 'PAGE_ALIGN' [-Werror,-Wimplicit-function-declaration]
int num_pages = PAGE_ALIGN(end - start) >> PAGE_SHIFT;
^
kernel/module/strict_rwx.c:16:10: error: implicit declaration of function 'PAGE_ALIGNED' [-Werror,-Wimplicit-function-declaration]
BUG_ON(!PAGE_ALIGNED(layout->base));
^
kernel/module/strict_rwx.c:17:10: error: implicit declaration of function 'PAGE_ALIGNED' [-Werror,-Wimplicit-function-declaration]
BUG_ON(!PAGE_ALIGNED(layout->text_size));
^
kernel/module/strict_rwx.c:18:10: error: implicit declaration of function 'PAGE_ALIGNED' [-Werror,-Wimplicit-function-declaration]
BUG_ON(!PAGE_ALIGNED(layout->ro_size));
^
kernel/module/strict_rwx.c:26:10: error: implicit declaration of function 'PAGE_ALIGNED' [-Werror,-Wimplicit-function-declaration]
BUG_ON(!PAGE_ALIGNED(layout->base));
^
kernel/module/strict_rwx.c:27:10: error: implicit declaration of function 'PAGE_ALIGNED' [-Werror,-Wimplicit-function-declaration]
BUG_ON(!PAGE_ALIGNED(layout->ro_size));
^
kernel/module/strict_rwx.c:28:10: error: implicit declaration of function 'PAGE_ALIGNED' [-Werror,-Wimplicit-function-declaration]
BUG_ON(!PAGE_ALIGNED(layout->ro_after_init_size));
^
kernel/module/strict_rwx.c:36:10: error: implicit declaration of function 'PAGE_ALIGNED' [-Werror,-Wimplicit-function-declaration]
BUG_ON(!PAGE_ALIGNED(layout->base));
^
kernel/module/strict_rwx.c:37:10: error: implicit declaration of function 'PAGE_ALIGNED' [-Werror,-Wimplicit-function-declaration]
BUG_ON(!PAGE_ALIGNED(layout->ro_after_init_size));
^
kernel/module/strict_rwx.c:38:10: error: implicit declaration of function 'PAGE_ALIGNED' [-Werror,-Wimplicit-function-declaration]
BUG_ON(!PAGE_ALIGNED(layout->size));
^
10 errors generated.


vim +/PAGE_ALIGN +25 arch/riscv/include/asm/set_memory.h

d3ab332a502123 Zong Li 2020-03-10 8
00cb41d5ad3189 Zong Li 2020-03-10 9 #ifndef __ASSEMBLY__
d3ab332a502123 Zong Li 2020-03-10 10 /*
d3ab332a502123 Zong Li 2020-03-10 11 * Functions to change memory attributes.
d3ab332a502123 Zong Li 2020-03-10 12 */
d3ab332a502123 Zong Li 2020-03-10 13 #ifdef CONFIG_MMU
d3ab332a502123 Zong Li 2020-03-10 14 int set_memory_ro(unsigned long addr, int numpages);
d3ab332a502123 Zong Li 2020-03-10 15 int set_memory_rw(unsigned long addr, int numpages);
d3ab332a502123 Zong Li 2020-03-10 16 int set_memory_x(unsigned long addr, int numpages);
d3ab332a502123 Zong Li 2020-03-10 17 int set_memory_nx(unsigned long addr, int numpages);
19a00869028f4a Atish Patra 2020-11-04 18 int set_memory_rw_nx(unsigned long addr, int numpages);
c10bc260e7c030 Alexandre Ghiti 2021-06-24 19 static __always_inline int set_kernel_memory(char *startp, char *endp,
c10bc260e7c030 Alexandre Ghiti 2021-06-24 20 int (*set_memory)(unsigned long start,
c10bc260e7c030 Alexandre Ghiti 2021-06-24 21 int num_pages))
c10bc260e7c030 Alexandre Ghiti 2021-06-24 22 {
c10bc260e7c030 Alexandre Ghiti 2021-06-24 23 unsigned long start = (unsigned long)startp;
c10bc260e7c030 Alexandre Ghiti 2021-06-24 24 unsigned long end = (unsigned long)endp;
c10bc260e7c030 Alexandre Ghiti 2021-06-24 @25 int num_pages = PAGE_ALIGN(end - start) >> PAGE_SHIFT;
c10bc260e7c030 Alexandre Ghiti 2021-06-24 26
c10bc260e7c030 Alexandre Ghiti 2021-06-24 27 return set_memory(start, num_pages);
c10bc260e7c030 Alexandre Ghiti 2021-06-24 28 }
d3ab332a502123 Zong Li 2020-03-10 29 #else
d3ab332a502123 Zong Li 2020-03-10 30 static inline int set_memory_ro(unsigned long addr, int numpages) { return 0; }
d3ab332a502123 Zong Li 2020-03-10 31 static inline int set_memory_rw(unsigned long addr, int numpages) { return 0; }
d3ab332a502123 Zong Li 2020-03-10 32 static inline int set_memory_x(unsigned long addr, int numpages) { return 0; }
d3ab332a502123 Zong Li 2020-03-10 33 static inline int set_memory_nx(unsigned long addr, int numpages) { return 0; }
19a00869028f4a Atish Patra 2020-11-04 34 static inline int set_memory_rw_nx(unsigned long addr, int numpages) { return 0; }
c10bc260e7c030 Alexandre Ghiti 2021-06-24 35 static inline int set_kernel_memory(char *startp, char *endp,
c10bc260e7c030 Alexandre Ghiti 2021-06-24 36 int (*set_memory)(unsigned long start,
c10bc260e7c030 Alexandre Ghiti 2021-06-24 37 int num_pages))
c10bc260e7c030 Alexandre Ghiti 2021-06-24 38 {
c10bc260e7c030 Alexandre Ghiti 2021-06-24 39 return 0;
c10bc260e7c030 Alexandre Ghiti 2021-06-24 40 }
d3ab332a502123 Zong Li 2020-03-10 41 #endif
d3ab332a502123 Zong Li 2020-03-10 42

:::::: The code at line 25 was first introduced by commit
:::::: c10bc260e7c030364b5150aac7ebf048ddfb9502 riscv: Introduce set_kernel_memory helper

:::::: TO: Alexandre Ghiti <alex@xxxxxxxx>
:::::: CC: Palmer Dabbelt <palmerdabbelt@xxxxxxxxxx>

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