Skip to content

Commit 4060909

Browse files
eddyz87Alexei Starovoitov
authored andcommitted
bpf: allow bpf_fastcall for bpf_cast_to_kern_ctx and bpf_rdonly_cast
do_misc_fixups() relaces bpf_cast_to_kern_ctx() and bpf_rdonly_cast() by a single instruction "r0 = r1". This follows bpf_fastcall contract. This commit allows bpf_fastcall pattern rewrite for these two functions in order to use them in bpf_fastcall selftests. Acked-by: Yonghong Song <[email protected]> Signed-off-by: Eduard Zingerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent b2ee6d2 commit 4060909

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/bpf/verifier.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16170,6 +16170,9 @@ static u32 kfunc_fastcall_clobber_mask(struct bpf_kfunc_call_arg_meta *meta)
1617016170
/* Same as verifier_inlines_helper_call() but for kfuncs, see comment above */
1617116171
static bool is_fastcall_kfunc_call(struct bpf_kfunc_call_arg_meta *meta)
1617216172
{
16173+
if (meta->btf == btf_vmlinux)
16174+
return meta->func_id == special_kfunc_list[KF_bpf_cast_to_kern_ctx] ||
16175+
meta->func_id == special_kfunc_list[KF_bpf_rdonly_cast];
1617316176
return false;
1617416177
}
1617516178

0 commit comments

Comments
 (0)