mbox series

[bpf-next,0/2] bpf: fix the crash caused by task iterators over vma

Message ID 20221216015912.991616-1-kuifeng@meta.com (mailing list archive)
Headers show
Series bpf: fix the crash caused by task iterators over vma | expand

Message

Kui-Feng Lee Dec. 16, 2022, 1:59 a.m. UTC
This issue is related to task iterators over vma. A system crash can
occur when a task iterator travels through vma of tasks as the death
of a task will clear the pointer to its mm, even though the
task_struct is still held. As a result, an unexpected crash happens
due to a null pointer. To address this problem, a reference to mm is
kept on the iterator to make sure that the pointer is always
valid. This patch set provides a solution for this crash by properly
referencing mm on task iterators over vma.

Kui-Feng Lee (2):
  bpf: keep a reference to the mm, in case the task is dead.
  selftests/bpf: create new processes repeatedly in the background.

 kernel/bpf/task_iter.c                        | 39 ++++++---
 .../selftests/bpf/prog_tests/bpf_iter.c       | 79 +++++++++++++++++++
 2 files changed, 106 insertions(+), 12 deletions(-)