diff options
| author | Daniel Xu <dxu@dxuuu.xyz> | 2025-01-14 13:28:44 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2025-01-16 17:51:10 -0800 |
| commit | 37cce22dbd51a3ef7f6c08c3fb5f1c5075a17fbb (patch) | |
| tree | 1a0a9958409ee4c9111c32ab6ea6c41b824692b3 /tools/testing/selftests/bpf/progs/verifier_basic_stack.c | |
| parent | bpf: tcp: Mark bpf_load_hdr_opt() arg2 as read-write (diff) | |
| download | linux-37cce22dbd51a3ef7f6c08c3fb5f1c5075a17fbb.tar.gz linux-37cce22dbd51a3ef7f6c08c3fb5f1c5075a17fbb.zip | |
bpf: verifier: Refactor helper access type tracking
Previously, the verifier was treating all PTR_TO_STACK registers passed
to a helper call as potentially written to by the helper. However, all
calls to check_stack_range_initialized() already have precise access type
information available.
Rather than treat ACCESS_HELPER as a proxy for BPF_WRITE, pass
enum bpf_access_type to check_stack_range_initialized() to more
precisely track helper arguments.
One benefit from this precision is that registers tracked as valid
spills and passed as a read-only helper argument remain tracked after
the call. Rather than being marked STACK_MISC afterwards.
An additional benefit is the verifier logs are also more precise. For
this particular error, users will enjoy a slightly clearer message. See
included selftest updates for examples.
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
Link: https://lore.kernel.org/r/ff885c0e5859e0cd12077c3148ff0754cad4f7ed.1736886479.git.dxu@dxuuu.xyz
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/verifier_basic_stack.c')
| -rw-r--r-- | tools/testing/selftests/bpf/progs/verifier_basic_stack.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/progs/verifier_basic_stack.c b/tools/testing/selftests/bpf/progs/verifier_basic_stack.c index 8d77cc5323d3..fb62e09f2114 100644 --- a/tools/testing/selftests/bpf/progs/verifier_basic_stack.c +++ b/tools/testing/selftests/bpf/progs/verifier_basic_stack.c @@ -28,7 +28,7 @@ __naked void stack_out_of_bounds(void) SEC("socket") __description("uninitialized stack1") __success __log_level(4) __msg("stack depth 8") -__failure_unpriv __msg_unpriv("invalid indirect read from stack") +__failure_unpriv __msg_unpriv("invalid read from stack") __naked void uninitialized_stack1(void) { asm volatile (" \ |
