Re: [PATCH bpf-next v4 2/5] selftests/bpf: allow BTF specs and func infos in test_verifier tests

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

 



On Wed, Jun 8, 2022 at 12:27 PM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote:
>
> The BTF and func_info specification for test_verifier tests follows
> the same notation as in prog_tests/btf.c tests. E.g.:
>
>   ...
>   .func_info = { { 0, 6 }, { 8, 7 } },
>   .func_info_cnt = 2,
>   .btf_strings = "\0int\0",
>   .btf_types = {
>     BTF_TYPE_INT_ENC(1, BTF_INT_SIGNED, 0, 32, 4),
>     BTF_PTR_ENC(1),
>   },
>   ...
>
> The BTF specification is loaded only when specified.
>
> Signed-off-by: Eduard Zingerman <eddyz87@xxxxxxxxx>
[...]
> +
> +static int load_btf_for_test(struct bpf_test *test)
> +{
> +       int types_num = 0;
> +
> +       while (types_num < MAX_BTF_TYPES &&
> +              test->btf_types[types_num] != BTF_END_RAW)
> +               ++types_num;
> +
> +       int types_len = types_num * sizeof(test->btf_types[0]);
> +
> +       return load_btf_spec(test->btf_types, types_len,
> +                            test->btf_strings, sizeof(test->btf_strings));

IIUC, strings_len is always 256. Is this expected?

Thanks,
Song

>  }
>
>  static int create_map_spin_lock(void)
> @@ -793,8 +839,6 @@ static int create_map_kptr(void)
>         return fd;
>  }
[...]



[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