NetBpfLoad: Fail boot if BTF load fails on 4.19+
libbpf ignores BTF load error but this causes boot failure only when BTF is required for some reasons (e.g. SK_STORAGE). This CL makes boot fails regardless of the necessity of BTF on 4.19+ kernel Test: boot kernel on 4.14, 4.19, 5.10, 6.1 Flag: EXEMPT mainline Change-Id: I0af1e7eedcbea803c22c064ff157700a01307691
This commit is contained in:
parent
896a0f15e1
commit
8f3cfccf27
1 changed files with 2 additions and 0 deletions
|
|
@ -1316,6 +1316,8 @@ static int loadProgByLibbpf(const char* const elfPath, const unsigned int bpfloa
|
|||
|
||||
ret = bpf_object__load(obj);
|
||||
if (ret) return ret;
|
||||
// On Linux Kernels older than 4.18 BPF_BTF_LOAD command doesn't exist.
|
||||
if (isAtLeastKernelVersion(4, 19, 0) && bpf_object__btf_fd(obj) < 0) return -1;
|
||||
|
||||
ret = pinMaps(obj, md);
|
||||
if (ret) return ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue