Re: [PATCH v1 bpf-next 6/9] bpf: Make bpf_refcount_acquire fallible for non-owning refs

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

 



On Wed, May 03, 2023 at 10:33:35PM -0700, Dave Marchevsky wrote:
> @@ -298,8 +298,11 @@ struct bpf_kfunc_call_arg_meta {
>  	} arg_constant;
>  	union {
>  		struct btf_and_id arg_obj_drop;
> -		struct btf_and_id arg_refcount_acquire;
>  		struct btf_and_id arg_graph_node;
> +		struct {
> +			struct btf_and_id btf_and_id;
> +			bool owning_ref;
> +		} arg_refcount_acquire;
...
>  
> -			meta->arg_refcount_acquire.btf = reg->btf;
> -			meta->arg_refcount_acquire.btf_id = reg->btf_id;
> +			meta->arg_refcount_acquire.btf_and_id.btf = reg->btf;
> +			meta->arg_refcount_acquire.btf_and_id.btf_id = reg->btf_id;

I wasn't excited about patch 2, but this one is taking it too far.
Let's just get rid of this union and struct btf_and_id and all arg*.
Just add
 struct btf *arg_btf;
 u32 arg_btf_id;
 bool arg_owning_ref;
to bpf_kfunc_call_arg_meta and use them in all cases.
arg_refcount_acquire vs arg_graph_node difference doesn't give us readability or bug-proofing.




[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