#
a90c5845 |
|
14-Mar-2024 |
Alexei Starovoitov <ast@kernel.org> |
selftests/bpf: Add arena test case for 4Gbyte corner case Check that 4Gbyte arena can be allocated and overflow/underflow access in the first and the last page behaves as expected. Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Stanislav Fomichev <sdf@google.com> Link: https://lore.kernel.org/bpf/20240315021834.62988-5-alexei.starovoitov@gmail.com
|
#
80a4129f |
|
07-Mar-2024 |
Alexei Starovoitov <ast@kernel.org> |
selftests/bpf: Add unit tests for bpf_arena_alloc/free_pages Add unit tests for bpf_arena_alloc/free_pages() functionality and bpf_arena_common.h with a set of common helpers and macros that is used in this test and the following patches. Also modify test_loader that didn't support running bpf_prog_type_syscall programs. Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20240308010812.89848-13-alexei.starovoitov@gmail.com
|
#
c381203e |
|
29-Jan-2024 |
Andrii Nakryiko <andrii@kernel.org> |
selftests/bpf: add trusted global subprog arg tests Add a bunch of test cases validating behavior of __arg_trusted and its combination with __arg_nullable tag. We also validate CO-RE flavor support by kernel for __arg_trusted args. Acked-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20240130000648.2144827-5-andrii@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
f0a50562 |
|
14-Dec-2023 |
Andrii Nakryiko <andrii@kernel.org> |
selftests/bpf: add freplace of BTF-unreliable main prog test Add a test validating that freplace'ing another main (entry) BPF program fails if the target BPF program doesn't have valid/expected func proto BTF. We extend fexit_bpf2bpf test to allow to specify expected log message for negative test cases (where freplace program is expected to fail to load). Acked-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20231215011334.2307144-11-andrii@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
f04f2ce6 |
|
11-Dec-2023 |
Daniel Xu <dxu@dxuuu.xyz> |
bpf: selftests: Add verifier tests for CO-RE bitfield writes Add some tests that exercise BPF_CORE_WRITE_BITFIELD() macro. Since some non-trivial bit fiddling is going on, make sure various edge cases (such as adjacent bitfields and bitfields at the edge of structs) are exercised. Acked-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz> Link: https://lore.kernel.org/r/72698a1080fa565f541d5654705255984ea2a029.1702325874.git.dxu@dxuuu.xyz Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
|
#
e8a339b5 |
|
23-Nov-2023 |
Andrii Nakryiko <andrii@kernel.org> |
selftests/bpf: Add lazy global subprog validation tests Add a few test that validate BPF verifier's lazy approach to validating global subprogs. We check that global subprogs that are called transitively through another global subprog is validated. We also check that invalid global subprog is not validated, if it's not called from the main program. And we also check that main program is always validated first, before any of the subprogs. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20231124035937.403208-4-andrii@kernel.org
|
#
958465e2 |
|
20-Nov-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: tests for iterating callbacks A set of test cases to check behavior of callback handling logic, check if verifier catches the following situations: - program not safe on second callback iteration; - program not safe on zero callback iterations; - infinite loop inside a callback. Verify that callback logic works for bpf_loop, bpf_for_each_map_elem, bpf_user_ringbuf_drain, bpf_find_vma. Acked-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20231121020701.26440-8-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
3c419715 |
|
01-Nov-2023 |
Shung-Hsi Yu <shung-hsi.yu@suse.com> |
selftests/bpf: precision tracking test for BPF_NEG and BPF_END As seen from previous commit that fix backtracking for BPF_ALU | BPF_TO_BE | BPF_END, both BPF_NEG and BPF_END require special handling. Add tests written with inline assembly to check that the verifier does not incorrecly use the src_reg field of BPF_NEG and BPF_END (including bswap added in v4). Suggested-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com> Link: https://lore.kernel.org/r/20231102053913.12004-4-shung-hsi.yu@suse.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
613dad49 |
|
27-Jul-2023 |
Yonghong Song <yonghong.song@linux.dev> |
selftests/bpf: Add unit tests for new gotol insn Add unit tests for gotol insn. Signed-off-by: Yonghong Song <yonghong.song@linux.dev> Link: https://lore.kernel.org/r/20230728011329.3721881-1-yonghong.song@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
de1c2680 |
|
27-Jul-2023 |
Yonghong Song <yonghong.song@linux.dev> |
selftests/bpf: Add unit tests for new sdiv/smod insns Add unit tests for sdiv/smod insns. Signed-off-by: Yonghong Song <yonghong.song@linux.dev> Link: https://lore.kernel.org/r/20230728011321.3720500-1-yonghong.song@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
79dbabc1 |
|
27-Jul-2023 |
Yonghong Song <yonghong.song@linux.dev> |
selftests/bpf: Add unit tests for new bswap insns Add unit tests for bswap insns. Signed-off-by: Yonghong Song <yonghong.song@linux.dev> Link: https://lore.kernel.org/r/20230728011314.3720109-1-yonghong.song@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
f02ec3ff |
|
27-Jul-2023 |
Yonghong Song <yonghong.song@linux.dev> |
selftests/bpf: Add unit tests for new sign-extension mov insns Add unit tests for movsx insns. Signed-off-by: Yonghong Song <yonghong.song@linux.dev> Link: https://lore.kernel.org/r/20230728011309.3719295-1-yonghong.song@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
147c8f44 |
|
27-Jul-2023 |
Yonghong Song <yonghong.song@linux.dev> |
selftests/bpf: Add unit tests for new sign-extension load insns Add unit tests for new ldsx insns. The test includes sign-extension with a single value or with a value range. If cpuv4 is not supported due to (1) older compiler, e.g., less than clang version 18, or (2) test runner test_progs and test_progs-no_alu32 which tests cpu v2 and v3, or (3) non-x86_64 arch not supporting new insns in jit yet, a dummy program is added with below output: #318/1 verifier_ldsx/cpuv4 is not supported by compiler or jit, use a dummy test:OK #318 verifier_ldsx:OK to indicate the test passed with a dummy test instead of actually testing cpuv4. I am using a dummy prog to avoid changing the verifier testing infrastructure. Once clang 18 is widely available and other architectures support cpuv4, at least for CI run, the dummy program can be removed. Signed-off-by: Yonghong Song <yonghong.song@linux.dev> Link: https://lore.kernel.org/r/20230728011304.3719139-1-yonghong.song@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
2597a25c |
|
26-Jun-2023 |
Stanislav Fomichev <sdf@google.com> |
selftests/bpf: Add test to exercise typedef walking Add new bpf_fentry_test_sinfo with skb_shared_info argument and try to access frags. Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/bpf/20230626212522.2414485-2-sdf@google.com
|
#
dec02028 |
|
13-Jun-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: Check if mark_chain_precision() follows scalar ids Check __mark_chain_precision() log to verify that scalars with same IDs are marked as precise. Use several scenarios to test that precision marks are propagated through: - registers of scalar type with the same ID within one state; - registers of scalar type with the same ID cross several states; - registers of scalar type with the same ID cross several stack frames; - stack slot of scalar type with the same ID; - multiple scalar IDs are tracked independently. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20230613153824.3324830-3-eddyz87@gmail.com
|
#
3ef3d217 |
|
04-May-2023 |
Andrii Nakryiko <andrii@kernel.org> |
selftests/bpf: add precision propagation tests in the presence of subprogs Add a bunch of tests validating verifier's precision backpropagation logic in the presence of subprog calls and/or callback-calling helpers/kfuncs. We validate the following conditions: - subprog_result_precise: static subprog r0 result precision handling; - global_subprog_result_precise: global subprog r0 precision shortcutting, similar to BPF helper handling; - callback_result_precise: similarly r0 marking precise for callback-calling helpers; - parent_callee_saved_reg_precise, parent_callee_saved_reg_precise_global: propagation of precision for callee-saved registers bypassing static/global subprogs; - parent_callee_saved_reg_precise_with_callback: same as above, but in the presence of callback-calling helper; - parent_stack_slot_precise, parent_stack_slot_precise_global: similar to above, but instead propagating precision of stack slot (spilled SCALAR reg); - parent_stack_slot_precise_with_callback: same as above, but in the presence of callback-calling helper; - subprog_arg_precise: propagation of precision of static subprog's input argument back to caller; - subprog_spill_into_parent_stack_slot_precise: negative test validating that verifier currently can't support backtracking of stack access with non-r10 register, we validate that we fallback to forcing precision for all SCALARs. Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20230505043317.3629845-10-andrii@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
35150203 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/prevent_map_lookup converted to inline assembly Test verifier/prevent_map_lookup automatically converted to use inline assembly. This was a part of a series [1] but could not be applied becuase another patch from a series had to be witheld. [1] https://lore.kernel.org/bpf/20230421174234.2391278-1-eddyz87@gmail.com/ Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421204514.2450907-1-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
4db10a824 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/value_ptr_arith converted to inline assembly Test verifier/value_ptr_arith automatically converted to use inline assembly. Test cases "sanitation: alu with different scalars 2" and "sanitation: alu with different scalars 3" are updated to avoid -ENOENT as return value, as __retval() annotation only supports numeric literals. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-25-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
efe25a33 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/value_illegal_alu converted to inline assembly Test verifier/value_illegal_alu automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-24-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
82887c25 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/unpriv converted to inline assembly Test verifier/unpriv semi-automatically converted to use inline assembly. The verifier/unpriv.c had to be split in two parts: - the bulk of the tests is in the progs/verifier_unpriv.c; - the single test that needs `struct bpf_perf_event_data` definition is in the progs/verifier_unpriv_perf.c. The tests above can't be in a single file because: - first requires inclusion of the filter.h header (to get access to BPF_ST_MEM macro, inline assembler does not support this isntruction); - the second requires vmlinux.h, which contains definitions conflicting with filter.h. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-23-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
81d1d6dd |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/subreg converted to inline assembly Test verifier/subreg automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-22-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
f323a818 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/spin_lock converted to inline assembly Test verifier/spin_lock automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-21-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
426fc0e3 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/sock converted to inline assembly Test verifier/sock automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-20-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
034d9ad2 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/search_pruning converted to inline assembly Test verifier/search_pruning automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-19-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
65222842 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/runtime_jit converted to inline assembly Test verifier/runtime_jit automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-18-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
16a42573 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/regalloc converted to inline assembly Test verifier/regalloc automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-17-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
8be63279 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/ref_tracking converted to inline assembly Test verifier/ref_tracking automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-16-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
aee1779f |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/map_ptr_mixing converted to inline assembly Test verifier/map_ptr_mixing automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-13-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
4a400ef9 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/map_in_map converted to inline assembly Test verifier/map_in_map automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-12-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
b427ca57 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/lwt converted to inline assembly Test verifier/lwt automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-11-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
a6fc14dc |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/loops1 converted to inline assembly Test verifier/loops1 automatically converted to use inline assembly. There are a few modifications for the converted tests. "tracepoint" programs do not support test execution, change program type to "xdp" (which supports test execution) for the following tests that have __retval tags: - bounded loop, count to 4 - bonded loop containing forward jump Also, remove the __retval tag for test: - bounded loop, count from positive unknown to 4 As it's return value is a random number. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-10-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
a5828e31 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/jeq_infer_not_null converted to inline assembly Test verifier/jeq_infer_not_null automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-9-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
0a372c9c |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/direct_packet_access converted to inline assembly Test verifier/direct_packet_access automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-8-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
60802802 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/d_path converted to inline assembly Test verifier/d_path automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-7-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
fcd36964 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/ctx converted to inline assembly Test verifier/ctx automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-6-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
37467c79 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/btf_ctx_access converted to inline assembly Test verifier/btf_ctx_access automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-5-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
965a3f91 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/bpf_get_stack converted to inline assembly Test verifier/bpf_get_stack automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-4-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
c9233655 |
|
21-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/bounds converted to inline assembly Test verifier/bounds automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230421174234.2391278-3-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
006c0e44 |
|
21-Apr-2023 |
Florian Westphal <fw@strlen.de> |
selftests/bpf: add missing netfilter return value and ctx access tests Extend prog_tests with two test cases: # ./test_progs --allow=verifier_netfilter_retcode #278/1 verifier_netfilter_retcode/bpf_exit with invalid return code. test1:OK #278/2 verifier_netfilter_retcode/bpf_exit with valid return code. test2:OK #278/3 verifier_netfilter_retcode/bpf_exit with valid return code. test3:OK #278/4 verifier_netfilter_retcode/bpf_exit with invalid return code. test4:OK #278 verifier_netfilter_retcode:OK This checks that only accept and drop (0,1) are permitted. NF_QUEUE could be implemented later if we can guarantee that attachment of such programs can be rejected if they get attached to a pf/hook that doesn't support async reinjection. NF_STOLEN could be implemented via trusted helpers that can guarantee that the skb will eventually be free'd. v4: test case for bpf_nf_ctx access checks, requested by Alexei Starovoitov. v5: also check ctx->{state,skb} can be dereferenced (Alexei). # ./test_progs --allow=verifier_netfilter_ctx #281/1 verifier_netfilter_ctx/netfilter invalid context access, size too short:OK #281/2 verifier_netfilter_ctx/netfilter invalid context access, size too short:OK #281/3 verifier_netfilter_ctx/netfilter invalid context access, past end of ctx:OK #281/4 verifier_netfilter_ctx/netfilter invalid context, write:OK #281/5 verifier_netfilter_ctx/netfilter valid context read and invalid write:OK #281/6 verifier_netfilter_ctx/netfilter test prog with skb and state read access:OK #281/7 verifier_netfilter_ctx/netfilter test prog with skb and state read access @unpriv:OK #281 verifier_netfilter_ctx:OK Summary: 1/7 PASSED, 0 SKIPPED, 0 FAILED This checks: 1/2: partial reads of ctx->{skb,state} are rejected 3. read access past sizeof(ctx) is rejected 4. write to ctx content, e.g. 'ctx->skb = NULL;' is rejected 5. ctx->state content cannot be altered 6. ctx->state and ctx->skb can be dereferenced 7. ... same program fails for unpriv (CAP_NET_ADMIN needed). Link: https://lore.kernel.org/bpf/20230419021152.sjq4gttphzzy6b5f@dhcp-172-26-102-232.dhcp.thefacebook.com/ Link: https://lore.kernel.org/bpf/20230420201655.77kkgi3dh7fesoll@MacBook-Pro-6.local/ Signed-off-by: Florian Westphal <fw@strlen.de> Link: https://lore.kernel.org/r/20230421170300.24115-8-fw@strlen.de Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
cbb110bc |
|
20-Apr-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: populate map_array_ro map for verifier_array_access test Two test cases: - "valid read map access into a read-only array 1" and - "valid read map access into a read-only array 2" Expect that map_array_ro map is filled with mock data. This logic was not taken into acount during initial test conversion. This commit modifies prog_tests/verifier.c entry point for this test to fill the map. Fixes: a3c830ae0209 ("selftests/bpf: verifier/array_access.c converted to inline assembly") Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230420232317.2181776-5-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
49859de9 |
|
17-Apr-2023 |
Yonghong Song <yhs@fb.com> |
selftests/bpf: Add a selftest for checking subreg equality Add a selftest to ensure subreg equality if source register upper 32bit is 0. Without previous patch, the test will fail verification. Acked-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Yonghong Song <yhs@fb.com> Link: https://lore.kernel.org/r/20230417222139.360607-1-yhs@fb.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
aec08d67 |
|
06-Apr-2023 |
Yonghong Song <yhs@fb.com> |
selftests/bpf: Add tests for non-constant cond_op NE/EQ bound deduction Add various tests for code pattern '<non-const> NE/EQ <const>' implemented in the previous verifier patch. Without the verifier patch, these new tests will fail. Signed-off-by: Yonghong Song <yhs@fb.com> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20230406164500.1045715-1-yhs@fb.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
6e9e141a |
|
27-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: Verifier/xdp_direct_packet_access.c converted to inline assembly Test verifier/xdp_direct_packet_access.c automatically converted to use inline assembly. Original test would be removed in the next patch. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20230328020813.392560-2-eddyz87@gmail.com
|
#
ffb515c9 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/xdp.c converted to inline assembly Test verifier/xdp.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-43-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
a8036aea |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/xadd.c converted to inline assembly Test verifier/xadd.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-42-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
d15f5b68 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/var_off.c converted to inline assembly Test verifier/var_off.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-41-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
d3305286 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/value_or_null.c converted to inline assembly Test verifier/value_or_null.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-40-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
8f59e87a |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/value.c converted to inline assembly Test verifier/value.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-39-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
03391494 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/value_adj_spill.c converted to inline assembly Test verifier/value_adj_spill.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-38-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
ab839a58 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/uninit.c converted to inline assembly Test verifier/uninit.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-37-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
edff37b2 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/stack_ptr.c converted to inline assembly Test verifier/stack_ptr.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-36-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
f4fe3cfe |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/spill_fill.c converted to inline assembly Test verifier/spill_fill.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-35-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
b7e42030 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/ringbuf.c converted to inline assembly Test verifier/ringbuf.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-34-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
18cdc2b5 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/raw_tp_writable.c converted to inline assembly Test verifier/raw_tp_writable.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-33-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
5a77a01f |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/raw_stack.c converted to inline assembly Test verifier/raw_stack.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-32-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
65428312 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/meta_access.c converted to inline assembly Test verifier/meta_access.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-31-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
ade3f08f |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/masking.c converted to inline assembly Test verifier/masking.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-30-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
05e474ec |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/map_ret_val.c converted to inline assembly Test verifier/map_ret_val.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-29-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
caf345cf |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/map_ptr.c converted to inline assembly Test verifier/map_ptr.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-28-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
583c7ce5 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/leak_ptr.c converted to inline assembly Test verifier/leak_ptr.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-27-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
e2978755 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/ld_ind.c converted to inline assembly Test verifier/ld_ind.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-26-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
01481e67 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/int_ptr.c converted to inline assembly Test verifier/int_ptr.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-25-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
ecc42482 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/helper_value_access.c converted to inline assembly Test verifier/helper_value_access.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-24-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
77aa2563 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/helper_restricted.c converted to inline assembly Test verifier/helper_restricted.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-23-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
fb179fe6 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/helper_packet_access.c converted to inline assembly Test verifier/helper_packet_access.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-22-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
b37d776b |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/helper_access_var_len.c converted to inline assembly Test verifier/helper_access_var_len.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-21-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
9553de70 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/div_overflow.c converted to inline assembly Test verifier/div_overflow.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-20-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
01a09255 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/div0.c converted to inline assembly Test verifier/div0.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-19-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
84988478 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/direct_stack_access_wraparound.c converted to inline assembly Test verifier/direct_stack_access_wraparound.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-18-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
a58475a9 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/ctx_sk_msg.c converted to inline assembly Test verifier/ctx_sk_msg.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-17-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
a2777eaa |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/const_or.c converted to inline assembly Test verifier/const_or.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-16-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
8f16f3c0 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/cgroup_storage.c converted to inline assembly Test verifier/cgroup_storage.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-15-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
b1b63725 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/cgroup_skb.c converted to inline assembly Test verifier/cgroup_skb.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-14-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
047687a7 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/cgroup_inv_retcode.c converted to inline assembly Test verifier/cgroup_inv_retcode.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-13-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
2f2047c2 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/cfg.c converted to inline assembly Test verifier/cfg.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-12-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
b14a702a |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/bounds_mix_sign_unsign.c converted to inline assembly Test verifier/bounds_mix_sign_unsign.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-11-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
7605f94b |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/bounds_deduction.c converted to inline assembly Test verifier/bounds_deduction.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-10-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
0ccbe495 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/basic_stack.c converted to inline assembly Test verifier/basic_stack.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-9-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
a3c830ae |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/array_access.c converted to inline assembly Test verifier/array_access.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-8-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
9d0f1568 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: verifier/and.c converted to inline assembly Test verifier/and.c automatically converted to use inline assembly. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-7-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|
#
55108621 |
|
24-Mar-2023 |
Eduard Zingerman <eddyz87@gmail.com> |
selftests/bpf: prog_tests entry point for migrated test_verifier tests prog_tests/verifier.c would be used as a host for verifier/*.c tests migrated to use inline assembly and run from test_progs. The run_test_aux() function mimics the test_verifier behavior dropping CAP_SYS_ADMIN upon entry. Signed-off-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://lore.kernel.org/r/20230325025524.144043-6-eddyz87@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
|