Commit 3f804f6
KVM: x86: Prevent deadlock against tk_core.seq
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: 16e8d74 ("KVM: x86: notifier for clocksource changes")
Reported-by: syzbot+6beae4000559d41d80f8@syzkaller.appspotmail.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Message-Id: <87h7jgm1zy.ffs@nanos.tec.linutronix.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>1 parent 594b27e commit 3f804f6
1 file changed
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8094 | 8094 | | |
8095 | 8095 | | |
8096 | 8096 | | |
| 8097 | + | |
| 8098 | + | |
| 8099 | + | |
| 8100 | + | |
| 8101 | + | |
| 8102 | + | |
| 8103 | + | |
| 8104 | + | |
| 8105 | + | |
| 8106 | + | |
| 8107 | + | |
| 8108 | + | |
8097 | 8109 | | |
8098 | 8110 | | |
8099 | 8111 | | |
| |||
8105 | 8117 | | |
8106 | 8118 | | |
8107 | 8119 | | |
8108 | | - | |
8109 | | - | |
| 8120 | + | |
| 8121 | + | |
| 8122 | + | |
| 8123 | + | |
8110 | 8124 | | |
8111 | 8125 | | |
8112 | 8126 | | |
8113 | | - | |
8114 | | - | |
| 8127 | + | |
8115 | 8128 | | |
8116 | 8129 | | |
8117 | 8130 | | |
| |||
8224 | 8237 | | |
8225 | 8238 | | |
8226 | 8239 | | |
| 8240 | + | |
8227 | 8241 | | |
8228 | 8242 | | |
8229 | 8243 | | |
| |||
0 commit comments