Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 720164 - sys-kernel/gentoo-sources-5.4.28: Kernel Make Failure - seccomp and syscall Errors
Summary: sys-kernel/gentoo-sources-5.4.28: Kernel Make Failure - seccomp and syscall E...
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: Sparc64 Linux
: Normal blocker
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-30 19:00 UTC by Randal Rioux
Modified: 2020-05-20 22:37 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
.config file from make menuconfig (.config,66.41 KB, text/plain)
2020-04-30 19:00 UTC, Randal Rioux
Details
Don't select SECCOMP_FILTER if SPARC (4567_distro-Gentoo-Kconfig.patch,4.65 KB, patch)
2020-05-01 16:59 UTC, Mike Pagano
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Randal Rioux 2020-04-30 19:00:29 UTC
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
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2020-04-30 21:48:15 UTC
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
"""
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2020-04-30 21:51:58 UTC
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
"""
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2020-04-30 21:54:19 UTC
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>
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2020-04-30 22:19:13 UTC
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
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2020-04-30 22:21:58 UTC
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]
Comment 6 Randal Rioux 2020-05-01 05:39:17 UTC
Confirming the patch works. Thanks for your help with this! Seems to be working now.
Comment 7 Mike Pagano gentoo-dev 2020-05-01 16:59:55 UTC
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?