From: Oleg Nesterov <oleg@redhat.com>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Paul Menzel <pmenzel@molgen.mpg.de>,
"Theodore Y. Ts'o" <tytso@mit.edu>,
LKML <linux-kernel@vger.kernel.org>,
Dominik Brodowski <linux@dominikbrodowski.net>,
Jann Horn <jannh@google.com>, Dmitry Vyukov <dvyukov@google.com>,
Marco Elver <elver@google.com>, Nicolas Pitre <nico@fluxnic.net>,
Rik van Riel <riel@redhat.com>
Subject: Re: BUG: KCSAN: data-race in add_device_randomness+0x20d/0x290
Date: Tue, 15 Feb 2022 13:12:50 +0100 [thread overview]
Message-ID: <20220215121250.GA15119@redhat.com> (raw)
In-Reply-To: <CAHmME9rgBJx+-wy-_GXPRMYEuTNyaa7SAr+nVOPh-Am2k6A2CA@mail.gmail.com>
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.
prev parent reply other threads:[~2022-02-15 12:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-07 16:14 BUG: KCSAN: data-race in add_device_randomness+0x20d/0x290 Paul Menzel
2022-02-07 18:42 ` Jason A. Donenfeld
2022-02-07 21:45 ` Jann Horn
2022-02-07 21:50 ` Jann Horn
2022-02-07 21:53 ` Jann Horn
2022-02-07 21:57 ` Jason A. Donenfeld
2022-02-07 22:20 ` Jason A. Donenfeld
2022-02-07 21:49 ` Jann Horn
2022-02-08 0:10 ` Marco Elver
2022-02-08 0:12 ` Marco Elver
2022-02-08 0:36 ` Jason A. Donenfeld
2022-02-08 9:23 ` Marco Elver
2022-02-15 9:16 ` Paul Menzel
2022-02-15 11:44 ` Jason A. Donenfeld
2022-02-15 12:12 ` Oleg Nesterov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220215121250.GA15119@redhat.com \
--to=oleg@redhat.com \
--cc=Jason@zx2c4.com \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=nico@fluxnic.net \
--cc=pmenzel@molgen.mpg.de \
--cc=riel@redhat.com \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox