[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220215121250.GA15119@redhat.com>
Date: Tue, 15 Feb 2022 13:12:50 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: Paul Menzel <pmenzel@...gen.mpg.de>,
"Theodore Y. Ts'o" <tytso@....edu>,
LKML <linux-kernel@...r.kernel.org>,
Dominik Brodowski <linux@...inikbrodowski.net>,
Jann Horn <jannh@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Marco Elver <elver@...gle.com>,
Nicolas Pitre <nico@...xnic.net>,
Rik van Riel <riel@...hat.com>
Subject: Re: BUG: KCSAN: data-race in add_device_randomness+0x20d/0x290
On 02/15, Jason A. Donenfeld wrote:
>
> void release_task(struct task_struct *p)
> {
> [...]
> cgroup_release(p);
>
> write_lock_irq(&tasklist_lock);
> ptrace_release_task(p);
> thread_pid = get_pid(p->thread_pid);
> __exit_signal(p);
> [...]
> }
> static void __exit_signal(struct task_struct *tsk)
> {
> [...]
> add_device_randomness((const void*) &tsk->se.sum_exec_runtime,
> sizeof(unsigned long long));
> [...]
> }
>
> Apparently the data that is being read by add_device_randomness() is
> being modified while it's being read. This would be whatever is in
> `tsk->se.sum_exec_runtime`.
>
> I'm not sure what's happening there, if this is "normal" and the task
> can be scheduled out while exiting, causing the schedule to add to
> sum_exec_runtime, or what.
Yes, this is normal.
The parent can call release_task(child) right after the child has passed
exit_notify(), the exiting child still runs and can be scheduled out until
it does the last schedule from do_task_dead().
Oleg.
Powered by blists - more mailing lists