google / syzkaller

syzkaller is an unsupervised coverage-guided kernel fuzzer
Apache License 2.0
5.23k stars 1.2k forks source link

executor: fails to compile on CentOS7 #4820

Open F0burny opened 2 months ago

F0burny commented 2 months ago

NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CentOS Linux release 7.9.2009 (Core)

Current Kernel Version Info: Linux localhost.localdomain 3.10.0-1160.118.1.el7.x86_64 #1 SMP Wed Apr 24 16:01:50 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

GCC Version Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux Thread model: posix gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)

LibC version: GNU C Library (GNU libc) stable release version 2.17, by Roland McGrath et al. Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 4.8.5 20150623 (Red Hat 4.8.5-44). Compiled on a Linux 3.10.0 system on 2022-05-18. Available extensions: The C stubs add-on version 2.1.2. crypt add-on version 2.1 by Michael Glad and others GNU Libidn by Simon Josefsson Native POSIX Threads Library by Ulrich Drepper et al BIND-8.2.3-T5B RT using linux kernel aio libc ABIs: UNIQUE IFUNC

followed directions on generic linux kernel to make the syzkaller program and compilation errors at trying to compile the executor with the following errors:

gcc -o ./bin/linux_amd64/syz-executor executor/executor.cc \ -m64 -std=c++11 -I. -Iexecutor/_include -O2 -pthread -Wall -Werror -Wparentheses -Wframe-larger-than=16384 -Wno-stringop-overflow -Wno-array-bounds -Wno-format-overflow -Wno-unused-but-set-variable -Wno-unused-command-line-argument -DGOOS_linux=1 -DGOARCH_amd64=1 \ -DHOSTGOOS_linux=1 -DGIT_REVISION=\"c2e0726105cc811a456d900c62443159acc29c32\" In file included from executor/common.h:489:0, from executor/executor.cc:195: executor/common_linux.h: In function ‘void netlink_add_hsr(nlmsg, int, const char, const char, const char)’: executor/common_linux.h:438:22: error: ‘IFLA_HSR_SLAVE1’ was not declared in this scope netlink_attr(nlmsg, IFLA_HSR_SLAVE1, &ifindex1, sizeof(ifindex1)); ^ executor/common_linux.h:440:22: error: ‘IFLA_HSR_SLAVE2’ was not declared in this scope netlink_attr(nlmsg, IFLA_HSR_SLAVE2, &ifindex2, sizeof(ifindex2)); ^ In file included from executor/common.h:489:0, from executor/executor.cc:195: executor/common_linux.h: In function ‘void netlink_add_ipvlan(nlmsg, int, const char, const char*, uint16, uint16)’: executor/common_linux.h:519:22: error: ‘IFLA_IPVLAN_MODE’ was not declared in this scope netlink_attr(nlmsg, IFLA_IPVLAN_MODE, &mode, sizeof(mode)); ^ In file included from executor/common.h:489:0, from executor/executor.cc:195: executor/common_linux.h: In function ‘void initialize_netdevices()’: executor/common_linux.h:1642:60: error: ‘IPVLAN_MODE_L2’ was not declared in this scope netlink_add_ipvlan(&nlmsg, sock, "ipvlan0", "veth0_vlan", IPVLAN_MODE_L2, 0); ^ At global scope: cc1plus: error: unrecognized command line option "-Wno-unused-command-line-argument" [-Werror] cc1plus: error: unrecognized command line option "-Wno-format-overflow" [-Werror] cc1plus: error: unrecognized command line option "-Wno-stringop-overflow" [-Werror] cc1plus: all warnings being treated as errors

F0burny commented 2 months ago

tried again with gcc-version: gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)

with the following error: gcc -o ./bin/linux_amd64/syz-executor executor/executor.cc \ -m64 -std=c++11 -I. -Iexecutor/_include -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-stringop-overflow -Wno-array-bounds -Wno-format-overflow -Wno-unused-but-set-variable -Wno-unused-command-line-argument -DGOOS_linux=1 -DGOARCH_amd64=1 \ -DHOSTGOOS_linux=1 -DGIT_REVISION=\"c2e0726105cc811a456d900c62443159acc29c32\" In file included from executor/common.h:489, from executor/executor.cc:195: executor/common_linux.h: In function ‘void netlink_add_hsr(nlmsg, int, const char, const char, const char)’: executor/common_linux.h:438:22: error: ‘IFLA_HSR_SLAVE1’ was not declared in this scope 438 | netlink_attr(nlmsg, IFLA_HSR_SLAVE1, &ifindex1, sizeof(ifindex1)); | ^~~~~~~ executor/common_linux.h:440:22: error: ‘IFLA_HSR_SLAVE2’ was not declared in this scope 440 | netlink_attr(nlmsg, IFLA_HSR_SLAVE2, &ifindex2, sizeof(ifindex2)); | ^~~~~~~ In file included from executor/common.h:489, from executor/executor.cc:195: executor/common_linux.h: In function ‘void netlink_add_ipvlan(nlmsg, int, const char, const char*, uint16, uint16)’: executor/common_linux.h:519:22: error: ‘IFLA_IPVLAN_MODE’ was not declared in this scope; did you mean ‘IFLA_MACVLAN_MODE’? 519 | netlink_attr(nlmsg, IFLA_IPVLAN_MODE, &mode, sizeof(mode)); | ^~~~ | IFLA_MACVLAN_MODE In file included from executor/common.h:489, from executor/executor.cc:195: executor/common_linux.h: In function ‘void initialize_netdevices()’: executor/common_linux.h:1642:60: error: ‘IPVLAN_MODE_L2’ was not declared in this scope; did you mean ‘IPVLAN_MODE_L3S’? 1642 | netlink_add_ipvlan(&nlmsg, sock, "ipvlan0", "veth0_vlan", IPVLAN_MODE_L2, 0); | ^~~~~~ | IPVLAN_MODE_L3S At global scope: cc1plus: error: unrecognized command line option ‘-Wno-unused-command-line-argument’ [-Werror] cc1plus: all warnings being treated as errors make: *** [Makefile:136: executor] Error 1

dvyukov commented 2 months ago

Hi,

Is there an easy fix for this? It looks like the OS provides very old system headers. Since it's not possible to write linux code that compiled on a random OS, we provide syz-env container for building. If there is no easy fix, I would say the solution is to use syz-env (or a newer OS, IFLA_HSR_SLAVE1 was added >10 years ago).