[PATCH v16 04/12] bpf: Export bpf_dynptr_get_size()

Hou Tao houtao1 at huawei.com
Tue Sep 6 03:06:48 UTC 2022


Hi,

On 9/5/2022 10:33 PM, Roberto Sassu wrote:
> From: Roberto Sassu <roberto.sassu at huawei.com>
>
> Export bpf_dynptr_get_size(), so that kernel code dealing with eBPF dynamic
> pointers can obtain the real size of data carried by this data structure.
>
> Signed-off-by: Roberto Sassu <roberto.sassu at huawei.com>
> Reviewed-by: Joanne Koong <joannelkoong at gmail.com>
> Acked-by: KP Singh <kpsingh at kernel.org>
> ---
>  include/linux/bpf.h  | 1 +
>  kernel/bpf/helpers.c | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
SNIP
> diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
> index fc08035f14ed..824864ac82d1 100644
> --- a/kernel/bpf/helpers.c
> +++ b/kernel/bpf/helpers.c
> @@ -1408,7 +1408,7 @@ static void bpf_dynptr_set_type(struct bpf_dynptr_kern *ptr, enum bpf_dynptr_typ
>  	ptr->size |= type << DYNPTR_TYPE_SHIFT;
>  }
>  
> -static u32 bpf_dynptr_get_size(struct bpf_dynptr_kern *ptr)
> +u32 bpf_dynptr_get_size(struct bpf_dynptr_kern *ptr)
>  {
>  	return ptr->size & DYNPTR_SIZE_MASK;
>  }
qp-trie also need it. But considering bpf_dynptr_get_size() is just one line,
Would moving it and the related definitions into bpf.h be a better choice ?




More information about the Linux-security-module-archive mailing list