Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH] KVM: x86/xen: Use read_trylock() for GPC locks in hardirq paths
@ 2026-08-07 12:19 sai madhu
  2026-08-07 12:19 ` sai madhu
  0 siblings, 1 reply; 7+ messages in thread
From: sai madhu @ 2026-08-07 12:19 UTC (permalink / raw)
  To: kvm; +Cc: dwmw2, seanjc, pbonzini, syzbot+919877893c9d28162dc2, sai madhu

Hi KVM maintainers,

This patch fixes a lockdep WARNING in kvm_xen_set_evtchn_fast() when
called from xen_timer_callback() in hard IRQ context.

Bug report:
  https://syzkaller.appspot.com/bug?extid=919877893c9d28162dc2

Observed crash (unpatched):
  [ BUG: Invalid wait context ]
  (&gpc->lock) at kvm_xen_set_evtchn_fast+0x1fb
  context-{2:2}  (hard IRQ, from xen_timer_callback)

Fix:
  Use read_trylock() on gpc->lock and return -EWOULDBLOCK on failure.
  The existing slow path (timer_pending + kvm_xen_inject_timer_irqs)
  handles deferred delivery safely in vcpu_run context.

This patch is based on David Woodhouse's May 2026 series (patch 3/7).
I reproduced the syzbot C repro on x86_64 with nested KVM:

  Unpatched bzImage-b69053dd: 1x lockdep BUG at ~69s
  Patched bzImage-xen-fix:    0x lockdep BUG (same repro)

Tested-by: sai madhu <suryasaimadhu369@gmail.com>

Thanks,
sai madhu

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [syzbot] [kvm-x86?] [kvm?] WARNING: locking bug in kvm_xen_set_evtchn_fast
@ 2026-08-10 11:28 David Woodhouse
  2026-08-10 14:00 ` syzbot
  0 siblings, 1 reply; 7+ messages in thread
From: David Woodhouse @ 2026-08-10 11:28 UTC (permalink / raw)
  To: syzbot+919877893c9d28162dc2; +Cc: kvm, seanjc, pbonzini, suryasaimadhu369

[-- Attachment #1: Type: text/plain, Size: 244 bytes --]

On Sun, 2026-08-09 at 04:34 +0000, syzbot wrote:
> syzbot has tested the proposed patch and the reproducer did not trigger any issue

I found some though. Reworked:

#syz test: git://git.infradead.org/users/dwmw2/linux.git xen-srcu-fixed

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 6179 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-08-10 14:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-07 12:19 [PATCH] KVM: x86/xen: Use read_trylock() for GPC locks in hardirq paths sai madhu
2026-08-07 12:19 ` sai madhu
2026-08-07 12:28   ` sashiko-bot
2026-08-09  9:42   ` David Woodhouse
2026-08-09 11:34     ` [syzbot] [kvm-x86?] [kvm?] WARNING: locking bug in kvm_xen_set_evtchn_fast syzbot
  -- strict thread matches above, loose matches on Subject: below --
2026-08-10 11:28 David Woodhouse
2026-08-10 14:00 ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox