OSDN Git Service

bpf, samples: Fix xdpsock with '-M' parameter missing unload process
authorWang Hai <wanghai38@huawei.com>
Mon, 28 Jun 2021 09:18:15 +0000 (17:18 +0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 5 Jul 2021 21:34:18 +0000 (23:34 +0200)
commit2620e92ae6ed83260eb46d214554cd308ee35d92
tree4dc374b79583ced6f1e66fbc7bf2c9b47ab55e44
parent5a0ae9872d5cb5f27590eed168d4b3b144350ed7
bpf, samples: Fix xdpsock with '-M' parameter missing unload process

Execute the following command and exit, then execute it again, the following
error will be reported:

  $ sudo ./samples/bpf/xdpsock -i ens4f2 -M
  ^C
  $ sudo ./samples/bpf/xdpsock -i ens4f2 -M
  libbpf: elf: skipping unrecognized data section(16) .eh_frame
  libbpf: elf: skipping relo section(17) .rel.eh_frame for section(16) .eh_frame
  libbpf: Kernel error message: XDP program already attached
  ERROR: link set xdp fd failed

Commit c9d27c9e8dc7 ("samples: bpf: Do not unload prog within xdpsock") removed
the unloading prog code because of the presence of bpf_link. This is fine if
XDP_SHARED_UMEM is disabled, but if it is enabled, unloading the prog is still
needed.

Fixes: c9d27c9e8dc7 ("samples: bpf: Do not unload prog within xdpsock")
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Magnus Karlsson <magnus.karlsson@intel.com>
Cc: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://lore.kernel.org/bpf/20210628091815.2373487-1-wanghai38@huawei.com
samples/bpf/xdpsock_user.c