The patch titled Subject: kernel/fork.c: annotate data races for copy_process has been added to the -mm tree. Its filename is kernel-forkc-annotate-data-races-for-copy_process.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kernel-forkc-annotate-data-races-for-copy_process.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kernel-forkc-annotate-data-races-for-copy_process.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Weilong Chen <chenweilong@xxxxxxxxxx> Subject: kernel/fork.c: annotate data races for copy_process The check is only there to stop root fork bombs. BUG: KCSAN: data-race in copy_process / copy_process write to 0xffffffff86f87d20 of 4 bytes by task 7121 on cpu 5: copy_process+0x2e1a/0x3af0 kernel/fork.c:2285 _do_fork+0xf7/0x790 kernel/fork.c:2430 __do_sys_clone+0xf9/0x130 kernel/fork.c:2585 __se_sys_clone kernel/fork.c:2566 [inline] __x64_sys_clone+0x6c/0x80 kernel/fork.c:2566 do_syscall_64+0xc7/0x3b0 arch/x86/entry/common.c:295 entry_SYSCALL_64_after_hwframe+0x44/0xa9 read to 0xffffffff86f87d20 of 4 bytes by task 7125 on cpu 3: copy_process+0x9eb/0x3af0 kernel/fork.c:1967 _do_fork+0xf7/0x790 kernel/fork.c:2430 __do_sys_clone+0xf9/0x130 kernel/fork.c:2585 __se_sys_clone kernel/fork.c:2566 [inline] __x64_sys_clone+0x6c/0x80 kernel/fork.c:2566 do_syscall_64+0xc7/0x3b0 arch/x86/entry/common.c:295 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Link: http://lkml.kernel.org/r/20200609030801.272704-1-chenweilong@xxxxxxxxxx Signed-off-by: Weilong Chen <chenweilong@xxxxxxxxxx> Cc: Qian Cai <cai@xxxxxx> Cc: Marco Elver <elver@xxxxxxxxxx> Cc: Christian Brauner <christian.brauner@xxxxxxxxxx> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Zefan Li <lizefan@xxxxxxxxxx> Cc: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: "Paul E. McKenney" <paulmck@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/fork.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/fork.c~kernel-forkc-annotate-data-races-for-copy_process +++ a/kernel/fork.c @@ -1976,7 +1976,7 @@ static __latent_entropy struct task_stru * to stop root fork bombs. */ retval = -EAGAIN; - if (nr_threads >= max_threads) + if (data_race(nr_threads >= max_threads)) goto bad_fork_cleanup_count; delayacct_tsk_init(p); /* Must remain after dup_task_struct() */ _ Patches currently in -mm which might be from chenweilong@xxxxxxxxxx are kernel-forkc-annotate-data-races-for-copy_process.patch