Re: [PATCH bpf-next v2 5/6] bpf: allow kind_flag for BTF type and decl tags

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

 



On Mon, Jan 27, 2025 at 3:40 PM Ihor Solodrai <ihor.solodrai@xxxxxxxxx> wrote:
>
> BTF type tags and decl tags now may have info->kflag set to 1,
> changing the semantics of the tag.
>
> Change BTF verification to permit BTF that makes use of this feature:
>   * remove kflag check in btf_decl_tag_check_meta(), as both values
>     are valid
>   * allow kflag to be set for BTF_KIND_TYPE_TAG type in
>     btf_ref_type_check_meta()
>
> Make sure kind_flag is NOT set when checking for specific BTF tags,
> such as "kptr", "user" etc.
>
> Modify a selftest checking for kflag in decl_tag accordingly.
>
> Signed-off-by: Ihor Solodrai <ihor.solodrai@xxxxxxxxx>
> ---
>  kernel/bpf/btf.c                             | 26 +++++++++-----------
>  tools/testing/selftests/bpf/prog_tests/btf.c |  4 +--
>  2 files changed, 13 insertions(+), 17 deletions(-)
>
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 8396ce1d0fba..98919c6b6b87 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -2575,7 +2575,7 @@ static int btf_ref_type_check_meta(struct btf_verifier_env *env,
>                 return -EINVAL;
>         }
>
> -       if (btf_type_kflag(t)) {
> +       if (btf_type_kflag(t) && BTF_INFO_KIND(t->info) != BTF_KIND_TYPE_TAG) {

nit: use btf_type_is_type_tag(t) ?


[...]





[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