Message ID | 20210913155200.3728013-1-yhs@fb.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | BPF |
Headers | show |
Series | bpf: add support for new btf kind BTF_KIND_TAG | expand |
On Mon, Sep 13, 2021 at 8:52 AM Yonghong Song <yhs@fb.com> wrote: > > BTF_KIND_TAG ELF format has a component_idx which might have value -1. > test_btf may confuse it with common_type.name as NAME_NTH checkes > high 16bit to be 0xffff. Change NAME_NTH high 16bit check to be > 0xfffe so it won't confuse with component_idx. > > Signed-off-by: Yonghong Song <yhs@fb.com> > --- Acked-by: Andrii Nakryiko <andrii@kernel.org> > tools/testing/selftests/bpf/prog_tests/btf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/bpf/prog_tests/btf.c b/tools/testing/selftests/bpf/prog_tests/btf.c > index 649f87382c8d..ad39f4d588d0 100644 > --- a/tools/testing/selftests/bpf/prog_tests/btf.c > +++ b/tools/testing/selftests/bpf/prog_tests/btf.c > @@ -39,8 +39,8 @@ static bool always_log; > #define BTF_END_RAW 0xdeadbeef > #define NAME_TBD 0xdeadb33f > > -#define NAME_NTH(N) (0xffff0000 | N) > -#define IS_NAME_NTH(X) ((X & 0xffff0000) == 0xffff0000) > +#define NAME_NTH(N) (0xfffe0000 | N) > +#define IS_NAME_NTH(X) ((X & 0xffff0000) == 0xfffe0000) > #define GET_NAME_NTH_IDX(X) (X & 0x0000ffff) > > #define MAX_NR_RAW_U32 1024 > -- > 2.30.2 >
diff --git a/tools/testing/selftests/bpf/prog_tests/btf.c b/tools/testing/selftests/bpf/prog_tests/btf.c index 649f87382c8d..ad39f4d588d0 100644 --- a/tools/testing/selftests/bpf/prog_tests/btf.c +++ b/tools/testing/selftests/bpf/prog_tests/btf.c @@ -39,8 +39,8 @@ static bool always_log; #define BTF_END_RAW 0xdeadbeef #define NAME_TBD 0xdeadb33f -#define NAME_NTH(N) (0xffff0000 | N) -#define IS_NAME_NTH(X) ((X & 0xffff0000) == 0xffff0000) +#define NAME_NTH(N) (0xfffe0000 | N) +#define IS_NAME_NTH(X) ((X & 0xffff0000) == 0xfffe0000) #define GET_NAME_NTH_IDX(X) (X & 0x0000ffff) #define MAX_NR_RAW_U32 1024
BTF_KIND_TAG ELF format has a component_idx which might have value -1. test_btf may confuse it with common_type.name as NAME_NTH checkes high 16bit to be 0xffff. Change NAME_NTH high 16bit check to be 0xfffe so it won't confuse with component_idx. Signed-off-by: Yonghong Song <yhs@fb.com> --- tools/testing/selftests/bpf/prog_tests/btf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)