diff options
| author | Eduard Zingerman <eddyz87@gmail.com> | 2026-10-09 03:47:20 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-10-09 20:29:12 +0000 |
| commit | 830e4372de5c8e1e0bbea925e74717b8fc259dfd (patch) | |
| tree | 5ccbe0e302b19c88401e10785a11c4ac939837c5 /include | |
| parent | 5b6beb95f7b4bde8333c588543a2400e52805cba (diff) | |
| download | linux-next-830e4372de5c8e1e0bbea925e74717b8fc259dfd.tar.gz linux-next-830e4372de5c8e1e0bbea925e74717b8fc259dfd.zip | |
bpf: Describe helper stack accesses with arg_access_info
Adjust bpf_helper_stack_access_bytes() to return results as a struct
arg_access_info. The result is based on bpf_func_proto->argX_type
value as in the following table:
| Argument flags | allow_uninit_stack | Meaning |
|----------------------+--------------------+----------------------|
| MEM_WRITE | true | may_read, must_write |
| MEM_WRITE+MEM_UNINIT | true | must_write |
| MEM_WRITE | false | may_read, must_write |
| MEM_WRITE+MEM_UNINIT | false | may_read, may_write |
| 0 | true/false | may_read |
MEM_WRITE now produces must_write when allow_uninit_stack is true:
the verifier discards previous stack knowledge over the affected
range. Previously, liveness only treated MEM_UNINIT this way.
Also use resolve_map_arg_type() to account for bpf_map_peek_elem()
treating its buffer as an input for bloom filters.
Annotate ringbuf dynptr submit and discard arguments with MEM_WRITE.
Their existing OBJ_RELEASE handling already invalidates the dynptr, but
the prototypes need to describe the write as well as the release.
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261009-scev-minimal-rebase-v3-2-bcba9bc53ac9@gmail.com
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/bpf_verifier.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index d4f32acba236..5c99c024c309 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@ -1731,9 +1731,9 @@ struct arg_access_info { u8 must_write:1; /* Prior verifier state is destroyed throughout size. */ }; -s64 bpf_helper_stack_access_bytes(struct bpf_verifier_env *env, - struct bpf_insn *insn, int arg, - int insn_idx); +struct arg_access_info +bpf_helper_stack_access_bytes(struct bpf_verifier_env *env, + struct bpf_insn *insn, int arg, int insn_idx); s64 bpf_kfunc_stack_access_bytes(struct bpf_verifier_env *env, struct bpf_insn *insn, int arg, int insn_idx); |
