Skip to content

bpf: fix the crash caused by task iterators over vma

Kui-Feng Lee bpf 2 versions Applied

Status from this message: This series was applied to bpf/bpf.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 2 repliesApplied 2/2
  2. v12 patches 3 repliesSuperseded

Patches in v2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2bpf: keep a reference to the mm, in case the task is dead.kernel/bpf/task_iter.c+27 -120 repliesApplied
2/2selftests/bpf: add a test for iter/task_vma for short-lived processestools/testing/selftests/bpf/prog_tests/bpf_iter.c+73 -00 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchYonghong Song
1/2A-b
2/2A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/2] bpf: fix the crash caused by task iterators over vma

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.

The major changes from v1 are:

- Fix commit logs of the test case.

- Use reverse Christmas tree coding style.

- Remove unnecessary error handling for time().

v1: https://lore.kernel.org/bpf/[email protected]/

Kui-Feng Lee (2):
bpf: keep a reference to the mm, in case the task is dead. selftests/bpf: add a test for iter/task_vma for short-lived processes

 kernel/bpf/task_iter.c                        | 39 +++++++---
 .../selftests/bpf/prog_tests/bpf_iter.c       | 73 +++++++++++++++++++
 2 files changed, 100 insertions(+), 12 deletions(-)
Signature · 1 line
2.30.2