Re: [PATCH bpf-next v2 1/4] bpf: verifier: make kfuncs args nullalble

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2024-05-10 at 05:28 -0700, Vadim Fedorenko wrote:
> Some arguments to kfuncs might be NULL in some cases. But currently it's
> not possible to pass NULL to any BTF structures because the check for
> the suffix is located after all type checks. Move it to earlier place
> to allow nullable args.
> 
> Signed-off-by: Vadim Fedorenko <vadfed@xxxxxxxx>
> ---

Acked-by: Eduard Zingerman <eddyz87@xxxxxxxxx>

>  kernel/bpf/verifier.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 9e3aba08984e..ed67aed3c284 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -11179,6 +11179,9 @@ get_kfunc_ptr_arg_type(struct bpf_verifier_env *env,
>  	if (btf_is_prog_ctx_type(&env->log, meta->btf, t, resolve_prog_type(env->prog), argno))
>  		return KF_ARG_PTR_TO_CTX;
>  
> +	if (is_kfunc_arg_nullable(meta->btf, &args[argno]) && register_is_null(reg))
> +		return KF_ARG_PTR_TO_NULL;
> +

Nit: maybe move this above the KF_ARG_PTR_TO_CTX check as well?





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux