Created attachment 635380 [details] .config file from make menuconfig During installing of Gentoo SPARC64 (64ul/systemd) on a Sun T5120, attempting to 'make' the kernel after initial configuration fails with the following errors (.config attached): (chroot) root@livecd /usr/src/linux # make CALL scripts/checksyscalls.sh <stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp] CALL scripts/atomic/check-atomics.sh CHK include/generated/compile.h CC kernel/seccomp.o kernel/seccomp.c: In function ‘populate_seccomp_data’: kernel/seccomp.c:150:11: error: implicit declaration of function ‘syscall_get_nr’; did you mean ‘syscall_r egfunc’? [-Werror=implicit-function-declaration] 150 | sd->nr = syscall_get_nr(task, regs); | ^~~~~~~~~~~~~~ | syscall_regfunc kernel/seccomp.c:151:13: error: implicit declaration of function ‘syscall_get_arch’ [-Werror=implicit-func tion-declaration] 151 | sd->arch = syscall_get_arch(task); | ^~~~~~~~~~~~~~~~ kernel/seccomp.c:152:2: error: implicit declaration of function ‘syscall_get_arguments’ [-Werror=implicit- function-declaration] 152 | syscall_get_arguments(task, regs, args); | ^~~~~~~~~~~~~~~~~~~~~ At top level: kernel/seccomp.c:608:13: warning: ‘seccomp_send_sigsys’ defined but not used [-Wunused-function] 608 | static void seccomp_send_sigsys(int syscall, int reason) | ^~~~~~~~~~~~~~~~~~~ kernel/seccomp.c:254:12: warning: ‘seccomp_run_filters’ defined but not used [-Wunused-function] 254 | static u32 seccomp_run_filters(const struct seccomp_data *sd, | ^~~~~~~~~~~~~~~~~~~ kernel/seccomp.c:144:13: warning: ‘populate_seccomp_data’ defined but not used [-Wunused-function] 144 | static void populate_seccomp_data(struct seccomp_data *sd) | ^~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors make[1]: *** [scripts/Makefile.build:266: kernel/seccomp.o] Error 1 make: *** [Makefile:1691: kernel] Error 2
Reproducible on cross-compilation as well: $ ARCH=sparc CROSS_COMPILE=sparc64-unknown-linux-gnu- make kernel/seccomp.o """ CC kernel/seccomp.o kernel/seccomp.c: In function 'populate_seccomp_data': kernel/seccomp.c:150:11: error: implicit declaration of function 'syscall_get_nr'; did you mean 'syscall_regfunc'? [-Werror=implicit-function-declaration] 150 | sd->nr = syscall_get_nr(task, regs); | ^~~~~~~~~~~~~~ | syscall_regfunc """
syscall_get_nr() is defined in '#include <asm/syscall.h>', but kernel/seccomp.c conditionally includes it as: """ #ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER #include <asm/syscall.h> #endif """
This seems to be enough to fix this file build: $ git diff | cat --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -28,9 +28,7 @@ #include <linux/syscalls.h> #include <linux/sysctl.h> -#ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER #include <asm/syscall.h> -#endif #ifdef CONFIG_SECCOMP_FILTER #include <linux/file.h>
I can't reproduce build failure on vanilla linux-5.4 or linux-master. Probably due to gentoo-specific defaults that force-enable SECCOMP_FILTER. Note: sparc fors not have SECCOMP_FILTER support: SECCOMP_FILTER depends on HAVE_ARCH_SECCOMP_FILTER: arch/Kconfig:config HAVE_ARCH_SECCOMP_FILTER arch/Kconfig:config SECCOMP_FILTER arch/Kconfig: depends on HAVE_ARCH_SECCOMP_FILTER && SECCOMP && NET No sparc here: arch/arm/Kconfig: select HAVE_ARCH_SECCOMP_FILTER if AEABI && !OABI_COMPAT arch/arm64/Kconfig: select HAVE_ARCH_SECCOMP_FILTER arch/mips/Kconfig: select HAVE_ARCH_SECCOMP_FILTER arch/parisc/Kconfig: select HAVE_ARCH_SECCOMP_FILTER arch/powerpc/Kconfig: select HAVE_ARCH_SECCOMP_FILTER arch/s390/Kconfig: select HAVE_ARCH_SECCOMP_FILTER arch/um/Kconfig: select HAVE_ARCH_SECCOMP_FILTER arch/x86/Kconfig: select HAVE_ARCH_SECCOMP_FILTER Enabled anyway: distro/Kconfig: select SECCOMP_FILTER
And oldconfig also detects unsatisfied configuration: $ ARCH=sparc CROSS_COMPILE=sparc64-unknown-linux-gnu- make oldconfig scripts/kconfig/conf --oldconfig Kconfig WARNING: unmet direct dependencies detected for SECCOMP_FILTER Depends on [n]: HAVE_ARCH_SECCOMP_FILTER [=n] && SECCOMP [=y] && NET [=y] Selected by [y]: - GENTOO_LINUX_INIT_SYSTEMD [=y] && GENTOO_LINUX [=y] && GENTOO_LINUX_UDEV [=y] WARNING: unmet direct dependencies detected for SECCOMP_FILTER Depends on [n]: HAVE_ARCH_SECCOMP_FILTER [=n] && SECCOMP [=y] && NET [=y] Selected by [y]: - GENTOO_LINUX_INIT_SYSTEMD [=y] && GENTOO_LINUX [=y] && GENTOO_LINUX_UDEV [=y]
Confirming the patch works. Thanks for your help with this! Seems to be working now.
Created attachment 635522 [details, diff] Don't select SECCOMP_FILTER if SPARC So it looks like the gentoo specific patch needs: select SECCOMP_FILTER if !SPARC Can you try this, please?