Re: [PATCH bpf-next v4 16/18] selftests/bpf: Add a test for enum64 value relocations

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

 



On Fri, Jun 3, 2022 at 1:22 PM Andrii Nakryiko
<andrii.nakryiko@xxxxxxxxx> wrote:
>
> On Fri, Jun 3, 2022 at 8:14 AM Alexei Starovoitov
> <alexei.starovoitov@xxxxxxxxx> wrote:
> >
> > On Fri, Jun 3, 2022 at 4:00 AM Yonghong Song <yhs@xxxxxx> wrote:
> > > +
> > > +SEC("raw_tracepoint/sys_enter")
> > > +int test_core_enum64val(void *ctx)
> > > +{
> > > +#if __has_builtin(__builtin_preserve_enum_value)
> > > +       struct core_reloc_enum64val_output *out = (void *)&data.out;
> > > +       enum named_unsigned_enum64 named_unsigned = 0;
> > > +       enum named_signed_enum64 named_signed = 0;
> >
> > libbpf: prog 'test_core_enum64val': relo #0: unexpected insn #0
> > (LDIMM64) value: got 8589934591, exp 18446744073709551615 ->
> > 18446744073709551615
> > libbpf: prog 'test_core_enum64val': relo #0: failed to patch insn #0: -22
> > libbpf: failed to perform CO-RE relocations: -22
> > libbpf: failed to load object 'test_core_reloc_enum64val.o'
> >
> > Is it failing in CI because clang is too old?
>
> Hm... doesn't seem so. I pulled Yonghong's patches locally, built the
> very latest Clang, rebuilt selftests from scratch and I get the same
> error.
>
> Yonghong, do you get the same error in your setup? If not, what am I
> missing in mine?

and confirming that Clang doesn't generate ENUM64:


$ tools/build/bpftool/bootstrap/bpftool btf dump file
btf__core_reloc_enum64val___diff.o
[1] INT 'long' size=8 bits_offset=0 nr_bits=64 encoding=SIGNED
[2] FUNC_PROTO '(anon)' ret_type_id=0 vlen=1
        'x' type_id=1
[3] FUNC 'preserce_ptr_sz_fn' type_id=2 linkage=global
[4] STRUCT 'core_reloc_enum64val___diff' size=16 vlen=2
        'f1' type_id=5 bits_offset=0
        'f2' type_id=6 bits_offset=64
[5] ENUM 'named_unsigned_enum64___diff' encoding=UNSIGNED size=8 vlen=3
        'UNSIGNED_ENUM64_VAL1___diff' val=4294967295
        'UNSIGNED_ENUM64_VAL2___diff' val=4294967295
        'UNSIGNED_ENUM64_VAL3___diff' val=4294967295
[6] ENUM 'named_signed_enum64___diff' encoding=UNSIGNED size=4 vlen=3
        'SIGNED_ENUM64_VAL1___diff' val=4294967195
        'SIGNED_ENUM64_VAL2___diff' val=4294967094
        'SIGNED_ENUM64_VAL3___diff' val=4294966993
[7] FUNC_PROTO '(anon)' ret_type_id=0 vlen=1
        'x' type_id=4
[8] FUNC 'f' type_id=7 linkage=global


>
>
> > CI will pick up newer clang sooner or later,
> > but the users will be confused.
> > The patch 17/18 that updates README certainly helps,
> > but I was wondering whether we can do a similar trick
> > to what Andrii did in libbpf and make the error more human readable?



[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