libbpf: Support pre-initializing .bss global variables
authorAndrii Nakryiko <andriin@fb.com>
Fri, 12 Jun 2020 19:45:04 +0000 (12:45 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:49:11 +0000 (17:49 +0200)
commit845357b602f6f2e0e3b47425e8764947460c7aa2
treefb7503c73634507335dcb24d71c89ffd7b86ae67
parent14b3a7fef8d6b37315de543dc2122939cbd0066f
libbpf: Support pre-initializing .bss global variables

[ Upstream commit caf62492f479585296e9d636c798d5ac256b7b04 ]

Remove invalid assumption in libbpf that .bss map doesn't have to be updated
in kernel. With addition of skeleton and memory-mapped initialization image,
.bss doesn't have to be all zeroes when BPF map is created, because user-code
might have initialized those variables from user-space.

Fixes: eba9c5f498a1 ("libbpf: Refactor global data map initialization")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200612194504.557844-1-andriin@fb.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/lib/bpf/libbpf.c
tools/testing/selftests/bpf/prog_tests/skeleton.c
tools/testing/selftests/bpf/progs/test_skeleton.c