[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YJPwi0FSObIjOSd7@hirez.programming.kicks-ass.net>
Date: Thu, 6 May 2021 15:35:07 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: kvm@...r.kernel.org, Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>, x86@...nel.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: KVM: x86: Prevent deadlock against tk_core.seq
On Thu, May 06, 2021 at 03:21:37PM +0200, Thomas Gleixner wrote:
> syzbot reported a possible deadlock in pvclock_gtod_notify():
>
> CPU 0 CPU 1
> write_seqcount_begin(&tk_core.seq);
> pvclock_gtod_notify() spin_lock(&pool->lock);
> queue_work(..., &pvclock_gtod_work) ktime_get()
> spin_lock(&pool->lock); do {
> seq = read_seqcount_begin(tk_core.seq)
> ...
> } while (read_seqcount_retry(&tk_core.seq, seq);
>
> While this is unlikely to happen, it's possible.
>
> Delegate queue_work() to irq_work() which postpones it until the
> tk_core.seq write held region is left and interrupts are reenabled.
>
> Fixes: 16e8d74d2da9 ("KVM: x86: notifier for clocksource changes")
> Reported-by: syzbot+6beae4000559d41d80f8@...kaller.appspotmail.com
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Powered by blists - more mailing lists