diff options
author | Kumar Kartikeya Dwivedi <memxor@gmail.com> | 2022-03-05 04:16:38 +0530 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-03-05 15:29:35 -0800 |
commit | 25b35dd28138f61f9a0fb8b76c0483761fd228bd (patch) | |
tree | 5d346c1c9f6d9a89f9f3069c777f67979767c611 /include | |
parent | caec549534823d8d0fad43ab6753fd03ddb1c456 (diff) | |
download | lwn-25b35dd28138f61f9a0fb8b76c0483761fd228bd.tar.gz lwn-25b35dd28138f61f9a0fb8b76c0483761fd228bd.zip |
bpf: Add check_func_arg_reg_off function
Lift the list of register types allowed for having fixed and variable
offsets when passed as helper function arguments into a common helper,
so that they can be reused for kfunc checks in later commits. Keeping a
common helper aids maintainability and allows us to follow the same
consistent rules across helpers and kfuncs. Also, convert check_func_arg
to use this function.
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220304224645.3677453-2-memxor@gmail.com
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/bpf_verifier.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index 7a7be8c057f2..38b24ee8d8c2 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@ -521,6 +521,9 @@ bpf_prog_offload_remove_insns(struct bpf_verifier_env *env, u32 off, u32 cnt); int check_ptr_off_reg(struct bpf_verifier_env *env, const struct bpf_reg_state *reg, int regno); +int check_func_arg_reg_off(struct bpf_verifier_env *env, + const struct bpf_reg_state *reg, int regno, + enum bpf_arg_type arg_type); int check_kfunc_mem_size_reg(struct bpf_verifier_env *env, struct bpf_reg_state *reg, u32 regno); int check_mem_reg(struct bpf_verifier_env *env, struct bpf_reg_state *reg, |