Description of problem: kernel-selftests测试套hid/hid_bpf编译失败, 编译日志如下: make[1]: Entering directory '/var/tmp/tone/cache/kernel-selftests/kernel-6/tools/testing/selftests/hid' CLNG-BPF hid.bpf.o In file included from progs/hid.c:6: progs/hid_bpf_helpers.h:9:38: error: declaration of 'struct hid_bpf_ctx' will not be visible outside of this function [-Werror,-Wvisibility] 9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx, | ^ progs/hid.c:23:35: error: incompatible pointer types passing 'struct hid_bpf_ctx *' to parameter of type 'struct hid_bpf_ctx *' [-Werror,-Wincompatible-pointer-types] 23 | __u8 *rw_data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 3 /* size */); | ^~~~~~~ progs/hid_bpf_helpers.h:9:51: note: passing argument to parameter 'ctx' here 9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx, | ^ progs/hid.c:32:16: error: incomplete definition of type 'struct hid_bpf_ctx' 32 | return hid_ctx->size; | ~~~~~~~^ progs/hid_bpf_helpers.h:13:15: note: forward declaration of 'struct hid_bpf_ctx' 13 | extern struct hid_bpf_ctx *hid_bpf_allocate_context(unsigned int hid_id) __ksym; | ^ progs/hid.c:38:35: error: incompatible pointer types passing 'struct hid_bpf_ctx *' to parameter of type 'struct hid_bpf_ctx *' [-Werror,-Wincompatible-pointer-types] 38 | __u8 *rw_data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4 /* size */); progs/hid_bpf_helpers.h:9:51: note: passing argument to parameter 'ctx' here 9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx, | ^ progs/hid.c:45:16: error: incomplete definition of type 'struct hid_bpf_ctx' 45 | return hid_ctx->size; | ~~~~~~~^ progs/hid_bpf_helpers.h:13:15: note: forward declaration of 'struct hid_bpf_ctx' 13 | extern struct hid_bpf_ctx *hid_bpf_allocate_context(unsigned int hid_id) __ksym; | ^ progs/hid.c:51:35: error: incompatible pointer types passing 'struct hid_bpf_ctx *' to parameter of type 'struct hid_bpf_ctx *' [-Werror,-Wincompatible-pointer-types] 51 | __u8 *rw_data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 3 /* size */); | ^~~~~~~ progs/hid_bpf_helpers.h:9:51: note: passing argument to parameter 'ctx' here 9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx, | ^ progs/hid.c:66:27: error: use of undeclared identifier 'HID_BPF_FLAG_INSERT_HEAD' 66 | ctx->insert_head ? HID_BPF_FLAG_INSERT_HEAD : | ^ progs/hid.c:67:13: error: use of undeclared identifier 'HID_BPF_FLAG_NONE' 67 | HID_BPF_FLAG_NONE); | ^ progs/hid.c:144:32: error: incompatible pointer types passing 'struct hid_bpf_ctx *' to parameter of type 'struct hid_bpf_ctx *' [-Werror,-Wincompatible-pointer-types] 144 | __u8 *data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4096 /* size */); | ^~~~~~~ progs/hid_bpf_helpers.h:9:51: note: passing argument to parameter 'ctx' here 9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx, | ^ progs/hid.c:163:32: error: incompatible pointer types passing 'struct hid_bpf_ctx *' to parameter of type 'struct hid_bpf_ctx *' [-Werror,-Wincompatible-pointer-types] 163 | __u8 *data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4 /* size */); | ^~~~~~~ progs/hid_bpf_helpers.h:9:51: note: passing argument to parameter 'ctx' here 9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx, progs/hid.c:180:32: error: incompatible pointer types passing 'struct hid_bpf_ctx *' to parameter of type 'struct hid_bpf_ctx *' [-Werror,-Wincompatible-pointer-types] 180 | __u8 *data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4 /* size */); | ^~~~~~~ progs/hid_bpf_helpers.h:9:51: note: passing argument to parameter 'ctx' here 9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx, | ^ progs/hid.c:197:32: error: incompatible pointer types passing 'struct hid_bpf_ctx *' to parameter of type 'struct hid_bpf_ctx *' [-Werror,-Wincompatible-pointer-types] 197 | __u8 *data = hid_bpf_get_data(hid_ctx, 0 /* offset */, 4 /* size */); | ^~~~~~~ progs/hid_bpf_helpers.h:9:51: note: passing argument to parameter 'ctx' here 9 | extern __u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx, | ^ 12 errors generated. make[1]: *** [Makefile:230: /var/tmp/tone/cache/kernel-selftests/kernel-6/tools/testing/selftests/hid/hid.bpf.o] Error 1 make[1]: Leaving directory '/var/tmp/tone/cache/kernel-selftests/kernel-6/tools/testing/selftests/hid' How reproducible: 必现 Steps to Reproduce: wget 内核对应src.rpm包 rpm -ivh xxx.src.rpm 默认安装到/root下 yum install yum-utils yum-builddep -y /root/rpmbuild/SPECS/kernel.spec 自动安装前置依赖包 需要yum-utils rpmbuild -bp /root/rpmbuild/SPECS/kernel.spec # 这个步骤会打相关的patch, 解压缩tar包,生成BUILD目录 cd /root/rpmbuild/BUILD/kernel-*/linux-* make -C tools/testing/selftests/ cd /root/rpmbuild/BUILD/kernel-*/linux-*/tools/testing/selftests/hid/; make Actual results: 编译失败,用例无法执行 Expected results: 编译正常,用例可以正常执行 Additional info: [环境信息] ECS # uname -r 6.6.88-cbp.git.1432012a7.an23.aarch64 # free -h total used free shared buff/cache available Mem: 15Gi 884Mi 8.2Gi 7.2Mi 6.2Gi 14Gi Swap: 0B 0B 0B # lscpu Architecture: aarch64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 48 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Vendor ID: ARM BIOS Vendor ID: Alibaba Cloud Model name: Neoverse-N1 BIOS Model name: virt-rhel7.6.0 CPU @ 2.0GHz BIOS CPU family: 1 Model: 1 Thread(s) per core: 1 Core(s) per cluster: 4 Socket(s): 1 Cluster(s): 1 Stepping: r3p1 BogoMIPS: 50.00 Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp NUMA: NUMA node(s): 1 NUMA node0 CPU(s): 0-3 Vulnerabilities: Gather data sampling: Not affected Itlb multihit: Not affected L1tf: Not affected Mds: Not affected Meltdown: Not affected Mmio stale data: Not affected Reg file data sampling: Not affected Retbleed: Not affected Spec rstack overflow: Not affected Spec store bypass: Not affected Spectre v1: Mitigation; __user pointer sanitization Spectre v2: Mitigation; CSV2, but not BHB Srbds: Not affected Tsx async abort: Not affected
Description of problem: 6.6.88-cbp.git.8932083f9.an23.x86_64环境,hid/hid_bpf编译失败 # cd hid/ # ll total 116 -rw-r--r--. 1 root root 692 Jun 30 10:09 config -rw-r--r--. 1 root root 5663 Jun 30 10:09 config.common -rw-r--r--. 1 root root 87 Jun 30 10:09 config.x86_64 -rwxr-xr-x. 1 root root 149 Jun 30 10:09 hid-apple.sh -rw-r--r--. 1 root root 21474 Jun 30 10:09 hid_bpf.c -rwxr-xr-x. 1 root root 143 Jun 30 10:09 hid-core.sh -rwxr-xr-x. 1 root root 142 Jun 30 10:09 hid-gamepad.sh -rwxr-xr-x. 1 root root 147 Jun 30 10:09 hid-ite.sh -rwxr-xr-x. 1 root root 143 Jun 30 10:09 hid-keyboard.sh -rwxr-xr-x. 1 root root 140 Jun 30 10:09 hid-mouse.sh -rwxr-xr-x. 1 root root 145 Jun 30 10:09 hid-multitouch.sh -rwxr-xr-x. 1 root root 139 Jun 30 10:09 hid-sony.sh -rwxr-xr-x. 1 root root 141 Jun 30 10:09 hid-tablet.sh -rwxr-xr-x. 1 root root 144 Jun 30 10:09 hid-usb_crash.sh -rwxr-xr-x. 1 root root 148 Jun 30 10:09 hid-wacom.sh -rw-r--r--. 1 root root 8470 Jun 30 10:09 Makefile drwxr-xr-x. 2 root root 44 Jun 30 10:09 progs -rwxr-xr-x. 1 root root 758 Jun 30 10:09 run-hid-tools-tests.sh -rw-r--r--. 1 root root 78 Jun 30 10:09 settings drwxr-xr-x. 3 root root 4096 Jun 30 14:09 tests drwxr-xr-x. 5 root root 46 Jun 30 10:09 tools -rwxr-xr-x. 1 root root 6890 Jun 30 10:09 vmtest.sh # make Makefile:4: ../../../build/Build.include: No such file or directory make: *** No rule to make target '../../../build/Build.include'. Stop. [环境信息] # uname -r 6.6.88-cbp.git.8932083f9.an23.x86_64 # free -h total used free shared buff/cache available Mem: 15Gi 992Mi 13Gi 46Mi 975Mi 13Gi Swap: 0B 0B 0B # 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 ht syscall nx pdpe1gb rdtscp l m constant_tsc rep_good nopl nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2 apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault 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 vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcn tdq 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: Gather data sampling: Unknown: Dependent on hypervisor status 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 Reg file data sampling: Not affected Retbleed: Not affected Spec rstack overflow: Not affected Spec store bypass: Vulnerable Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Spectre v2: Mitigation; Enhanced / Automatic IBRS; RSB filling; PBRSB-eIBRS SW sequence; BHI SW loop, KVM SW loop Srbds: Not affected Tsx async abort: Not affected