The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [syzbot] [kvm-x86?] WARNING in kvm_check_and_inject_events
@ 2026-07-09 16:33 syzbot
  2026-07-12  2:09 ` Forwarded: [PATCH] KVM: x86: Add debug traces to investigate irq == -1 syzbot
  2026-07-12  4:36 ` Forwarded: [PATCH] KVM: x86: Add debug traces (KERN_WARNING) to investigate irq syzbot
  0 siblings, 2 replies; 3+ messages in thread
From: syzbot @ 2026-07-09 16:33 UTC (permalink / raw)
  To: bp, dave.hansen, hpa, kvm, linux-kernel, mingo, pbonzini, seanjc,
	syzkaller-bugs, tglx, x86

Hello,

syzbot found the following issue on:

HEAD commit:    0e35b9b6ec0f Merge tag 'mm-hotfixes-stable-2026-07-06-17-4..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1144b739580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=48ef5c5c0f192153
dashboard link: https://syzkaller.appspot.com/bug?extid=9dcd0a11dc9703a49511
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=129d4389580000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10de8432580000

Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-0e35b9b6.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/c14bac7bee17/vmlinux-0e35b9b6.xz
kernel image: https://storage.googleapis.com/syzbot-assets/36bfa5293255/bzImage-0e35b9b6.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+9dcd0a11dc9703a49511@syzkaller.appspotmail.com

------------[ cut here ]------------
irq == -1
WARNING: arch/x86/kvm/x86.c:10800 at kvm_check_and_inject_events+0xf1e/0x1070 arch/x86/kvm/x86.c:10800, CPU#0: syz.2.478/7431
Modules linked in:
CPU: 0 UID: 0 PID: 7431 Comm: syz.2.478 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:kvm_check_and_inject_events+0xf1e/0x1070 arch/x86/kvm/x86.c:10800
Code: 00 48 8b 44 24 20 48 0d 00 01 01 00 48 89 44 24 10 e9 35 fd ff ff e8 51 44 7e 00 90 0f 0b 90 e9 b7 fe ff ff e8 43 44 7e 00 90 <0f> 0b 90 e9 2e f8 ff ff e8 d5 bd ee 00 e9 ae f6 ff ff 48 8b 7c 24
RSP: 0018:ffffc90003e77a20 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff8880564729c0 RCX: ffffffff818b8adc
RDX: ffff888027f40000 RSI: ffffffff818b8bfd RDI: ffff888027f40000
RBP: 00000000ffffffff R08: 0000000000000005 R09: 00000000ffffffff
R10: 00000000ffffffff R11: 0000000000000000 R12: ffff8880564735ec
R13: 0000000000000001 R14: ffff888056472ca8 R15: ffff8880564732f8
FS:  000055558b257500(0000) GS:ffff8880d5dec000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fb475a73780 CR3: 0000000034df7000 CR4: 0000000000352ef0
Call Trace:
 <TASK>
 vcpu_enter_guest arch/x86/kvm/x86.c:11296 [inline]
 vcpu_run+0xf1d/0x5d50 arch/x86/kvm/x86.c:11707
 kvm_arch_vcpu_ioctl_run+0x5b6/0x1890 arch/x86/kvm/x86.c:12062
 kvm_vcpu_ioctl+0x730/0x1700 virt/kvm/kvm_main.c:4470
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:597 [inline]
 __se_sys_ioctl fs/ioctl.c:583 [inline]
 __x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fb475b9de59
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc07cddbe8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fb475e25fa0 RCX: 00007fb475b9de59
RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000005
RBP: 00007fb475c33e6f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fb475e25fac R14: 00007fb475e25fa0 R15: 00007fb475e25fa0
 </TASK>


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

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

* Forwarded: [PATCH] KVM: x86: Add debug traces to investigate irq == -1
  2026-07-09 16:33 [syzbot] [kvm-x86?] WARNING in kvm_check_and_inject_events syzbot
@ 2026-07-12  2:09 ` syzbot
  2026-07-12  4:36 ` Forwarded: [PATCH] KVM: x86: Add debug traces (KERN_WARNING) to investigate irq syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2026-07-12  2:09 UTC (permalink / raw)
  To: linux-kernel, syzkaller-bugs

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: [PATCH] KVM: x86: Add debug traces to investigate irq == -1
Author: kartikey406@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master


Reported-by: syzbot+9dcd0a11dc9703a49511@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=9dcd0a11dc9703a49511
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
 arch/x86/kvm/i8259.c | 37 ++++++++++++++++++++++++++++++++---
 arch/x86/kvm/irq.c   | 46 +++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 77 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 6a942ac622d5..4360ed7cc319 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -233,13 +233,33 @@ int kvm_pic_read_irq(struct kvm *kvm)
 {
 	int irq, irq2, intno;
 	struct kvm_pic *s = kvm->arch.vpic;
-
-	s->output = 0;
-
 	pic_lock(s);
+	printk(KERN_DEBUG
+           "KVM_DEBUG: pic_read_irq START "
+           "output=%d "
+           "IRR0=%02x IMR0=%02x "
+           "ISR0=%02x\n",
+           s->output,
+           s->pics[0].irr,
+           s->pics[0].imr,
+           s->pics[0].isr);
+	s->output = 0;
+	printk(KERN_DEBUG
+           "KVM_DEBUG: output set to 0!\n");
 	irq = pic_get_irq(&s->pics[0]);
+	 printk(KERN_DEBUG
+           "KVM_DEBUG: pic_get_irq returned %d\n",
+           irq);
 	if (irq >= 0) {
 		pic_intack(&s->pics[0], irq);
+		printk(KERN_DEBUG
+               "KVM_DEBUG: after pic_intack "
+               "IRR0=%02x "
+               "ISR0=%02x "
+               "auto_eoi=%d\n",
+               s->pics[0].irr,
+               s->pics[0].isr,
+               s->pics[0].auto_eoi);
 		if (irq == 2) {
 			irq2 = pic_get_irq(&s->pics[1]);
 			if (irq2 >= 0)
@@ -253,6 +273,9 @@ int kvm_pic_read_irq(struct kvm *kvm)
 		} else
 			intno = s->pics[0].irq_base + irq;
 	} else {
+		 printk(KERN_DEBUG
+               "KVM_DEBUG: spurious IRQ! "
+               "no irq found in IRR!\n");
 		/*
 		 * spurious IRQ on host controller
 		 */
@@ -260,6 +283,14 @@ int kvm_pic_read_irq(struct kvm *kvm)
 		intno = s->pics[0].irq_base + irq;
 	}
 	pic_update_irq(s);
+	 printk(KERN_DEBUG
+           "KVM_DEBUG: pic_read_irq END "
+           "intno=%d "
+           "output=%d "
+           "IRR0=%02x\n",
+           intno,
+           s->output,
+           s->pics[0].irr);
 	pic_unlock(s);
 
 	return intno;
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index 8c62c6d4d5c1..1c7541e01d4a 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -79,8 +79,19 @@ int kvm_cpu_has_extint(struct kvm_vcpu *v)
 		return 0;
 
 #ifdef CONFIG_KVM_IOAPIC
-	if (pic_in_kernel(v->kvm))
+	if (pic_in_kernel(v->kvm)) {
+		 printk(KERN_DEBUG
+               "KVM_DEBUG: has_extint called "
+               "output=%d "
+               "IRR0=%02x IRR1=%02x "
+               "IMR0=%02x IMR1=%02x\n",
+               v->kvm->arch.vpic->output,
+               v->kvm->arch.vpic->pics[0].irr,
+               v->kvm->arch.vpic->pics[1].irr,
+               v->kvm->arch.vpic->pics[0].imr,
+               v->kvm->arch.vpic->pics[1].imr);
 		return v->kvm->arch.vpic->output;
+	}
 #endif
 
 	WARN_ON_ONCE(!irqchip_split(v->kvm));
@@ -127,7 +138,24 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_cpu_has_interrupt);
  */
 int kvm_cpu_get_extint(struct kvm_vcpu *v)
 {
+	int result;
+	if (pic_in_kernel(v->kvm))
+	 	printk(KERN_DEBUG
+           	       "KVM_DEBUG: get_extint called "
+                       "output=%d\n",
+                       v->kvm->arch.vpic->output);
 	if (!kvm_cpu_has_extint(v)) {
+		if (pic_in_kernel(v->kvm)) {
+		 	printk(KERN_DEBUG
+               		"KVM_DEBUG: has_extint=FALSE "
+               		"returning -1! "
+               		"output=%d\n",
+               		v->kvm->arch.vpic->output);
+		}
+		else
+			printk(KERN_DEBUG
+			       "KVM_DEBUG: has_extint=FALSE "
+                               "no pic in kernel!\n");
 		WARN_ON(!lapic_in_kernel(v));
 		return -1;
 	}
@@ -141,8 +169,20 @@ int kvm_cpu_get_extint(struct kvm_vcpu *v)
 #endif
 
 #ifdef CONFIG_KVM_IOAPIC
-	if (pic_in_kernel(v->kvm))
-		return kvm_pic_read_irq(v->kvm); /* PIC */
+	if (pic_in_kernel(v->kvm)) {
+		 printk(KERN_DEBUG
+               "KVM_DEBUG: calling pic_read_irq "
+               "output=%d\n",
+               v->kvm->arch.vpic->output);
+		result = kvm_pic_read_irq(v->kvm);
+		 printk(KERN_DEBUG
+               "KVM_DEBUG: pic_read_irq returned "
+               "intno=%d "
+               "output=%d\n",
+               result,
+               v->kvm->arch.vpic->output);
+		return result; /* PIC */
+	}
 #endif
 
 	WARN_ON_ONCE(!irqchip_split(v->kvm));
-- 
2.43.0


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

* Forwarded: [PATCH] KVM: x86: Add debug traces (KERN_WARNING) to investigate irq
  2026-07-09 16:33 [syzbot] [kvm-x86?] WARNING in kvm_check_and_inject_events syzbot
  2026-07-12  2:09 ` Forwarded: [PATCH] KVM: x86: Add debug traces to investigate irq == -1 syzbot
@ 2026-07-12  4:36 ` syzbot
  1 sibling, 0 replies; 3+ messages in thread
From: syzbot @ 2026-07-12  4:36 UTC (permalink / raw)
  To: linux-kernel, syzkaller-bugs

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: [PATCH] KVM: x86: Add debug traces (KERN_WARNING) to investigate irq
Author: kartikey406@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master


Reported-by: syzbot+9dcd0a11dc9703a49511@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=9dcd0a11dc9703a49511
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
 arch/x86/kvm/i8259.c | 37 ++++++++++++++++++++++++++++++++---
 arch/x86/kvm/irq.c   | 46 +++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 77 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 6a942ac622d5..20b3b4855974 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -233,13 +233,33 @@ int kvm_pic_read_irq(struct kvm *kvm)
 {
 	int irq, irq2, intno;
 	struct kvm_pic *s = kvm->arch.vpic;
-
-	s->output = 0;
-
 	pic_lock(s);
+	printk(KERN_WARNING
+           "KVM_DEBUG: pic_read_irq START "
+           "output=%d "
+           "IRR0=%02x IMR0=%02x "
+           "ISR0=%02x\n",
+           s->output,
+           s->pics[0].irr,
+           s->pics[0].imr,
+           s->pics[0].isr);
+	s->output = 0;
+	printk(KERN_WARNING
+           "KVM_DEBUG: output set to 0!\n");
 	irq = pic_get_irq(&s->pics[0]);
+	 printk(KERN_WARNING
+           "KVM_DEBUG: pic_get_irq returned %d\n",
+           irq);
 	if (irq >= 0) {
 		pic_intack(&s->pics[0], irq);
+		printk(KERN_WARNING
+               "KVM_DEBUG: after pic_intack "
+               "IRR0=%02x "
+               "ISR0=%02x "
+               "auto_eoi=%d\n",
+               s->pics[0].irr,
+               s->pics[0].isr,
+               s->pics[0].auto_eoi);
 		if (irq == 2) {
 			irq2 = pic_get_irq(&s->pics[1]);
 			if (irq2 >= 0)
@@ -253,6 +273,9 @@ int kvm_pic_read_irq(struct kvm *kvm)
 		} else
 			intno = s->pics[0].irq_base + irq;
 	} else {
+		 printk(KERN_WARNING
+               "KVM_DEBUG: spurious IRQ! "
+               "no irq found in IRR!\n");
 		/*
 		 * spurious IRQ on host controller
 		 */
@@ -260,6 +283,14 @@ int kvm_pic_read_irq(struct kvm *kvm)
 		intno = s->pics[0].irq_base + irq;
 	}
 	pic_update_irq(s);
+	 printk(KERN_WARNING
+           "KVM_DEBUG: pic_read_irq END "
+           "intno=%d "
+           "output=%d "
+           "IRR0=%02x\n",
+           intno,
+           s->output,
+           s->pics[0].irr);
 	pic_unlock(s);
 
 	return intno;
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index 8c62c6d4d5c1..0dad5d3c5413 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -79,8 +79,19 @@ int kvm_cpu_has_extint(struct kvm_vcpu *v)
 		return 0;
 
 #ifdef CONFIG_KVM_IOAPIC
-	if (pic_in_kernel(v->kvm))
+	if (pic_in_kernel(v->kvm)) {
+		 printk(KERN_WARNING
+               "KVM_DEBUG: has_extint called "
+               "output=%d "
+               "IRR0=%02x IRR1=%02x "
+               "IMR0=%02x IMR1=%02x\n",
+               v->kvm->arch.vpic->output,
+               v->kvm->arch.vpic->pics[0].irr,
+               v->kvm->arch.vpic->pics[1].irr,
+               v->kvm->arch.vpic->pics[0].imr,
+               v->kvm->arch.vpic->pics[1].imr);
 		return v->kvm->arch.vpic->output;
+	}
 #endif
 
 	WARN_ON_ONCE(!irqchip_split(v->kvm));
@@ -127,7 +138,24 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_cpu_has_interrupt);
  */
 int kvm_cpu_get_extint(struct kvm_vcpu *v)
 {
+	int result;
+	if (pic_in_kernel(v->kvm))
+	 	printk(KERN_WARNING
+           	       "KVM_DEBUG: get_extint called "
+                       "output=%d\n",
+                       v->kvm->arch.vpic->output);
 	if (!kvm_cpu_has_extint(v)) {
+		if (pic_in_kernel(v->kvm)) {
+		 	printk(KERN_WARNING
+               		"KVM_DEBUG: has_extint=FALSE "
+               		"returning -1! "
+               		"output=%d\n",
+               		v->kvm->arch.vpic->output);
+		}
+		else
+			printk(KERN_WARNING
+			       "KVM_DEBUG: has_extint=FALSE "
+                               "no pic in kernel!\n");
 		WARN_ON(!lapic_in_kernel(v));
 		return -1;
 	}
@@ -141,8 +169,20 @@ int kvm_cpu_get_extint(struct kvm_vcpu *v)
 #endif
 
 #ifdef CONFIG_KVM_IOAPIC
-	if (pic_in_kernel(v->kvm))
-		return kvm_pic_read_irq(v->kvm); /* PIC */
+	if (pic_in_kernel(v->kvm)) {
+		 printk(KERN_WARNING
+               "KVM_DEBUG: calling pic_read_irq "
+               "output=%d\n",
+               v->kvm->arch.vpic->output);
+		result = kvm_pic_read_irq(v->kvm);
+		 printk(KERN_WARNING
+               "KVM_DEBUG: pic_read_irq returned "
+               "intno=%d "
+               "output=%d\n",
+               result,
+               v->kvm->arch.vpic->output);
+		return result; /* PIC */
+	}
 #endif
 
 	WARN_ON_ONCE(!irqchip_split(v->kvm));
-- 
2.43.0


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

end of thread, other threads:[~2026-07-12  4:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-09 16:33 [syzbot] [kvm-x86?] WARNING in kvm_check_and_inject_events syzbot
2026-07-12  2:09 ` Forwarded: [PATCH] KVM: x86: Add debug traces to investigate irq == -1 syzbot
2026-07-12  4:36 ` Forwarded: [PATCH] KVM: x86: Add debug traces (KERN_WARNING) to investigate irq syzbot

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