Behaviour of bpf_core_enum_value with missing value

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

 



Hi Andrii,

The documentation for bpf_core_enum_value says that a missing
enum_value will make the macro return 0:

* 64-bit value, if specified enum type and its enumerator value are
* present in target kernel's BTF;
* 0, if no matching enum and/or enum value within that enum is found.
*/
#define bpf_core_enum_value(enum_type, enum_value)

However, the enumval___err_missing test asserts that
bpf_core_enum_value with a missing value will poison the result if I
understand correctly.

$ sudo ./test_progs -n 31/77 -vvv
...
libbpf: prog 'test_core_enumval': relo #9: kind <enumval_value> (11),
spec is [5] typedef anon_enum::ANON_ENUM_VAL2 = 32
libbpf: prog 'test_core_enumval': relo #9: non-matching candidate #0
[6] typedef anon_enum___err_missing::ANON_ENUM_VAL1___err_missing =
273
libbpf: prog 'test_core_enumval': relo #9: no matching targets found
libbpf: prog 'test_core_enumval': relo #9: substituting insn #48 w/ invalid insn
libbpf: prog 'test_core_enumval': relo #9: substituting insn #47 w/ invalid insn
libbpf: load bpf program failed: Invalid argument

What is the correct behaviour in this case?

Lorenz

-- 
Lorenz Bauer  |  Systems Engineer
6th Floor, County Hall/The Riverside Building, SE1 7PB, UK

www.cloudflare.com



[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