From: Peter Zijlstra <peterz@infradead.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <seanjc@google.com>,
x86@kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: KVM: x86: Prevent deadlock against tk_core.seq
Date: Thu, 6 May 2021 15:35:07 +0200 [thread overview]
Message-ID: <YJPwi0FSObIjOSd7@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <87h7jgm1zy.ffs@nanos.tec.linutronix.de>
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@syzkaller.appspotmail.com
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
next prev parent reply other threads:[~2021-05-06 13:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-06 13:21 KVM: x86: Prevent deadlock against tk_core.seq Thomas Gleixner
2021-05-06 13:35 ` Peter Zijlstra [this message]
2021-05-06 14:51 ` Paolo Bonzini
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=YJPwi0FSObIjOSd7@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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