]> git.baikalelectronics.ru Git - kernel.git/commit
sched: Update task_tick_numa to ignore tasks without an mm
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 11 May 2022 17:16:21 +0000 (12:16 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Wed, 11 May 2022 17:41:48 +0000 (12:41 -0500)
commit13bacc93ce61e4c1b349cb74bc8c46d06fbcbd18
tree1cc0cb57ee6ae02300d86f0325a7bff50dfae479
parentc06c5789d32d69aea02a74dbc99765867748b956
sched: Update task_tick_numa to ignore tasks without an mm

Qian Cai <quic_qiancai@quicinc.com> wrote:
> Reverting the last 3 commits of the series fixed a boot crash.
>
c06c5789d32d fork: Stop allowing kthreads to call execve
5fdb8c053e9d fork: Explicitly set PF_KTHREAD
144140f5c57e init: Deal with the init process being a user mode process
>
>  BUG: KASAN: null-ptr-deref in task_nr_scan_windows.isra.0
>  arch_atomic_long_read at ./include/linux/atomic/atomic-long.h:29
>  (inlined by) atomic_long_read at ./include/linux/atomic/atomic-instrumented.h:1266
>  (inlined by) get_mm_counter at ./include/linux/mm.h:1996
>  (inlined by) get_mm_rss at ./include/linux/mm.h:2049
>  (inlined by) task_nr_scan_windows at kernel/sched/fair.c:1123
>  Read of size 8 at addr 00000000000003d0 by task swapper/0/1

With the change to init and the user mode helper processes to not have
PF_KTHREAD set before they call kernel_execve the PF_KTHREAD test in
task_tick_numa became insufficient to detect all tasks that have
"->mm == NULL".  Correct that by testing for "->mm == NULL" directly.

Reported-by: Qian Cai <quic_qiancai@quicinc.com>
Tested-by: Qian Cai <quic_qiancai@quicinc.com>
Fixes: c06c5789d32d ("fork: Stop allowing kthreads to call execve")
Link: https://lkml.kernel.org/r/87r150ug1l.fsf_-_@email.froward.int.ebiederm.org
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
kernel/sched/fair.c