bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/2] bpf: fix the crash caused by task iterators over vma
@ 2022-12-16 22:18 Kui-Feng Lee
  2022-12-16 22:18 ` [PATCH bpf-next v2 1/2] bpf: keep a reference to the mm, in case the task is dead Kui-Feng Lee
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Kui-Feng Lee @ 2022-12-16 22:18 UTC (permalink / raw)
  To: bpf, ast, andrii, kernel-team, song, yhs; +Cc: Kui-Feng Lee

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/20221216015912.991616-1-kuifeng@meta.com/

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(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-04 21:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-16 22:18 [PATCH bpf-next v2 0/2] bpf: fix the crash caused by task iterators over vma Kui-Feng Lee
2022-12-16 22:18 ` [PATCH bpf-next v2 1/2] bpf: keep a reference to the mm, in case the task is dead Kui-Feng Lee
2022-12-16 22:18 ` [PATCH bpf-next v2 2/2] selftests/bpf: add a test for iter/task_vma for short-lived processes Kui-Feng Lee
2022-12-28 22:20 ` [PATCH bpf-next v2 0/2] bpf: fix the crash caused by task iterators over vma patchwork-bot+netdevbpf
2023-01-04 21:16 ` Kui-Feng Lee
2023-01-04 21:21   ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).