]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, libbpf: Add kernel version section parsing back
authorJohn Fastabend <john.fastabend@gmail.com>
Fri, 18 Oct 2019 14:41:26 +0000 (07:41 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 18 Oct 2019 18:59:10 +0000 (20:59 +0200)
commit95ab8d93e1cc89acac9967b4f78e45afdfb5b8ba
treee517117cf0d42f411d157ae982ef736059dcf891
parentd2062788a300120dcb68e8131e364317ab9b48f3
bpf, libbpf: Add kernel version section parsing back

With commit "libbpf: stop enforcing kern_version,..." we removed the
kernel version section parsing in favor of querying for the kernel
using uname() and populating the version using the result of the
query. After this any version sections were simply ignored.

Unfortunately, the world of kernels is not so friendly. I've found some
customized kernels where uname() does not match the in kernel version.
To fix this so programs can load in this environment this patch adds
back parsing the section and if it exists uses the user specified
kernel version to override the uname() result. However, keep most the
kernel uname() discovery bits so users are not required to insert the
version except in these odd cases.

Fixes: d23bba12f976d ("libbpf: stop enforcing kern_version, populate it for users")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/157140968634.9073.6407090804163937103.stgit@john-XPS-13-9370
tools/lib/bpf/libbpf.c