[linux-next:master 10963/10966] <stdin>:1539:2: warning: #warning syscall memfd_secret not implemented

Mike Rapoport rppt at linux.ibm.com
Sun Dec 6 05:55:45 EST 2020


(added RISC-V maintainers)

On Fri, Dec 04, 2020 at 11:41:55PM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   2996bd3f6ca9ea529b40c369a94b247657abdb4d
> commit: f742050435413d2fe8deba095304788d26a8a144 [10963/10966] arch, mm: wire up memfd_secret system call were relevant
> config: riscv-nommu_k210_defconfig (attached as .config)
> compiler: riscv64-linux-gcc (GCC) 9.3.0
> 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
>         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=f742050435413d2fe8deba095304788d26a8a144
>         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>         git fetch --no-tags linux-next master
>         git checkout f742050435413d2fe8deba095304788d26a8a144
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=riscv 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp at intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
> >> <stdin>:1539:2: warning: #warning syscall memfd_secret not implemented [-Wcpp]
> --
>    arch/riscv/kernel/asm-offsets.c:14:6: warning: no previous prototype for 'asm_offsets' [-Wmissing-prototypes]
>       14 | void asm_offsets(void)
>          |      ^~~~~~~~~~~
> >> <stdin>:1539:2: warning: #warning syscall memfd_secret not implemented [-Wcpp]

The availabilty of memfd_secret depends on ARCH_HAS_SET_DIRECT_MAP and
on riscv this option is selected for nommu.

The patch below makes ARCH_HAS_SET_DIRECT_MAP dependent on MMU, which
makes sense regardless of memfd_secret.

>From 26cde530ac050bf8a7417230a32daa6fb7c39e9b Mon Sep 17 00:00:00 2001
From: Mike Rapoport <rppt at linux.ibm.com>
Date: Sun, 6 Dec 2020 12:42:10 +0200
Subject: [PATCH] riscv: make ARCH_HAS_SET_DIRECT_MAP dependent on MMU

The direct map manipulation methods are implemented in
arch/riscv/mm/pageattr.c and they are only built when CONFIG_MMU=y.

Besides, there is not much point in having these functions for nommu
variant.

Update Kconfig to select ARCH_HAS_SET_DIRECT_MAP if MMU is enabled and hide
declarations of the related functions inside '#ifdef CONFIG_MMU' so that
generic stubs would be used for nommu case.

Signed-off-by: Mike Rapoport <rppt at linux.ibm.com>
---
 arch/riscv/Kconfig                  | 2 +-
 arch/riscv/include/asm/set_memory.h | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index af5b858ed8a1..31ff944f092e 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -25,7 +25,7 @@ config RISCV
 	select ARCH_HAS_KCOV
 	select ARCH_HAS_MMIOWB
 	select ARCH_HAS_PTE_SPECIAL
-	select ARCH_HAS_SET_DIRECT_MAP
+	select ARCH_HAS_SET_DIRECT_MAP if MMU
 	select ARCH_HAS_SET_MEMORY
 	select ARCH_HAS_STRICT_KERNEL_RWX if MMU
 	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
diff --git a/arch/riscv/include/asm/set_memory.h b/arch/riscv/include/asm/set_memory.h
index 1aaf2720b8f6..fc37eb03833b 100644
--- a/arch/riscv/include/asm/set_memory.h
+++ b/arch/riscv/include/asm/set_memory.h
@@ -17,6 +17,9 @@ int set_memory_x(unsigned long addr, int numpages);
 int set_memory_nx(unsigned long addr, int numpages);
 int set_memory_rw_nx(unsigned long addr, int numpages);
 void protect_kernel_text_data(void);
+int set_direct_map_invalid_noflush(struct page *page, int numpages);
+int set_direct_map_default_noflush(struct page *page, int numpages);
+bool kernel_page_present(struct page *page);
 #else
 static inline int set_memory_ro(unsigned long addr, int numpages) { return 0; }
 static inline int set_memory_rw(unsigned long addr, int numpages) { return 0; }
@@ -26,10 +29,6 @@ static inline void protect_kernel_text_data(void) {};
 static inline int set_memory_rw_nx(unsigned long addr, int numpages) { return 0; }
 #endif
 
-int set_direct_map_invalid_noflush(struct page *page, int numpages);
-int set_direct_map_default_noflush(struct page *page, int numpages);
-bool kernel_page_present(struct page *page);
-
 #endif /* __ASSEMBLY__ */
 
 #ifdef CONFIG_ARCH_HAS_STRICT_KERNEL_RWX
-- 
2.28.0




More information about the linux-riscv mailing list