Description of problem: 在anolis23 x86 ECS环境下,kernel-selftest niglyly测试中,memfd目录编译失败 Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 下载当前内核对应的kernel源码包 rpm -ivh xxx.src.rpm 默认安装到/root下 yum-builddep -y rpmbuild/SPECS/kernel.spec 自动安装前置依赖包,需要yum-utils rpmbuild -bp ./rpmbuild/SPECS/kernel.spec # 这个步骤会打相关的patch, 解压缩tar包,生成BUILD目录 cd rpmbuild/BUILD/kernel-xxx/linux-xxx/ cd /tools/testing/selftests/memfd make Actual results: 5/tools/testing/selftests/membarrier/membarrier_test_single_thread gcc -g -I../../../../usr/include/ membarrier_test_multi_thread.c -lpthread -o /tmp/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/membarrier/membarrier_test_multi_thread make[1]: Leaving directory '/tmp/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/membarrier' make[1]: Entering directory '/tmp/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memfd' gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/ -I../../../../include/ -I../../../../usr/include/ memfd_test.c common.c -o /tmp/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memfd/memfd_test memfd_test.c: In function ‘mfd_assert_reopen_fd’: memfd_test.c:64:14: warning: implicit declaration of function ‘open’; did you mean ‘popen’? [-Wimplicit-function-declaration] 64 | fd = open(path, O_RDWR); | ^~~~ | popen memfd_test.c: In function ‘mfd_assert_get_seals’: memfd_test.c:90:13: warning: implicit declaration of function ‘fcntl’ [-Wimplicit-function-declaration] 90 | r = fcntl(fd, F_GET_SEALS); | ^~~~~ memfd_test.c: In function ‘mfd_assert_write’: memfd_test.c:397:13: warning: implicit declaration of function ‘fallocate’; did you mean ‘alloca’? [-Wimplicit-function-declaration] gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/ -I../../../../include/ -I../../../../usr/include/ fuse_test.c common.c -o /tmp/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memfd/fuse_test 397 | r = fallocate(fd, | ^~~~~~~~~ | alloca fuse_test.c: In function ‘mfd_assert_get_seals’: fuse_test.c:67:13: warning: implicit declaration of function ‘fcntl’ [-Wimplicit-function-declaration] 67 | r = fcntl(fd, F_GET_SEALS); | ^~~~~ fuse_test.c: In function ‘main’: fuse_test.c:261:14: warning: implicit declaration of function ‘open’; did you mean ‘popen’? [-Wimplicit-function-declaration] gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/ -I../../../../include/ -I../../../../usr/include/ fuse_mnt.c -lfuse -pthread -o /tmp/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memfd/fuse_mnt 261 | fd = open(argv[1], O_RDONLY | O_CLOEXEC); | ^~~~ | popen fuse_mnt.c:17:10: fatal error: fuse.h: No such file or directory 17 | #include | ^~~~~~~~ compilation terminated. make[1]: *** [../lib.mk:145: /tmp/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memfd/fuse_mnt] Error 1 make[1]: Leaving directory '/tmp/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memfd' make[1]: Entering directory '/tmp/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memory-hotplug' make[1]: Nothing to be done for 'all'. make[1]: Leaving directory '/tmp/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memory-hotplug' make[1]: Entering directory '/tmp/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/mincore' gcc -Wall mincore_selftest.c -o /tmp/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/mincore/mincore_selftest make[1]: Leaving directory '/tmp/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/mincore' Expected results: 编译通过 Additional info: [root@qibo-anolis23-nightly-func-x86-1 ~]# uname -r 5.10.134-8.git.23b31a882ca6.an23.x86_64 [root@qibo-anolis23-nightly-func-x86-1 ~]# cat /etc/anolis-release cat: ''$'\343\343\343': No such file or directory Anolis OS release 23 [root@qibo-anolis23-nightly-func-x86-1 ~]# cat /proc/cmdline BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-5.10.134-8.git.23b31a882ca6.an23.x86_64 root=UUID=ece72b7f-465b-433d-8b3b-e5fa53a04642 ro rhgb cryptomgr.notests rcupdate.rcu_cpu_stall_timeout=300 quiet biosdevname=0 net.ifnames=0 console=tty0 console=ttyS0,115200n8 noibrs nvme_core.io_timeout=4294967295 nvme_core.admin_timeout=4294967295 cgroup.memory=nokmem crashkernel=0M-2G:0M,2G-8G:192M,8G-:256M [root@qibo-anolis23-nightly-func-x86-1 ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 4.0M 0 4.0M 0% /dev tmpfs 7.6G 0 7.6G 0% /dev/shm tmpfs 3.1G 600K 3.1G 1% /run /dev/vda1 40G 18G 23G 45% / tmpfs 7.6G 236M 7.4G 4% /tmp tmpfs 1.6G 0 1.6G 0% /run/user/0 [root@qibo-anolis23-nightly-func-x86-1 ~]# free -g total used free shared buff/cache available Mem: 15 0 13 0 0 13 Swap: 0 0 0 [root@qibo-anolis23-nightly-func-x86-1 ~]# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 46 bits physical, 57 bits virtual Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Vendor ID: GenuineIntel BIOS Vendor ID: Alibaba Cloud Model name: Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz BIOS Model name: pc-i440fx-2.1 CPU @ 0.0GHz BIOS CPU family: 1 CPU family: 6 Model: 106 Thread(s) per core: 2 Core(s) per socket: 2 Socket(s): 1 Stepping: 6 BogoMIPS: 5399.99 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss h t syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid tsc_known_freq pni pclmulq dq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves wbnoinvd arat avx512vbmi pku ospke avx512_vbmi2 gfni vaes vpc lmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid fsrm arch_capabilities Virtualization features: Hypervisor vendor: KVM Virtualization type: full Caches (sum of all): L1d: 96 KiB (2 instances) L1i: 64 KiB (2 instances) L2: 2.5 MiB (2 instances) L3: 48 MiB (1 instance) NUMA: NUMA node(s): 1 NUMA node0 CPU(s): 0-3 Vulnerabilities: Itlb multihit: Not affected L1tf: Not affected Mds: Not affected Meltdown: Not affected Mmio stale data: Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown Retbleed: Not affected Spec store bypass: Vulnerable Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Spectre v2: Mitigation; Enhanced IBRS, RSB filling, PBRSB-eIBRS SW sequence Srbds: Not affected Tsx async abort: Not affected [root@qibo-anolis23-nightly-func-x86-1 ~]# [root@qibo-anolis23-nightly-func-x86-1 ~]# cat /etc/anolis-release Anolis OS release 23
Anolis23-5.10-arm ECS环境下,kernel-selftest niglyly测试中,memfd目录也存在编译失败问题 make[1]: Leaving directory '/opt/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/membarrier' make[1]: Entering directory '/opt/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memfd' gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/ -I../../../../include/ -I../../../../usr/include/ memfd_test.c common.c -o /opt/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memfd/memfd_test from /usr/include/bits/libc-header-start.h:33, from /usr/include/stdio.h:27, from steal_time.c:8: /usr/include/pthread.h:479:12: note: declared here 479 | extern int __REDIRECT_NTH (pthread_yield, (void), sched_yield) | ^~~~~~~~~~~~~~ memfd_test.c: In function ‘mfd_assert_reopen_fd’: memfd_test.c:64:14: warning: implicit declaration of function ‘open’; did you mean ‘popen’? [-Wimplicit-function-declaration] 64 | fd = open(path, O_RDWR); | ^~~~ | popen memfd_test.c: In function ‘mfd_assert_get_seals’: memfd_test.c:90:13: warning: implicit declaration of function ‘fcntl’ [-Wimplicit-function-declaration] 90 | r = fcntl(fd, F_GET_SEALS); | ^~~~~ memfd_test.c: In function ‘mfd_assert_write’: memfd_test.c:397:13: warning: implicit declaration of function ‘fallocate’; did you mean ‘alloca’? [-Wimplicit-function-declaration] gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/ -I../../../../include/ -I../../../../usr/include/ fuse_test.c common.c -o /opt/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memfd/fuse_test 397 | r = fallocate(fd, | ^~~~~~~~~ | alloca fuse_test.c: In function ‘mfd_assert_get_seals’: fuse_test.c:67:13: warning: implicit declaration of function ‘fcntl’ [-Wimplicit-function-declaration] 67 | r = fcntl(fd, F_GET_SEALS); | ^~~~~ fuse_test.c: In function ‘main’: fuse_test.c:261:14: warning: implicit declaration of function ‘open’; did you mean ‘popen’? [-Wimplicit-function-declaration] gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/ -I../../../../include/ -I../../../../usr/include/ fuse_mnt.c -lfuse -pthread -o /opt/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memfd/fuse_mnt 261 | fd = open(argv[1], O_RDONLY | O_CLOEXEC); | ^~~~ | popen fuse_mnt.c:17:10: fatal error: fuse.h: No such file or directory 17 | #include <fuse.h> | ^~~~~~~~ compilation terminated. make[1]: *** [../lib.mk:145: /opt/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memfd/fuse_mnt] Error 1 make[1]: Leaving directory '/opt/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memfd' make[1]: Entering directory '/opt/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memory-hotplug' make[1]: Nothing to be done for 'all'. make[1]: Leaving directory '/opt/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/memory-hotplug' make[1]: Entering directory '/opt/tone/cache/kernel-selftests/kernel-5/tools/testing/selftests/mincore' 内核信息: [root@qibo-anck014-an23-g6r-1 ~]# uname -r 5.10.134-14_rc1.an23.aarch64 操作系统信息: [root@qibo-anck014-an23-g6r-1 ~]# cat /etc/os-release NAME="Anolis OS" VERSION="23" ID="anolis" VERSION_ID="23" PLATFORM_ID="platform:an23" PRETTY_NAME="Anolis OS 23" ANSI_COLOR="0;31" HOME_URL="https://openanolis.cn/" BUG_REPORT_URL="https://bugzilla.openanolis.cn/"
使用-v 参数看详细编译信息如下: [root@iZbp11mcx562amm7xlb42eZ memfd]# gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/ -I../../../../include/ -I../../../../usr/include/ fuse_mnt.c -lfuse -pthread -o ./fuse_mnt -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-anolis-linux/12/lto-wrapper Target: aarch64-anolis-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.openanolis.cn --enable-shared --enable-threads=posix --enable-checking=release --disable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --without-isl --enable-gnu-indirect-function --build=aarch64-anolis-linux --with-build-config=bootstrap-lto --enable-link-serialization=1 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.2.1 20221121 (Anolis OS 12.2.1-1) (GCC) COLLECT_GCC_OPTIONS='-D' '_FILE_OFFSET_BITS=64' '-I' '../../../../include/uapi/' '-I' '../../../../include/' '-I' '../../../../usr/include/' '-pthread' '-o' './fuse_mnt' '-v' '-mlittle-endian' '-mabi=lp64' '-dumpdir' './' /usr/libexec/gcc/aarch64-anolis-linux/12/cc1 -quiet -v -I ../../../../include/uapi/ -I ../../../../include/ -I ../../../../usr/include/ -D_REENTRANT -D _FILE_OFFSET_BITS=64 fuse_mnt.c -quiet -dumpdir ./ -dumpbase fuse_mnt.c -dumpbase-ext .c -mlittle-endian -mabi=lp64 -version -o /tmp/cc6PY1t4.s GNU C17 (GCC) version 12.2.1 20221121 (Anolis OS 12.2.1-1) (aarch64-anolis-linux) compiled by GNU C version 12.2.1 20221121 (Anolis OS 12.2.1-1), GMP version 6.2.1, MPFR version 4.1.1, MPC version 1.3.1, isl version none warning: MPFR header version 4.1.1 differs from library version 4.2.0. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/usr/lib/gcc/aarch64-anolis-linux/12/include-fixed" ignoring nonexistent directory "/usr/lib/gcc/aarch64-anolis-linux/12/../../../../aarch64-anolis-linux/include" #include "..." search starts here: #include <...> search starts here: ../../../../include/uapi/ ../../../../include/ ../../../../usr/include/ /usr/lib/gcc/aarch64-anolis-linux/12/include /usr/local/include /usr/include End of search list. GNU C17 (GCC) version 12.2.1 20221121 (Anolis OS 12.2.1-1) (aarch64-anolis-linux) compiled by GNU C version 12.2.1 20221121 (Anolis OS 12.2.1-1), GMP version 6.2.1, MPFR version 4.1.1, MPC version 1.3.1, isl version none warning: MPFR header version 4.1.1 differs from library version 4.2.0. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 560bdabda7f95d093b8c5ac9885fc56f fuse_mnt.c:17:10: fatal error: fuse.h: No such file or directory 17 | #include <fuse.h> | ^~~~~~~~ compilation terminated. 这里主要是找不到对应的fuse.h,这里最后用的是/usr/include 的目录。 对比an8,an8提供的fuse-devel 包能提供正确的路径。因此可以编译OK。 [root@qibo-anolis8-nightly-func-arm-4 memfd]# yum provides /usr/include/fuse.h Failed to set locale, defaulting to C.UTF-8 Last metadata expiration check: 1:20:43 ago on Tue Mar 14 14:46:19 2023. fuse-devel-2.9.7-15.an8.aarch64 : File System in Userspace (FUSE) v2 devel files Repo : @System Matched from: Filename : /usr/include/fuse.h fuse-devel-2.9.7-15.an8.aarch64 : File System in Userspace (FUSE) v2 devel files Repo : BaseOS Matched from: Filename : /usr/include/fuse.h [root@qibo-anolis8-nightly-func-arm-4 memfd]# rpm -ql fuse-devel /usr/include/fuse /usr/include/fuse.h /usr/include/fuse/cuse_lowlevel.h /usr/include/fuse/fuse.h /usr/include/fuse/fuse_common.h /usr/include/fuse/fuse_common_compat.h /usr/include/fuse/fuse_compat.h /usr/include/fuse/fuse_lowlevel.h /usr/include/fuse/fuse_lowlevel_compat.h /usr/include/fuse/fuse_opt.h /usr/include/ulockmgr.h /usr/lib64/libfuse.so /usr/lib64/libulockmgr.so /usr/lib64/pkgconfig/fuse.pc [root@qibo-anolis8-nightly-func-arm-4 memfd]# an23 的包如下: [root@iZbp11mcx562amm7xlb42eZ memfd]# rpm -ql fuse-devel /usr/include/fuse3 /usr/include/fuse3/cuse_lowlevel.h /usr/include/fuse3/fuse.h /usr/include/fuse3/fuse_common.h /usr/include/fuse3/fuse_log.h /usr/include/fuse3/fuse_lowlevel.h /usr/include/fuse3/fuse_opt.h /usr/include/fuse3/libfuse_config.h /usr/lib64/libfuse3.so /usr/lib64/pkgconfig/fuse3.pc chunmei帮忙看一下是不是要改一下fuse-devel包的结构?否则,就适配一下kernel-selftest在23 上的inlude 路径
a23上面默认是fuse3,没有特殊情况不提供fuse2. 适配下用例看下。 -lfuse3试试
Anolis OS 23已经提供了fuse2,在编译环境上安装fuse2-devel试试。
在anolis23 x86 ECS环境下安装fuse2-devel后,kernel-selftests的memfd可以正常编译,问题解决 验证结果过程如下: ------------------ [root@qibo-anolis23-nightly-func-x86-1 BUILD]# cd kernel-5.10.134-61.git.3c4c5575a42e.an23/linux-5.10.134-61.git.3c4c5575a42e.a n23.x86_64/ [root@qibo-anolis23-nightly-func-x86-1 linux-5.10.134-61.git.3c4c5575a42e.an23.x86_64]# cd tools/testing/selftests/ [root@qibo-anolis23-nightly-func-x86-1 selftests]# cd memfd [root@qibo-anolis23-nightly-func-x86-1 memfd]# make gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/ -I../../../../include/ -I../../../../usr/include/ memfd_test.c common .c -o /root/rpmbuild/BUILD/kernel-5.10.134-61.git.3c4c5575a42e.an23/linux-5.10.134-61.git.3c4c5575a42e.an23.x86_64/tools/testi ng/selftests/memfd/memfd_test memfd_test.c: In function 'mfd_assert_reopen_fd': memfd_test.c:64:14: warning: implicit declaration of function 'open'; did you mean 'popen'? [-Wimplicit-function-declaration] 64 | fd = open(path, O_RDWR); | ^~~~ | popen memfd_test.c: In function 'mfd_assert_get_seals': memfd_test.c:90:13: warning: implicit declaration of function 'fcntl' [-Wimplicit-function-declaration] 90 | r = fcntl(fd, F_GET_SEALS); | ^~~~~ memfd_test.c: In function 'mfd_assert_write': memfd_test.c:397:13: warning: implicit declaration of function 'fallocate'; did you mean 'alloca'? [-Wimplicit-function-declara tion] 397 | r = fallocate(fd, | ^~~~~~~~~ | alloca gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/ -I../../../../include/ -I../../../../usr/include/ fuse_test.c common. c -o /root/rpmbuild/BUILD/kernel-5.10.134-61.git.3c4c5575a42e.an23/linux-5.10.134-61.git.3c4c5575a42e.an23.x86_64/tools/testin g/selftests/memfd/fuse_test fuse_test.c: In function 'mfd_assert_get_seals': fuse_test.c:67:13: warning: implicit declaration of function 'fcntl' [-Wimplicit-function-declaration] 67 | r = fcntl(fd, F_GET_SEALS); | ^~~~~ fuse_test.c: In function 'main': fuse_test.c:261:14: warning: implicit declaration of function 'open'; did you mean 'popen'? [-Wimplicit-function-declaration] 261 | fd = open(argv[1], O_RDONLY | O_CLOEXEC); | ^~~~ | popen gcc -D_FILE_OFFSET_BITS=64 -I../../../../include/uapi/ -I../../../../include/ -I../../../../usr/include/ fuse_mnt.c -lfuse - pthread -o /root/rpmbuild/BUILD/kernel-5.10.134-61.git.3c4c5575a42e.an23/linux-5.10.134-61.git.3c4c5575a42e.an23.x86_64/tools/ testing/selftests/memfd/fuse_mnt [root@qibo-anolis23-nightly-func-x86-1 memfd]# echo $? 0 [root@qibo-anolis23-nightly-func-x86-1 memfd]# rpm -q fuse2-devel fuse2-devel-2.9.9-1.an23.x86_64 [root@qibo-anolis23-nightly-func-x86-1 memfd]#
问题解决,可以关闭该单!