mbox series

[bpf-next,0/2] Fix release of struct_ops map

Message ID 20241108082633.2338543-1-xukuohai@huaweicloud.com (mailing list archive)
Headers show
Series Fix release of struct_ops map | expand

Message

Xu Kuohai Nov. 8, 2024, 8:26 a.m. UTC
From: Xu Kuohai <xukuohai@huawei.com>

This series fix a bug I found when doing rcu waiting cleanup for struct_ops
map. When there is sleepable prog in struct_ops map, the map risks being
released while the prog is still running.

Xu Kuohai (2):
  bpf: Fix release of struct_ops map
  selftests/bpf: Add test for struct_ops map release

 kernel/bpf/bpf_struct_ops.c                   |  37 +++--
 kernel/bpf/syscall.c                          |   7 +-
 .../selftests/bpf/bpf_testmod/bpf_testmod.c   |  78 ++++++---
 .../bpf/bpf_testmod/bpf_testmod_kfunc.h       |   2 +-
 .../bpf/prog_tests/test_struct_ops_module.c   | 154 ++++++++++++++++++
 .../bpf/progs/struct_ops_map_release.c        |  30 ++++
 6 files changed, 267 insertions(+), 41 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/progs/struct_ops_map_release.c