Re: [PATCH bpf-next v4 10/24] bpf: Introduce local kptrs

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

 



On Thu, Nov 3, 2022 at 12:11 PM Kumar Kartikeya Dwivedi
<memxor@xxxxxxxxx> wrote:
>
> Introduce local kptrs, i.e. PTR_TO_BTF_ID that point to a type in
> program BTF. This is indicated by the presence of MEM_TYPE_LOCAL type
> tag in reg->type to avoid having to check btf_is_kernel when trying to
> match argument types in helpers.
...
>
> +       /* MEM is of a type from program BTF, not kernel BTF. This is used to
> +        * tag PTR_TO_BTF_ID allocated using bpf_kptr_alloc.
> +        */
> +       MEM_TYPE_LOCAL          = BIT(11 + BPF_BASE_TYPE_BITS),
> +

I know we have bpf_core_type_id_local.
It sort-of makes sense in the context of the program.
type_id_local -> inside the program
type_id_kernel -> kernel

but in the context of the verifier "local kptr" doesn't read right.
Especially in MEM_TYPE_LOCAL.

Also, since it applies to PTR_TO_BTF_ID, should it prefix with PTR_?
Probably MEM_ is actually cleaner.
And we're not consistent already with MEM_PERCPU.
We can live with this inconsistency for now.

So how about we rename MEM_ALLOC to MEM_RINGBUF,
since it's special bpf_ringbuf_reserve() memory
and use MEM_ALLOC to indicate the memory that came from bpf_obj_new ?

... which made me realize that the comment above should
s/bpf_kptr_alloc/bpf_obj_new/



[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