WARNING in iopt_map_pages (3)
syzbot
syzbotHello,
syzbot found the following issue on:
HEAD commit: 05c93f3395ed Merge branch 'for-next/core' into for-kernelci git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci console output: https://syzkaller.appspot.com/x/log.txt?x=14eb7c1a580000 kernel config: https://syzkaller.appspot.com/x/.config?x=3b5338ad1e59a06c dashboard link: https://syzkaller.appspot.com/bug?extid=57fdb0cf6a0c5d1f15a2 compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8 userspace arch: arm64 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17dfc992580000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12a926c2580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/6b5c913e373c/disk-05c93f33.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/15e75f1266ef/vmlinux-05c93f33.xz
kernel image: https://storage.googleapis.com/syzbot-assets/dd930129c578/Image-05c93f33.gz.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
iommufd_mock iommufd_mock0: Adding to iommu group 0
------------[ cut here ]------------ WARNING: CPU: 0 PID: 6739 at drivers/iommu/iommufd/io_pagetable.c:292 iopt_alloc_area_pages drivers/iommu/iommufd/io_pagetable.c:292 [inline] WARNING: CPU: 0 PID: 6739 at drivers/iommu/iommufd/io_pagetable.c:292 iopt_map_pages+0xd7c/0xdcc drivers/iommu/iommufd/io_pagetable.c:376 Modules linked in: CPU: 0 UID: 0 PID: 6739 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/03/2025 pstate: 83400005 (Nzcv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--) pc : iopt_alloc_area_pages drivers/iommu/iommufd/io_pagetable.c:292 [inline] pc : iopt_map_pages+0xd7c/0xdcc drivers/iommu/iommufd/io_pagetable.c:376 lr : iopt_alloc_area_pages drivers/iommu/iommufd/io_pagetable.c:292 [inline] lr : iopt_map_pages+0xd7c/0xdcc drivers/iommu/iommufd/io_pagetable.c:376
sp : ffff8000a04f76c0
x29: ffff8000a04f78a0 x28: ffff0000d66f4810 x27: 1fffe0001acde944
x26: ffff8000a04f7b00 x25: 0000000000002fff x24: 0000000000003000
x23: ffff0000d66f4a20 x22: ffff0000d66f49f8 x21: 00000000ffffffea
x20: dfff800000000000 x19: ffff8000a04f79b0 x18: 0000000000000000
x17: ffff800083ce6110 x16: ffff80008052b3c8 x15: 0000000000000007
x14: 0000000000000000 x13: 00000000ffffffff x12: 0000000000ff0100
x11: ffff0000c72f5c40 x10: 0000000000ff0100 x9 : 0000000000000000 x8 : ffff0000c72f5c40 x7 : 0000000000000000 x6 : 000000000000003f x5 : 0000000000000040 x4 : ffffffffffffefff x3 : ffffffffffffefff x2 : 0000000000f03fff x1 : 00000000ffffffea x0 : 0000000000000000
Call trace: iopt_alloc_area_pages drivers/iommu/iommufd/io_pagetable.c:292 [inline] (P) iopt_map_pages+0xd7c/0xdcc drivers/iommu/iommufd/io_pagetable.c:376 (P) iopt_map_common+0x204/0x420 drivers/iommu/iommufd/io_pagetable.c:420 iopt_map_user_pages+0xb4/0xd8 drivers/iommu/iommufd/io_pagetable.c:461 iommufd_ioas_map+0x2d4/0x3d0 drivers/iommu/iommufd/ioas.c:276 iommufd_fops_ioctl+0x424/0x54c drivers/iommu/iommufd/main.c:533 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __arm64_sys_ioctl+0x14c/0x1c4 fs/ioctl.c:583 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x254 arch/arm64/kernel/syscall.c:49 el0_svc_common+0xe8/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x5c/0x254 arch/arm64/kernel/entry-common.c:724 el0t_64_sync_handler+0x84/0x12c arch/arm64/kernel/entry-common.c:743 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:596 irq event stamp: 1160 hardirqs last enabled at (1159): [<ffff80008ae21fa0>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline] hardirqs last enabled at (1159): [<ffff80008ae21fa0>] _raw_spin_unlock_irqrestore+0x38/0x98 kernel/locking/spinlock.c:194 hardirqs last disabled at (1160): [<ffff80008adf99f4>] el1_brk64+0x20/0x54 arch/arm64/kernel/entry-common.c:412 softirqs last enabled at (132): [<ffff8000801f96d0>] local_bh_enable+0x10/0x34 include/linux/bottom_half.h:32 softirqs last disabled at (130): [<ffff8000801f969c>] local_bh_disable+0x10/0x34 include/linux/bottom_half.h:19 ---[ end trace 0000000000000000 ]---
---
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 [email protected].
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
Quoted 62 lines · syzbot
Hello,
syzbot found the following issue on:
HEAD commit: 05c93f3395ed Merge branch 'for-next/core' into for-kernelci git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci console output: https://syzkaller.appspot.com/x/log.txt?x=14eb7c1a580000 kernel config: https://syzkaller.appspot.com/x/.config?x=3b5338ad1e59a06c dashboard link: https://syzkaller.appspot.com/bug?extid=57fdb0cf6a0c5d1f15a2 compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8 userspace arch: arm64 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17dfc992580000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12a926c2580000Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/6b5c913e373c/disk-05c93f33.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/15e75f1266ef/vmlinux-05c93f33.xz
kernel image: https://storage.googleapis.com/syzbot-assets/dd930129c578/Image-05c93f33.gz.xzIMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by [email protected]
iommufd_mockiommufd_mock0: Adding to iommu group 0------------[ cut here ]------------ WARNING: CPU: 0 PID: 6739 at drivers/iommu/iommufd/io_pagetable.c:292 iopt_alloc_area_pages drivers/iommu/iommufd/io_pagetable.c:292 [inline] WARNING: CPU: 0 PID: 6739 at drivers/iommu/iommufd/io_pagetable.c:292 iopt_map_pages+0xd7c/0xdcc drivers/iommu/iommufd/io_pagetable.c:376 Modules linked in: CPU: 0 UID: 0 PID: 6739 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/03/2025 pstate: 83400005 (Nzcv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--) pc : iopt_alloc_area_pages drivers/iommu/iommufd/io_pagetable.c:292 [inline] pc : iopt_map_pages+0xd7c/0xdcc drivers/iommu/iommufd/io_pagetable.c:376 lr : iopt_alloc_area_pages drivers/iommu/iommufd/io_pagetable.c:292 [inline] lr : iopt_map_pages+0xd7c/0xdcc drivers/iommu/iommufd/io_pagetable.c:376sp :
ffff8000a04f76c0
x29:ffff8000a04f78a0x28:ffff0000d66f4810x27:1fffe0001acde944
x26:ffff8000a04f7b00x25:0000000000002fffx24: 0000000000003000
x23:ffff0000d66f4a20x22:ffff0000d66f49f8x21:00000000ffffffea
x20:dfff800000000000x19:ffff8000a04f79b0x18: 0000000000000000
x17:ffff800083ce6110x16:ffff80008052b3c8x15: 0000000000000007
x14: 0000000000000000 x13:00000000ffffffffx12:0000000000ff0100
x11:ffff0000c72f5c40x10:0000000000ff0100x9 : 0000000000000000 x8 :ffff0000c72f5c40x7 : 0000000000000000 x6 :000000000000003fx5 : 0000000000000040 x4 : ffffffffffffefff x3 : ffffffffffffefff x2 :0000000000f03fffx1 :00000000ffffffeax0 : 0000000000000000Call trace: iopt_alloc_area_pages drivers/iommu/iommufd/io_pagetable.c:292 [inline] (P) iopt_map_pages+0xd7c/0xdcc drivers/iommu/iommufd/io_pagetable.c:376 (P) iopt_map_common+0x204/0x420 drivers/iommu/iommufd/io_pagetable.c:420 iopt_map_user_pages+0xb4/0xd8 drivers/iommu/iommufd/io_pagetable.c:461 iommufd_ioas_map+0x2d4/0x3d0 drivers/iommu/iommufd/ioas.c:276 iommufd_fops_ioctl+0x424/0x54c drivers/iommu/iommufd/main.c:533 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl fs/ioctl.c:583 [inline] __arm64_sys_ioctl+0x14c/0x1c4 fs/ioctl.c:583 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x254 arch/arm64/kernel/syscall.c:49 el0_svc_common+0xe8/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x5c/0x254 arch/arm64/kernel/entry-common.c:724 el0t_64_sync_handler+0x84/0x12c arch/arm64/kernel/entry-common.c:743
Quoted 8 lines
el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:596 irq event stamp: 1160 hardirqs last enabled at (1159): [<ffff80008ae21fa0>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline] hardirqs last enabled at (1159): [<ffff80008ae21fa0>] _raw_spin_unlock_irqrestore+0x38/0x98 kernel/locking/spinlock.c:194 hardirqs last disabled at (1160): [<ffff80008adf99f4>] el1_brk64+0x20/0x54 arch/arm64/kernel/entry-common.c:412 softirqs last enabled at (132): [<ffff8000801f96d0>] local_bh_enable+0x10/0x34 include/linux/bottom_half.h:32 softirqs last disabled at (130): [<ffff8000801f969c>] local_bh_disable+0x10/0x34 include/linux/bottom_half.h:19 ---[ end trace 0000000000000000 ]---
It looks to be an overflow error as user gives the below arg. But this should be expected. no?
// start: int64 = 0x1000005 (8 bytes)
// length: int64 = 0xffffffffffefffff (8 bytes)
Quoted 26 lines
---
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 [email protected].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-titleIf you want syzbot to run the reproducer, reply with:
#syz test:git://repo/address.gitbranch-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-reportIf you want to undo deduplication, reply with:
#syz undup
Quoted 5 lines · Yi Liu
It looks to be an overflow error as user gives the below arg. But this should be expected. no?
// start: int64 =
0x1000005(8 bytes)
// length: int64 =0xffffffffffefffff(8 bytes)
Something probably overflowed, the test is:
r0 = openat$iommufd(0xffffffffffffff9c, &(0x7f0000000000), 0x0, 0x0)
ioctl$IOMMU_IOAS_ALLOC(r0, 0x3b81, &(0x7f0000000100)={0xc, 0x0, <r1=>0x0}) ioctl$IOMMU_TEST_OP_ADD_RESERVED(r0, 0x3ba0, &(0x7f0000000040)={0x48, 0x1, r1, 0x0, 0x1000005, 0xffffffffffefffff}) ioctl$IOMMU_TEST_OP_MOCK_DOMAIN_FLAGS(r0, 0x3ba0, &(0x7f00000003c0)={0x48, 0x2, r1}) ioctl$IOMMU_IOAS_MAP$PAGES(r0, 0x3b85, &(0x7f0000001340)={0x28, 0x2, r1, 0x0, &(0x7f00003bd000/0x3000)=nil, 0x3000, 0x80})
And I'm guessing the allocator picked something that failed the reserved range intersection path:
/* No reserved IOVA intersects the range */ if (iopt_reserved_iter_first(iopt, iova, last)) return -EINVAL;
Maybe due to a corrupted range or something.
I'll look next week
Jason