KASAN: slab-out-of-bounds Write in usb_hcd_poll_rh_status (2)

10 views
Skip to first unread message

syzbot

unread,
Apr 14, 2021, 8:03:20 AM4/14/21
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 0f1b4cb7 Linux 4.19.187
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=17d29fd9d00000
kernel config: https://syzkaller.appspot.com/x/.config?x=7160c73ac3937bfe
dashboard link: https://syzkaller.appspot.com/bug?extid=88471b70b068a105c1f8

Unfortunately, I don't have any reproducer for this issue yet.

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

usb usb9: usbfs: process 31508 (syz-executor.4) did not claim interface 0 before use
kvm [31504]: vcpu0, guest rIP: 0x14c Hyper-V uhandled wrmsr: 0x40000049 data 0xfffe
netlink: 72 bytes leftover after parsing attributes in process `syz-executor.1'.
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:377 [inline]
BUG: KASAN: slab-out-of-bounds in usb_hcd_poll_rh_status+0x387/0x6f0 drivers/usb/core/hcd.c:771
Write of size 2 at addr ffff8880a5802080 by task syz-executor.0/31510
bond0: option fail_over_mac: unable to set because the bond device has slaves

CPU: 0 PID: 31510 Comm: syz-executor.0 Not tainted 4.19.187-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
kasan_report+0x8f/0xa0 mm/kasan/report.c:412
memcpy+0x35/0x50 mm/kasan/kasan.c:303
memcpy include/linux/string.h:377 [inline]
usb_hcd_poll_rh_status+0x387/0x6f0 drivers/usb/core/hcd.c:771
call_timer_fn+0x177/0x700 kernel/time/timer.c:1338
expire_timers+0x243/0x4e0 kernel/time/timer.c:1375
__run_timers kernel/time/timer.c:1696 [inline]
run_timer_softirq+0x21c/0x670 kernel/time/timer.c:1709
kvm [31504]: vcpu0, guest rIP: 0x14c Hyper-V uhandled wrmsr: 0x4000008a data 0xffae
__do_softirq+0x265/0x980 kernel/softirq.c:292
invoke_softirq kernel/softirq.c:372 [inline]
irq_exit+0x215/0x260 kernel/softirq.c:412
exiting_irq arch/x86/include/asm/apic.h:535 [inline]
smp_apic_timer_interrupt+0x136/0x550 arch/x86/kernel/apic/apic.c:1098
apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:894
</IRQ>
RIP: 0010:check_memory_region+0xb0/0x170 mm/kasan/kasan.c:268
Code: c0 08 48 39 d0 74 7b 48 83 38 00 74 f1 48 8d 50 08 eb 09 48 83 c0 01 48 39 d0 74 0e 80 38 00 74 f2 48 85 c0 0f 85 9c 00 00 00 <5b> 5d 41 5c c3 48 85 d2 74 f6 48 01 ea eb 09 48 83 c0 01 48 39 d0
RSP: 0018:ffff888040adf668 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
RAX: fffff94000201887 RBX: fffff94000201887 RCX: ffffffff81815920
RDX: fffff94000201887 RSI: 0000000000000004 RDI: ffffea000100c434
RBP: fffff94000201886 R08: 0000000000000001 R09: fffff94000201886
R10: ffffea000100c437 R11: 0000000000000000 R12: ffffea000100c434
R13: ffffea000100c400 R14: 0000000000000015 R15: dffffc0000000000
atomic_dec_and_test include/asm-generic/atomic-instrumented.h:259 [inline]
page_ref_dec_and_test include/linux/page_ref.h:139 [inline]
put_page_testzero include/linux/mm.h:520 [inline]
release_pages+0x1d0/0x15a0 mm/swap.c:760
tlb_flush_mmu_free mm/memory.c:261 [inline]
zap_pte_range mm/memory.c:1417 [inline]
zap_pmd_range mm/memory.c:1452 [inline]
zap_pud_range mm/memory.c:1481 [inline]
zap_p4d_range mm/memory.c:1502 [inline]
unmap_page_range+0x207f/0x2a70 mm/memory.c:1523
unmap_single_vma+0x198/0x300 mm/memory.c:1568
unmap_vmas+0xa9/0x180 mm/memory.c:1598
exit_mmap+0x2b9/0x530 mm/mmap.c:3093
__mmput kernel/fork.c:1015 [inline]
mmput+0x14e/0x4a0 kernel/fork.c:1036
exit_mm kernel/exit.c:549 [inline]
do_exit+0xaec/0x2be0 kernel/exit.c:857
do_group_exit+0x125/0x310 kernel/exit.c:967
get_signal+0x3f2/0x1f70 kernel/signal.c:2589
do_signal+0x8f/0x1670 arch/x86/kernel/signal.c:799
netlink: 64 bytes leftover after parsing attributes in process `syz-executor.1'.
exit_to_usermode_loop+0x204/0x2a0 arch/x86/entry/common.c:163
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x466459
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f758293c218 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 000000000056bf68 RCX: 0000000000466459
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 000000000056bf68
RBP: 000000000056bf60 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf6c
R13: 00007ffc20a31d9f R14: 00007f758293c300 R15: 0000000000022000

Allocated by task 31508:
__do_kmalloc mm/slab.c:3727 [inline]
__kmalloc+0x15a/0x3c0 mm/slab.c:3736
kmalloc include/linux/slab.h:520 [inline]
proc_do_submiturb+0x2d08/0x3af0 drivers/usb/core/devio.c:1668
proc_submiturb drivers/usb/core/devio.c:1822 [inline]
usbdev_do_ioctl+0x773/0x3030 drivers/usb/core/devio.c:2476
usbdev_ioctl+0x21/0x30 drivers/usb/core/devio.c:2580
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:501 [inline]
do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
__do_sys_ioctl fs/ioctl.c:712 [inline]
__se_sys_ioctl fs/ioctl.c:710 [inline]
__x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 9:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
security_sk_free+0x3e/0x70 security/security.c:1474
sk_prot_free net/core/sock.c:1499 [inline]
__sk_destruct+0x51d/0x8a0 net/core/sock.c:1584
sk_destruct net/core/sock.c:1599 [inline]
__sk_free+0x165/0x3b0 net/core/sock.c:1610
sk_free+0x3b/0x50 net/core/sock.c:1621
deferred_put_nlk_sk+0x10d/0x280 net/netlink/af_netlink.c:743
__rcu_reclaim kernel/rcu/rcu.h:236 [inline]
rcu_do_batch kernel/rcu/tree.c:2584 [inline]
invoke_rcu_callbacks kernel/rcu/tree.c:2897 [inline]
__rcu_process_callbacks kernel/rcu/tree.c:2864 [inline]
rcu_process_callbacks+0x8ff/0x18b0 kernel/rcu/tree.c:2881
__do_softirq+0x265/0x980 kernel/softirq.c:292

The buggy address belongs to the object at ffff8880a5802080
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
32-byte region [ffff8880a5802080, ffff8880a58020a0)
The buggy address belongs to the page:
page:ffffea0002960080 count:1 mapcount:0 mapping:ffff88813bff01c0 index:0xffff8880a5802fc1
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea00027f0808 ffffea0002bd6f48 ffff88813bff01c0
raw: ffff8880a5802fc1 ffff8880a5802000 000000010000002e 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a5801f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880a5802000: 06 fc fc fc fc fc fc fc 00 fc fc fc fc fc fc fc
>ffff8880a5802080: 01 fc fc fc fc fc fc fc 00 01 fc fc fc fc fc fc
^
ffff8880a5802100: 02 fc fc fc fc fc fc fc fb fb fb fb fc fc fc fc
ffff8880a5802180: 05 fc fc fc fc fc fc fc 00 01 fc fc fc fc fc fc
==================================================================


---
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.

syzbot

unread,
Jun 11, 2022, 7:58:24 PM6/11/22
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 3f8a27f9e27b Linux 4.19.211
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=119adbbff00000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=88471b70b068a105c1f8
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15dc07bff00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17296743f00000

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

vhci_hcd: connection closed
usb usb9: usbfs: process 21590 (syz-executor154) did not claim interface 0 before use
vhci_hcd vhci_hcd.0: port 2 already used
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:377 [inline]
BUG: KASAN: slab-out-of-bounds in usb_hcd_poll_rh_status+0x387/0x6f0 drivers/usb/core/hcd.c:771
Write of size 2 at addr ffff8880a5e5ff40 by task syz-executor154/21590

CPU: 1 PID: 21590 Comm: syz-executor154 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
kasan_report+0x8f/0xa0 mm/kasan/report.c:412
memcpy+0x35/0x50 mm/kasan/kasan.c:303
memcpy include/linux/string.h:377 [inline]
usb_hcd_poll_rh_status+0x387/0x6f0 drivers/usb/core/hcd.c:771
call_timer_fn+0x177/0x700 kernel/time/timer.c:1338
expire_timers+0x243/0x4e0 kernel/time/timer.c:1375
__run_timers kernel/time/timer.c:1696 [inline]
run_timer_softirq+0x21c/0x670 kernel/time/timer.c:1709
__do_softirq+0x265/0x980 kernel/softirq.c:292
invoke_softirq kernel/softirq.c:372 [inline]
irq_exit+0x215/0x260 kernel/softirq.c:412
exiting_irq arch/x86/include/asm/apic.h:536 [inline]
smp_apic_timer_interrupt+0x136/0x550 arch/x86/kernel/apic/apic.c:1098
apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:894
</IRQ>
RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:789 [inline]
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:160 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0xa3/0xe0 kernel/locking/spinlock.c:184
Code: 48 c7 c0 88 82 f1 89 48 ba 00 00 00 00 00 fc ff df 48 c1 e8 03 80 3c 10 00 75 2f 48 83 3d 7c 31 d8 01 00 74 15 48 89 df 57 9d <0f> 1f 44 00 00 eb b2 e8 fb eb e6 f8 eb c0 0f 0b 0f 0b 48 c7 c7 88
RSP: 0018:ffff8880924d79d0 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13
RAX: 1ffffffff13e3051 RBX: 0000000000000286 RCX: 0000000000000000
RDX: dffffc0000000000 RSI: 0000000000000001 RDI: 0000000000000286
RBP: ffffffff8d4469c8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: dead000000000200
R13: ffff888089e00000 R14: 0000000000000000 R15: dffffc0000000000
__debug_check_no_obj_freed lib/debugobjects.c:798 [inline]
debug_check_no_obj_freed+0x201/0x490 lib/debugobjects.c:817
free_pages_prepare mm/page_alloc.c:1056 [inline]
__free_pages_ok+0x22d/0xd30 mm/page_alloc.c:1279
release_pages+0xab5/0x15a0 mm/swap.c:768
tlb_flush_mmu_free mm/memory.c:261 [inline]
tlb_flush_mmu+0x1dc/0x4f0 mm/memory.c:270
arch_tlb_finish_mmu mm/memory.c:285 [inline]
tlb_finish_mmu+0x108/0x200 mm/memory.c:444
exit_mmap+0x2d9/0x530 mm/mmap.c:3095
__mmput kernel/fork.c:1016 [inline]
mmput+0x14e/0x4a0 kernel/fork.c:1037
exit_mm kernel/exit.c:549 [inline]
do_exit+0xaec/0x2be0 kernel/exit.c:857
do_group_exit+0x125/0x310 kernel/exit.c:967
__do_sys_exit_group kernel/exit.c:978 [inline]
__se_sys_exit_group kernel/exit.c:976 [inline]
__x64_sys_exit_group+0x3a/0x50 kernel/exit.c:976
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f3d2d3687f9
Code: Bad RIP value.
RSP: 002b:00007ffed7dd72a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007f3d2d3df3f0 RCX: 00007f3d2d3687f9
RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
RBP: 0000000000000000 R08: ffffffffffffffc0 R09: 0000000000000000
R10: 000000000000ffff R11: 0000000000000246 R12: 00007f3d2d3df3f0
R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001

Allocated by task 21590:
__do_kmalloc mm/slab.c:3727 [inline]
__kmalloc+0x15a/0x3c0 mm/slab.c:3736
kmalloc include/linux/slab.h:520 [inline]
proc_do_submiturb+0x2d17/0x3b00 drivers/usb/core/devio.c:1673
proc_submiturb drivers/usb/core/devio.c:1827 [inline]
usbdev_do_ioctl+0x773/0x3030 drivers/usb/core/devio.c:2481
usbdev_ioctl+0x21/0x30 drivers/usb/core/devio.c:2585
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:501 [inline]
do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
__do_sys_ioctl fs/ioctl.c:712 [inline]
__se_sys_ioctl fs/ioctl.c:710 [inline]
__x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 20295:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
security_sk_free+0x3e/0x70 security/security.c:1474
sk_prot_free net/core/sock.c:1516 [inline]
__sk_destruct+0x51d/0x8a0 net/core/sock.c:1602
sk_destruct net/core/sock.c:1617 [inline]
__sk_free+0x165/0x3b0 net/core/sock.c:1628
sk_free+0x3b/0x50 net/core/sock.c:1639
sock_put include/net/sock.h:1713 [inline]
unix_release_sock+0x87a/0xd60 net/unix/af_unix.c:582
unix_release+0x3f/0x80 net/unix/af_unix.c:878
__sock_release+0xcd/0x2a0 net/socket.c:599
sock_close+0x15/0x20 net/socket.c:1214
__fput+0x2ce/0x890 fs/file_table.c:278
task_work_run+0x148/0x1c0 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0xbf3/0x2be0 kernel/exit.c:870
do_group_exit+0x125/0x310 kernel/exit.c:967
__do_sys_exit_group kernel/exit.c:978 [inline]
__se_sys_exit_group kernel/exit.c:976 [inline]
__x64_sys_exit_group+0x3a/0x50 kernel/exit.c:976
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a5e5ff40
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
32-byte region [ffff8880a5e5ff40, ffff8880a5e5ff60)
The buggy address belongs to the page:
page:ffffea00029797c0 count:1 mapcount:0 mapping:ffff88813bff01c0 index:0xffff8880a5e5ffc1
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002ad5348 ffffea0002ae1f48 ffff88813bff01c0
raw: ffff8880a5e5ffc1 ffff8880a5e5f000 000000010000003f 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880a5e5fe00: 07 fc fc fc fc fc fc fc 00 00 01 fc fc fc fc fc
ffff8880a5e5fe80: 00 00 01 fc fc fc fc fc 00 00 03 fc fc fc fc fc
>ffff8880a5e5ff00: fb fb fb fb fc fc fc fc 01 fc fc fc fc fc fc fc
^
ffff8880a5e5ff80: 00 00 04 fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880a5e60000: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================
----------------
Code disassembly (best guess):
0: 48 c7 c0 88 82 f1 89 mov $0xffffffff89f18288,%rax
7: 48 ba 00 00 00 00 00 movabs $0xdffffc0000000000,%rdx
e: fc ff df
11: 48 c1 e8 03 shr $0x3,%rax
15: 80 3c 10 00 cmpb $0x0,(%rax,%rdx,1)
19: 75 2f jne 0x4a
1b: 48 83 3d 7c 31 d8 01 cmpq $0x0,0x1d8317c(%rip) # 0x1d8319f
22: 00
23: 74 15 je 0x3a
25: 48 89 df mov %rbx,%rdi
28: 57 push %rdi
29: 9d popfq
* 2a: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) <-- trapping instruction
2f: eb b2 jmp 0xffffffe3
31: e8 fb eb e6 f8 callq 0xf8e6ec31
36: eb c0 jmp 0xfffffff8
38: 0f 0b ud2
3a: 0f 0b ud2
3c: 48 rex.W
3d: c7 .byte 0xc7
3e: c7 (bad)
3f: 88 .byte 0x88

Reply all
Reply to author
Forward
0 new messages