[syzbot] [iommu?] WARNING in iommufd_hw_pagetable_detach

9 views
Skip to first unread message

syzbot

unread,
Mar 31, 2023, 11:36:55 PM3/31/23
to baol...@linux.intel.com, io...@lists.linux.dev, j...@nvidia.com, j...@ziepe.ca, jo...@8bytes.org, kevin...@intel.com, linux-...@vger.kernel.org, nico...@nvidia.com, robin....@arm.com, syzkall...@googlegroups.com, wi...@kernel.org
Hello,

syzbot found the following issue on:

HEAD commit: 4b0f4525dc4f Add linux-next specific files for 20230331
git tree: linux-next
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1540ac7dc80000
kernel config: https://syzkaller.appspot.com/x/.config?x=85cc4b935a1f7194
dashboard link: https://syzkaller.appspot.com/bug?extid=3b81771e32dd5b2f9931
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12120eb9c80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10ec200dc80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/8d06bb015df3/disk-4b0f4525.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6a1c1ebf3724/vmlinux-4b0f4525.xz
kernel image: https://storage.googleapis.com/syzbot-assets/4bb2b8d6cd7d/bzImage-4b0f4525.xz

The issue was bisected to:

commit 9d05029acd4e4c0a85e412bf955dfc5526b9a6c1
Author: Jason Gunthorpe <j...@nvidia.com>
Date: Mon Mar 27 18:37:57 2023 +0000

iommufd: Replace the hwpt->devices list with iommufd_group

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=13dbbb71c80000
final oops: https://syzkaller.appspot.com/x/report.txt?x=103bbb71c80000
console output: https://syzkaller.appspot.com/x/log.txt?x=17dbbb71c80000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3b8177...@syzkaller.appspotmail.com
Fixes: 9d05029acd4e ("iommufd: Replace the hwpt->devices list with iommufd_group")

iommufd_mock iommufd_mock0: Adding to iommu group 0
------------[ cut here ]------------
WARNING: CPU: 0 PID: 5081 at drivers/iommu/iommufd/device.c:344 iommufd_hw_pagetable_detach+0x2cb/0x480 drivers/iommu/iommufd/device.c:344
Modules linked in:
CPU: 0 PID: 5081 Comm: syz-executor226 Not tainted 6.3.0-rc4-next-20230331-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
RIP: 0010:iommufd_hw_pagetable_detach+0x2cb/0x480 drivers/iommu/iommufd/device.c:344
Code: f2 fc 49 8d 7d 70 be ff ff ff ff e8 cf 2f 76 05 31 ff 41 89 c5 89 c6 e8 63 6d f2 fc 45 85 ed 0f 85 ee fd ff ff e8 35 71 f2 fc <0f> 0b e9 e2 fd ff ff e8 29 71 f2 fc 49 8d bd a0 00 00 00 48 b8 00
RSP: 0018:ffffc90003b0fb30 EFLAGS: 00010293
RAX: 0000000000000000 RBX: ffff88801676da00 RCX: 0000000000000000
RDX: ffff8880279c8000 RSI: ffffffff8490a01b RDI: 0000000000000005
RBP: ffff88801676dab0 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88801676dc00
R13: 0000000000000000 R14: 0000000000000001 R15: ffff88801676dcc0
FS: 0000555555fa9300(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000188 CR3: 000000002ba93000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
iommufd_hw_pagetable_alloc+0x646/0x800 drivers/iommu/iommufd/hw_pagetable.c:114
iommufd_device_auto_get_domain drivers/iommu/iommufd/device.c:500 [inline]
iommufd_device_change_pt+0x570/0xb30 drivers/iommu/iommufd/device.c:553
iommufd_device_attach+0x27/0xd0 drivers/iommu/iommufd/device.c:591
iommufd_test_mock_domain drivers/iommu/iommufd/selftest.c:439 [inline]
iommufd_test+0x81c/0x2ef0 drivers/iommu/iommufd/selftest.c:987
iommufd_fops_ioctl+0x317/0x4b0 drivers/iommu/iommufd/main.c:351
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f6a1d59bc89
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe55301508 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f6a1d59bc89
RDX: 00000000200000c0 RSI: 0000000000003ba0 RDI: 0000000000000003
RBP: 00007f6a1d55fe30 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f6a1d55fec0
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</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 syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

Hillf Danton

unread,
Apr 1, 2023, 2:49:06 AM4/1/23
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On 31 Mar 2023 20:36:53 -0700
> HEAD commit: 4b0f4525dc4f Add linux-next specific files for 20230331
> git tree: linux-next
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10ec200dc80000

Detach pgtable under the idev->igroup->lock.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 4b0f4525dc4f

--- x/drivers/iommu/iommufd/hw_pagetable.c
+++ y/drivers/iommu/iommufd/hw_pagetable.c
@@ -110,8 +110,11 @@ iommufd_hw_pagetable_alloc(struct iommuf
return hwpt;

out_detach:
- if (immediate_attach)
+ if (immediate_attach) {
+ mutex_lock(&idev->igroup->lock);
iommufd_hw_pagetable_detach(idev);
+ mutex_unlock(&idev->igroup->lock);
+ }
out_abort:
iommufd_object_abort_and_destroy(ictx, &hwpt->obj);
return ERR_PTR(rc);
--

syzbot

unread,
Apr 1, 2023, 3:09:27 AM4/1/23
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+3b8177...@syzkaller.appspotmail.com

Tested on:

commit: 4b0f4525 Add linux-next specific files for 20230331
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=1391d1cdc80000
kernel config: https://syzkaller.appspot.com/x/.config?x=85cc4b935a1f7194
dashboard link: https://syzkaller.appspot.com/bug?extid=3b81771e32dd5b2f9931
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=1729c4c9c80000

Note: testing is done by a robot and is best-effort only.

syzbot

unread,
Jul 4, 2023, 5:33:46 PM7/4/23
to syzkall...@googlegroups.com
Auto-closing this bug as obsolete.
No recent activity, existing reproducers are no longer triggering the issue.
Reply all
Reply to author
Forward
0 new messages