Commit d784881
selftests/bpf: Skip callback tests if jit is disabled in test_verifier
If CONFIG_BPF_JIT_ALWAYS_ON is not set and bpf_jit_enable is 0, there
exist 6 failed tests.
[root@linux bpf]# echo 0 > /proc/sys/net/core/bpf_jit_enable
[root@linux bpf]# echo 0 > /proc/sys/kernel/unprivileged_bpf_disabled
[root@linux bpf]# ./test_verifier | grep FAIL
torvalds#106/p inline simple bpf_loop call FAIL
torvalds#107/p don't inline bpf_loop call, flags non-zero FAIL
torvalds#108/p don't inline bpf_loop call, callback non-constant FAIL
torvalds#109/p bpf_loop_inline and a dead func FAIL
torvalds#110/p bpf_loop_inline stack locations for loop vars FAIL
torvalds#111/p inline bpf_loop call in a big program FAIL
Summary: 768 PASSED, 15 SKIPPED, 6 FAILED
The test log shows that callbacks are not allowed in non-JITed programs,
interpreter doesn't support them yet, thus these tests should be skipped
if jit is disabled, just handle this case in do_test_single().
After including bpf/libbpf_internal.h, there exist some build errors:
error: attempt to use poisoned "u32"
error: attempt to use poisoned "u64"
replace u32 and u64 with __u32 and __u64 to fix them.
With this patch:
[root@linux bpf]# echo 0 > /proc/sys/net/core/bpf_jit_enable
[root@linux bpf]# echo 0 > /proc/sys/kernel/unprivileged_bpf_disabled
[root@linux bpf]# ./test_verifier | grep FAIL
Summary: 768 PASSED, 21 SKIPPED, 0 FAILED
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Acked-by: Hou Tao <houtao1@huawei.com>1 parent d489189 commit d784881
1 file changed
+17
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
1143 | 1145 | | |
1144 | 1146 | | |
1145 | 1147 | | |
1146 | | - | |
1147 | | - | |
| 1148 | + | |
| 1149 | + | |
1148 | 1150 | | |
1149 | 1151 | | |
1150 | 1152 | | |
| |||
1203 | 1205 | | |
1204 | 1206 | | |
1205 | 1207 | | |
1206 | | - | |
| 1208 | + | |
1207 | 1209 | | |
1208 | 1210 | | |
1209 | 1211 | | |
| |||
1622 | 1624 | | |
1623 | 1625 | | |
1624 | 1626 | | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
1625 | 1637 | | |
1626 | 1638 | | |
1627 | 1639 | | |
| |||
1844 | 1856 | | |
1845 | 1857 | | |
1846 | 1858 | | |
| 1859 | + | |
| 1860 | + | |
1847 | 1861 | | |
1848 | 1862 | | |
1849 | 1863 | | |
| |||
0 commit comments