Re: [syzbot] [iommu?] kernel BUG in iommu_pages_start_incoherent
From: Jason Gunthorpe
Date: Fri Dec 12 2025 - 01:47:53 EST
On Thu, Dec 11, 2025 at 04:36:46PM +0900, Will Deacon wrote:
> > kernel BUG at arch/x86/mm/physaddr.c:28!
> > Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
> > CPU: 0 UID: 0 PID: 5336 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full)
> > Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
> > RIP: 0010:__phys_addr+0x16b/0x180 arch/x86/mm/physaddr.c:28
> > Code: 8b b3 00 e9 45 ff ff ff e8 b2 af 4b 00 48 c7 c7 f0 33 fb 8d 48 89 de 4c 89 f2 e8 50 c0 52 03 e9 4d ff ff ff e8 96 af 4b 00 90 <0f> 0b e8 8e af 4b 00 90 0f 0b e8 86 af 4b 00 90 0f 0b 0f 1f 00 90
> > RSP: 0018:ffffc9000aae5f80 EFLAGS: 00010093
> > RAX: ffffffff817610fa RBX: 0000778000000000 RCX: ffff8880007ca4c0
> > RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000778000000000
> > RBP: ffffc9000aae6130 R08: ffffffff8e26c433 R09: 1ffffffff1c4d886
> > R10: dffffc0000000000 R11: fffffbfff1c4d887 R12: 0000000000000011
> > R13: dffffc0000000000 R14: 0000000080000000 R15: dffffc0000000000
> > FS: 00007fae02b026c0(0000) GS:ffff88808d23e000(0000) knlGS:0000000000000000
> > CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > CR2: 00007fae01d2dea0 CR3: 000000000b669000 CR4: 0000000000352ef0
> > Call Trace:
> > <TASK>
> > virt_to_folio include/linux/mm.h:1432 [inline]
> > virt_to_ioptdesc drivers/iommu/iommu-pages.h:49 [inline]
> > iommu_pages_start_incoherent+0x52/0x310 drivers/iommu/iommu-pages.c:148
> > _table_alloc drivers/iommu/generic_pt/iommu_pt.h:377 [inline]
> > table_alloc drivers/iommu/generic_pt/iommu_pt.h:408 [inline]
I think it is:
+++ b/drivers/iommu/generic_pt/iommu_pt.h
@@ -372,7 +372,7 @@ static inline struct pt_table_p *_table_alloc(struct pt_common *common,
table_mem = iommu_alloc_pages_node_sz(iommu_table->nid, gfp,
log2_to_int(lg2sz));
- if (pt_feature(common, PT_FEAT_DMA_INCOHERENT) &&
+ if (pt_feature(common, PT_FEAT_DMA_INCOHERENT) && table_mem &&
mode == ALLOC_NORMAL) {
int ret = iommu_pages_start_incoherent(
table_mem, iommu_table->iommu_device);
Fault injection triggered an allocation failure while emulating a VT-d
iommu that uses cache flushing..
I will send a fix when I'm able.
Jason