Re: [PATCH bpf-next 2/4] bpf: treewide: Clean up BPF_ALU and BPF_JMP

From: kernel test robot
Date: Wed Feb 01 2023 - 23:02:24 EST


Hi Tiezhu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on bpf-next/master]

url: https://github.com/intel-lab-lkp/linux/commits/Tiezhu-Yang/bpf-Add-new-macro-BPF_ALU32-and-BPF_JMP64/20230201-203836
base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
patch link: https://lore.kernel.org/r/1675254998-4951-3-git-send-email-yangtiezhu%40loongson.cn
patch subject: [PATCH bpf-next 2/4] bpf: treewide: Clean up BPF_ALU and BPF_JMP
config: i386-randconfig-a016-20230130 (https://download.01.org/0day-ci/archive/20230202/202302021105.HU4McFMJ-lkp@xxxxxxxxx/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/9955f957cb218f711161ac710656be1164eaa3a3
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Tiezhu-Yang/bpf-Add-new-macro-BPF_ALU32-and-BPF_JMP64/20230201-203836
git checkout 9955f957cb218f711161ac710656be1164eaa3a3
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash samples/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> samples/seccomp/bpf-fancy.c:38:3: error: use of undeclared identifier 'BPF_JMP64'
SYSCALL(__NR_exit, ALLOW),
^
samples/seccomp/bpf-helper.h:56:11: note: expanded from macro 'SYSCALL'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, (nr), 0, 1), \
^
samples/seccomp/bpf-fancy.c:39:3: error: use of undeclared identifier 'BPF_JMP64'
SYSCALL(__NR_exit_group, ALLOW),
^
samples/seccomp/bpf-helper.h:56:11: note: expanded from macro 'SYSCALL'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, (nr), 0, 1), \
^
samples/seccomp/bpf-fancy.c:40:3: error: use of undeclared identifier 'BPF_JMP64'
SYSCALL(__NR_write, JUMP(&l, write_fd)),
^
samples/seccomp/bpf-helper.h:56:11: note: expanded from macro 'SYSCALL'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, (nr), 0, 1), \
^
samples/seccomp/bpf-fancy.c:40:23: error: use of undeclared identifier 'BPF_JMP64'
SYSCALL(__NR_write, JUMP(&l, write_fd)),
^
samples/seccomp/bpf-helper.h:50:11: note: expanded from macro 'JUMP'
BPF_JUMP(BPF_JMP64+BPF_JA, FIND_LABEL((labels), (label)), \
^
samples/seccomp/bpf-fancy.c:41:3: error: use of undeclared identifier 'BPF_JMP64'
SYSCALL(__NR_read, JUMP(&l, read)),
^
samples/seccomp/bpf-helper.h:56:11: note: expanded from macro 'SYSCALL'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, (nr), 0, 1), \
^
samples/seccomp/bpf-fancy.c:41:22: error: use of undeclared identifier 'BPF_JMP64'
SYSCALL(__NR_read, JUMP(&l, read)),
^
samples/seccomp/bpf-helper.h:50:11: note: expanded from macro 'JUMP'
BPF_JUMP(BPF_JMP64+BPF_JA, FIND_LABEL((labels), (label)), \
^
samples/seccomp/bpf-fancy.c:44:3: error: use of undeclared identifier 'BPF_JMP64'
LABEL(&l, read),
^
samples/seccomp/bpf-helper.h:53:11: note: expanded from macro 'LABEL'
BPF_JUMP(BPF_JMP64+BPF_JA, FIND_LABEL((labels), (label)), \
^
samples/seccomp/bpf-fancy.c:46:3: error: use of undeclared identifier 'BPF_JMP64'
JNE(STDIN_FILENO, DENY),
^
samples/seccomp/bpf-helper.h:77:20: note: expanded from macro 'JNE'
#define JNE(x, jt) JNE32(x, EXPAND(jt))
^
samples/seccomp/bpf-helper.h:154:11: note: expanded from macro 'JNE32'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, (value), 1, 0), \
^
samples/seccomp/bpf-fancy.c:48:3: error: use of undeclared identifier 'BPF_JMP64'
JNE((unsigned long)buf, DENY),
^
samples/seccomp/bpf-helper.h:77:20: note: expanded from macro 'JNE'
#define JNE(x, jt) JNE32(x, EXPAND(jt))
^
samples/seccomp/bpf-helper.h:154:11: note: expanded from macro 'JNE32'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, (value), 1, 0), \
^
samples/seccomp/bpf-fancy.c:50:3: error: use of undeclared identifier 'BPF_JMP64'
JGE(sizeof(buf), DENY),
^
samples/seccomp/bpf-helper.h:80:20: note: expanded from macro 'JGE'
#define JGE(x, jt) JGE32(x, EXPAND(jt))
^
samples/seccomp/bpf-helper.h:162:11: note: expanded from macro 'JGE32'
BPF_JUMP(BPF_JMP64+BPF_JGE+BPF_K, (value), 0, 1), \
^
samples/seccomp/bpf-fancy.c:53:3: error: use of undeclared identifier 'BPF_JMP64'
LABEL(&l, write_fd),
^
samples/seccomp/bpf-helper.h:53:11: note: expanded from macro 'LABEL'
BPF_JUMP(BPF_JMP64+BPF_JA, FIND_LABEL((labels), (label)), \
^
samples/seccomp/bpf-fancy.c:55:3: error: use of undeclared identifier 'BPF_JMP64'
JEQ(STDOUT_FILENO, JUMP(&l, write_buf)),
^
samples/seccomp/bpf-helper.h:76:20: note: expanded from macro 'JEQ'
#define JEQ(x, jt) JEQ32(x, EXPAND(jt))
^
samples/seccomp/bpf-helper.h:150:11: note: expanded from macro 'JEQ32'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, (value), 0, 1), \
^
samples/seccomp/bpf-fancy.c:55:22: error: use of undeclared identifier 'BPF_JMP64'
JEQ(STDOUT_FILENO, JUMP(&l, write_buf)),
^
samples/seccomp/bpf-helper.h:50:11: note: expanded from macro 'JUMP'
BPF_JUMP(BPF_JMP64+BPF_JA, FIND_LABEL((labels), (label)), \
^
samples/seccomp/bpf-fancy.c:56:3: error: use of undeclared identifier 'BPF_JMP64'
JEQ(STDERR_FILENO, JUMP(&l, write_buf)),
^
samples/seccomp/bpf-helper.h:76:20: note: expanded from macro 'JEQ'
#define JEQ(x, jt) JEQ32(x, EXPAND(jt))
^
samples/seccomp/bpf-helper.h:150:11: note: expanded from macro 'JEQ32'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, (value), 0, 1), \
^
samples/seccomp/bpf-fancy.c:56:22: error: use of undeclared identifier 'BPF_JMP64'
JEQ(STDERR_FILENO, JUMP(&l, write_buf)),
--
>> samples/seccomp/bpf-helper.c:33:23: error: use of undeclared identifier 'BPF_JMP64'
if (instr->code != (BPF_JMP64+BPF_JA))
^
1 error generated.
--
>> samples/seccomp/dropper.c:33:12: error: use of undeclared identifier 'BPF_JMP64'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, arch, 0, 3),
^
samples/seccomp/dropper.c:36:12: error: use of undeclared identifier 'BPF_JMP64'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, nr, 0, 1),
^
>> samples/seccomp/dropper.c:42:33: error: invalid application of 'sizeof' to an incomplete type 'struct sock_filter[]'
.len = (unsigned short)(sizeof(filter)/sizeof(filter[0])),
^~~~~~~~
3 errors generated.
--
>> samples/seccomp/bpf-direct.c:117:12: error: use of undeclared identifier 'BPF_JMP64'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, __NR_rt_sigreturn, 0, 1),
^
samples/seccomp/bpf-direct.c:120:12: error: use of undeclared identifier 'BPF_JMP64'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, __NR_sigreturn, 0, 1),
^
samples/seccomp/bpf-direct.c:123:12: error: use of undeclared identifier 'BPF_JMP64'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, __NR_exit_group, 0, 1),
^
samples/seccomp/bpf-direct.c:125:12: error: use of undeclared identifier 'BPF_JMP64'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, __NR_exit, 0, 1),
^
samples/seccomp/bpf-direct.c:127:12: error: use of undeclared identifier 'BPF_JMP64'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, __NR_read, 1, 0),
^
samples/seccomp/bpf-direct.c:128:12: error: use of undeclared identifier 'BPF_JMP64'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, __NR_write, 3, 2),
^
samples/seccomp/bpf-direct.c:132:12: error: use of undeclared identifier 'BPF_JMP64'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, STDIN_FILENO, 4, 0),
^
samples/seccomp/bpf-direct.c:137:12: error: use of undeclared identifier 'BPF_JMP64'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, STDOUT_FILENO, 1, 0),
^
samples/seccomp/bpf-direct.c:139:12: error: use of undeclared identifier 'BPF_JMP64'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, STDERR_FILENO, 1, 2),
^
>> samples/seccomp/bpf-direct.c:146:33: error: invalid application of 'sizeof' to an incomplete type 'struct sock_filter[]'
.len = (unsigned short)(sizeof(filter)/sizeof(filter[0])),
^~~~~~~~
10 errors generated.
--
>> samples/seccomp/user-trap.c:91:12: error: use of undeclared identifier 'BPF_JMP64'
BPF_JUMP(BPF_JMP64+BPF_JEQ+BPF_K, nr, 0, 1),
^
>> samples/seccomp/user-trap.c:97:26: error: invalid application of 'sizeof' to an incomplete type 'struct sock_filter[]'
.len = (unsigned short)ARRAY_SIZE(filter),
^~~~~~~~~~~~~~~~~~
samples/seccomp/user-trap.c:24:30: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
^~~
2 errors generated.


vim +/BPF_JMP64 +38 samples/seccomp/bpf-fancy.c

8ac270d1e29f042 Will Drewry 2012-04-12 26
8ac270d1e29f042 Will Drewry 2012-04-12 27 int main(int argc, char **argv)
8ac270d1e29f042 Will Drewry 2012-04-12 28 {
3a9af0bd34410a2 Kees Cook 2015-02-17 29 struct bpf_labels l = {
3a9af0bd34410a2 Kees Cook 2015-02-17 30 .count = 0,
3a9af0bd34410a2 Kees Cook 2015-02-17 31 };
8ac270d1e29f042 Will Drewry 2012-04-12 32 static const char msg1[] = "Please type something: ";
8ac270d1e29f042 Will Drewry 2012-04-12 33 static const char msg2[] = "You typed: ";
8ac270d1e29f042 Will Drewry 2012-04-12 34 char buf[256];
8ac270d1e29f042 Will Drewry 2012-04-12 35 struct sock_filter filter[] = {
8ac270d1e29f042 Will Drewry 2012-04-12 36 /* TODO: LOAD_SYSCALL_NR(arch) and enforce an arch */
8ac270d1e29f042 Will Drewry 2012-04-12 37 LOAD_SYSCALL_NR,
8ac270d1e29f042 Will Drewry 2012-04-12 @38 SYSCALL(__NR_exit, ALLOW),

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests