Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#4195 - procd does not generate parse syscall list on ARM/GLIBC #9175

Closed
openwrt-bot opened this issue Dec 19, 2021 · 1 comment
Closed
Labels

Comments

@openwrt-bot
Copy link

ak:

Compiling master with GLIBC on arm fails in procd trying to compile the list of syscall names (see below) when SECCOMP is enabled. The list of syscall names is generated in procd by the make_syscall_h.sh script using the following sed expression:

sed -r -n -e 's/^#define[ \t]+NR([a-z0-9]+)[ \t]+([ ()+0-9a-zNR_Linux]+)(.*)/ [\2] = "\1",/p'

However, the list of syscalls generated in the arm kernel takes the following form:

user_headers/include/asm/unistd-common.h:#define __NR_exit (__NR_SYSCALL_BASE + 1)

which does not match the sed expression, as it does not accept all capital letters. The resulting lines become:

[(_NR] = "waitid",

I am not very familiar with the context, but SECCOMP is a new option which is enabled by default, as per https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=b118efa0d25f5b60226a9d316eb838dd6be22f78. Previously, in my builds at least, procd was not compiled with seccomp and no syscall list was generated. I could not find any suspicious recent changes and can't see a way how the sed script could work, unless I'm missing something obvious. I am also not sure what "NR_Linux" is supposed to do in the sed pattern.

Please note that this is a glibc build.

My configuration is almost the default one, with the following added:

CONFIG_TARGET_sunxi=y
CONFIG_TARGET_sunxi_cortexa7=y
CONFIG_TARGET_sunxi_cortexa7_Default=y
CONFIG_LIBC_USE_GLIBC=y

The compilation errors look like this:

/home/openwrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-8.4.0_glibc_eabi/bin/arm-openwrt-linux-gnueabi-gcc -DEARLY_PATH="/usr/sbin:/usr/bin:/sbin:/bin" -DSECCOMP_SUPPORT -Dpreload_seccomp_EXPORTS -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -fmacro-prefix-map=/home/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_glibc_eabi/procd-default/procd-2021-11-23-01ac2c45=procd-2021-11-23-01ac2c45 -Wformat -Werror=format-security -DPIC -fpic -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -flto -DNDEBUG -fPIC -Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations -MD -MT CMakeFiles/preload-seccomp.dir/jail/seccomp-oci.c.o -MF CMakeFiles/preload-seccomp.dir/jail/seccomp-oci.c.o.d -o CMakeFiles/preload-seccomp.dir/jail/seccomp-oci.c.o -c /home/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_glibc_eabi/procd-default/procd-2021-11-23-01ac2c45/jail/seccomp-oci.c
In file included from /home/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_glibc_eabi/procd-default/procd-2021-11-23-01ac2c45/jail/seccomp-oci.c:36:
/home/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_glibc_eabi/procd-default/procd-2021-11-23-01ac2c45/jail/../syscall-names.h:3:4: error: '_NR' undeclared here (not in a function)
[(_NR] = "waitid",
^~~~~
/m/vm/a-dev/openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_glibc_eabi/procd-default/procd-2021-11-23-01ac2c45/jail/../syscall-names.h:3:9: error: expected ')' before ']' token
[(_NR] = "waitid",
~ ^
)

@ynezz
Copy link
Member

ynezz commented Mar 7, 2022

Duplicate of #9174

@ynezz ynezz marked this as a duplicate of #9174 Mar 7, 2022
@ynezz ynezz closed this as completed Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants