Kui-Feng Lee 7ff94f276f bpf: keep a reference to the mm, in case the task is dead.
Fix the system crash that happens when a task iterator travel through
vma of tasks.

In task iterators, we used to access mm by following the pointer on
the task_struct; however, the death of a task will clear the pointer,
even though we still hold the task_struct.  That can cause an
unexpected crash for a null pointer when an iterator is visiting a
task that dies during the visit.  Keeping a reference of mm on the
iterator ensures we always have a valid pointer to mm.

Co-developed-by: Song Liu <song@kernel.org>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Kui-Feng Lee <kuifeng@meta.com>
Reported-by: Nathan Slingerland <slinger@meta.com>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/r/20221216221855.4122288-2-kuifeng@meta.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2022-12-28 14:11:48 -08:00
..
2022-12-13 19:29:45 -08:00
2022-12-02 11:25:00 +01:00
2022-12-17 14:06:53 -06:00
2022-12-14 12:20:00 -08:00
2022-12-13 14:05:39 -08:00
2022-12-13 19:29:45 -08:00
2022-12-19 07:13:33 -06:00
2022-12-21 07:59:57 -08:00
2022-12-14 12:20:00 -08:00
2022-12-19 07:13:33 -06:00
2022-08-29 19:47:03 -04:00
2022-01-11 13:08:21 -08:00
2022-09-26 10:13:13 -07:00
2022-12-02 13:04:39 -08:00
2022-12-17 14:06:53 -06:00
2022-11-15 00:42:02 -08:00
2022-11-15 00:42:02 -08:00
2022-12-19 12:33:32 -06:00
2022-12-14 12:20:00 -08:00
2022-12-16 03:54:54 -08:00
2022-06-29 13:07:16 +02:00
2022-12-16 03:54:54 -08:00
2022-12-14 12:20:00 -08:00
2022-10-10 12:49:34 -07:00
2022-02-25 09:36:06 +01:00
2022-12-13 19:29:45 -08:00
2022-08-06 16:38:17 -07:00