Re: KCSAN: data-race in exit_signals / prepare_signal
From: Oleg Nesterov
Date: Mon Oct 21 2019 - 09:47:11 EST
On 10/21, Marco Elver wrote:
> On Mon, 21 Oct 2019 at 14:00, Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> > I think this is WONTFIX.
> If taking the spinlock is unnecessary (which AFAIK it probably is) and
> there are no other writers to this flag, you will still need a
> WRITE_ONCE(tsk->flags, tsk->flags | PF_EXITING) to avoid the
Or even WRITE_ONCE(tsk->flags, READ_ONCE(tsk->flags) | PF_EXITING) in
theory. But in practice, I do not think compiler can turn
curent->flags |= PF_EXITING;
into something which temporary clears another flag, say, PF_KTHREAD.
> However, if it is possible that there are concurrent writers setting
> other bits in flags,
No, only current taks should change its ->flags.