Repository navigation
Improve error handling of verifier tests - #479
kernel-patches-bot wants to merge 3 commits into
Conversation
|
Master branch: eceae70 |
cadcbf7 to
8e59582
Compare
|
Master branch: fdd8b82 |
8e59582 to
705b80a
Compare
|
Master branch: 846c3c9 |
705b80a to
0577f83
Compare
Commit 8184d44 ("selftests/bpf: skip verifier tests for unsupported program types") added a check to skip unsupported program types. As bpf_probe_prog_type can change errno, do_single_test should save it before printing a reason why a supported BPF program type failed to load. Fixes: 8184d44 ("selftests/bpf: skip verifier tests for unsupported program types") Cc: Stanislav Fomichev <[email protected]> Cc: Krzesimir Nowak <[email protected]> Signed-off-by: Florian Lehner <[email protected]> Acked-by: Andrii Nakryiko <[email protected]>
Print a message when the returned error is about a program type being not supported or because of permission problems. These messages are expected if the program to test was actually executed. Cc: Krzesimir Nowak <[email protected]> Signed-off-by: Florian Lehner <[email protected]>
|
Master branch: 2fa3515 |
0577f83 to
f874472
Compare
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=396517 irrelevant now. Closing PR. |
Failing tests: - kernel-patches#110 fexit_bpf2bpf:FAIL - kernel-patches#124 for_each:FAIL - kernel-patches#144 iters:FAIL - kernel-patches#148 kfree_skb:FAIL - kernel-patches#161 l4lb_all:FAIL - kernel-patches#193 map_kptr:FAIL - kernel-patches#23 bpf_loop:FAIL - kernel-patches#260 pkt_access:FAIL - kernel-patches#269 prog_run_opts:FAIL - kernel-patches#280 rbtree_success:FAIL - kernel-patches#356 res_spin_lock_failure:FAIL - kernel-patches#364 setget_sockopt:FAIL - kernel-patches#381 sock_fields:FAIL - kernel-patches#394 spin_lock:FAIL - kernel-patches#395 spin_lock_success:FAIL - kernel-patches#444 test_bpffs:FAIL - kernel-patches#453 test_profiler:FAIL - kernel-patches#479 usdt:FAIL - kernel-patches#488 verifier_bits_iter:FAIL - kernel-patches#597 verif_scale_pyperf600:FAIL - kernel-patches#598 verif_scale_pyperf600_bpf_loop:FAIL - kernel-patches#599 verif_scale_pyperf600_iter:FAIL - kernel-patches#608 verif_scale_strobemeta_subprogs:FAIL - kernel-patches#622 xdp_attach:FAIL - kernel-patches#637 xdp_noinline:FAIL - kernel-patches#639 xdp_synproxy:FAIL - kernel-patches#72 cls_redirect:FAIL - kernel-patches#88 crypto_sanity:FAIL - kernel-patches#97 dynptr:FAIL Signed-off-by: Eduard Zingerman <[email protected]>
Failing tests: - kernel-patches#110 fexit_bpf2bpf:FAIL - kernel-patches#124 for_each:FAIL - kernel-patches#144 iters:FAIL - kernel-patches#148 kfree_skb:FAIL - kernel-patches#161 l4lb_all:FAIL - kernel-patches#193 map_kptr:FAIL - kernel-patches#23 bpf_loop:FAIL - kernel-patches#260 pkt_access:FAIL - kernel-patches#269 prog_run_opts:FAIL - kernel-patches#280 rbtree_success:FAIL - kernel-patches#356 res_spin_lock_failure:FAIL - kernel-patches#364 setget_sockopt:FAIL - kernel-patches#381 sock_fields:FAIL - kernel-patches#394 spin_lock:FAIL - kernel-patches#395 spin_lock_success:FAIL - kernel-patches#444 test_bpffs:FAIL - kernel-patches#453 test_profiler:FAIL - kernel-patches#479 usdt:FAIL - kernel-patches#488 verifier_bits_iter:FAIL - kernel-patches#597 verif_scale_pyperf600:FAIL - kernel-patches#598 verif_scale_pyperf600_bpf_loop:FAIL - kernel-patches#599 verif_scale_pyperf600_iter:FAIL - kernel-patches#608 verif_scale_strobemeta_subprogs:FAIL - kernel-patches#622 xdp_attach:FAIL - kernel-patches#637 xdp_noinline:FAIL - kernel-patches#639 xdp_synproxy:FAIL - kernel-patches#72 cls_redirect:FAIL - kernel-patches#88 crypto_sanity:FAIL - kernel-patches#97 dynptr:FAIL Signed-off-by: Eduard Zingerman <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Four stream tests fail with BPF_GCC: test_stream_arena_fault_address:FAIL:stream__open_and_load unexpected error: -13 #479 stream_oversize:FAIL #480 stream_partial_read:FAIL #482 stream_syscall:FAIL They call stream__open_and_load(), which loads every program in the object, and two of those do not verify: #481/11 stream_success/stream_arena_subprog_fault:FAIL #481/12 stream_success/stream_arena_callback_fault:FAIL Both dereference an arena pointer and leave the cast to the compiler: int __arena *addr = (int __arena *)0xdeadbeef; *addr = 1; Without arena support __arena is only btf_type_tag("arena"), so no addr_space_cast is emitted and the store is to a scalar, which the verifier rejects. GCC splits it into byte stores, 0xdeadbeef not being aligned: r2=3735928559 ll *(u8*)(r2+0)=1 <- plain store, no cast Their siblings in the same file do not rely on the compiler; they use bpf_addr_space_cast(), which emits the instruction byte by byte and works anywhere. Do the same here. The address space has to come off the local as well. Left on, a compiler that supports arenas casts a second time for the dereference, on a pointer the explicit cast has already converted: r2 = addr_space_cast(r2, 0, 1) r3 = addr_space_cast(r2, 0, 1) *(u32*)(r3+0)=1 With it off, GCC with and without arena support and clang all emit the same thing, which is what the test wants: r2 = addr_space_cast(r2, 0, 1) *(u32*)(r2+0)=1 What these two assert is the fault report, not how the pointer was produced, so nothing they were testing is lost. Measured on bpf-next with a stock bpf-gcc, test_progs before and after. Fifteen results go FAIL -> OK -- every test that loads this object, not just the arena ones: stream_arena_fault_address stream_oversize stream_fd stream_fd/blocking stream_partial_read stream_fd/edge stream_fd/empty stream_success stream_fd/hup stream_fd/nmi_epoll stream_success/stream_arena_callback_fault stream_fd/open stream_fd/nonblock stream_success/stream_arena_subprog_fault stream_syscall and the five stream_arena_fault_address subtests become visible for the first time (read, write, xchg, cmpxchg and load_acquire faults). Signed-off-by: Vineet Gupta <[email protected]>
Pull request for series with
subject: Improve error handling of verifier tests
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=396517