]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Add "bool skipped" to struct bpf_map
authorShuyi Cheng <chengshuyi@linux.alibaba.com>
Fri, 10 Dec 2021 09:39:57 +0000 (17:39 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 10 Dec 2021 23:35:30 +0000 (15:35 -0800)
commit5c358f829610b54a052d8e58f44ed2d63edd982e
tree54b31b2a70c4005f4a518210ed3af727a61bc422
parentc44e06db2db4245c4e1919dd55fdb55d63d05730
libbpf: Add "bool skipped" to struct bpf_map

Fix error: "failed to pin map: Bad file descriptor, path:
/sys/fs/bpf/_rodata_str1_1."

In the old kernel, the global data map will not be created, see [0]. So
we should skip the pinning of the global data map to avoid
bpf_object__pin_maps returning error. Therefore, when the map is not
created, we mark “map->skipped" as true and then check during relocation
and during pinning.

Fixes: 81a57e2fd6f7 ("libbpf: Load global data maps lazily on legacy kernels")
Signed-off-by: Shuyi Cheng <chengshuyi@linux.alibaba.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
tools/lib/bpf/libbpf.c