mbox series

[bpf-next,0/3] bpf: Fix an issue in bpf_iter_task

Message ID 20240208090906.56337-1-laoar.shao@gmail.com (mailing list archive)
Headers show
Series bpf: Fix an issue in bpf_iter_task | expand

Message

Yafang Shao Feb. 8, 2024, 9:09 a.m. UTC
The uninitialized bpf_iter_task variable poses a risk of triggering a
kernel panic. To fix this potential issue, it's imperative to ensure proper
initialization of the variable. This problem surfaced during the
implementation phase of the bits iterator [0]. 

[0]. https://lwn.net/ml/bpf/CALOAHbDJWHOB+viBz6SUqdeF+Nkxmh4gLZo5Ad_keQXjBWHAsQ@mail.gmail.com 

Yafang Shao (3):
  bpf: Fix an issue due to uninitialized bpf_iter_task
  selftests/bpf: Add negtive test cases for task iter
  libbpf: Check the return value of bpf_iter_<type>_new()

 kernel/bpf/task_iter.c                         |  2 ++
 tools/lib/bpf/bpf_helpers.h                    | 16 ++++++++++++----
 tools/testing/selftests/bpf/prog_tests/iters.c |  1 +
 tools/testing/selftests/bpf/progs/iters_task.c | 12 +++++++++++-
 4 files changed, 26 insertions(+), 5 deletions(-)