KASAN: use-after-free Read in usblp_bulk_read (2)

5 views
Skip to first unread message

syzbot

unread,
Jul 22, 2020, 2:33:23 PM7/22/20
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: f932d58a Merge tag 'scsi-fixes' of git://git.kernel.org/pu..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14611bd0900000
kernel config: https://syzkaller.appspot.com/x/.config?x=600b4abe8ad1f838
dashboard link: https://syzkaller.appspot.com/bug?extid=2a0b15f48e551d23ad70
compiler: gcc (GCC) 10.1.0-syz 20200507
CC: [gre...@linuxfoundation.org linux-...@vger.kernel.org linu...@vger.kernel.org zai...@redhat.com]

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+2a0b15...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x3c7b/0x56e0 kernel/locking/lockdep.c:4250
Read of size 8 at addr ffff88801e938940 by task syz-executor.1/9508

CPU: 2 PID: 9508 Comm: syz-executor.1 Not tainted 5.8.0-rc5-syzkaller #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x18f/0x20d lib/dump_stack.c:118
print_address_description.constprop.0.cold+0xae/0x436 mm/kasan/report.c:383
__kasan_report mm/kasan/report.c:513 [inline]
kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
__lock_acquire+0x3c7b/0x56e0 kernel/locking/lockdep.c:4250
lock_acquire+0x1f1/0xad0 kernel/locking/lockdep.c:4959
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x8c/0xc0 kernel/locking/spinlock.c:159
usblp_bulk_read+0x211/0x270 drivers/usb/class/usblp.c:303
__usb_hcd_giveback_urb+0x30d/0x540 drivers/usb/core/hcd.c:1650
usb_hcd_giveback_urb+0x367/0x410 drivers/usb/core/hcd.c:1716
skbpoolfree drivers/block/aoe/aoedev.c:432 [inline]
freedev drivers/block/aoe/aoedev.c:290 [inline]
dummy_timer+0x11ea/0x2f9f drivers/block/aoe/aoedev.c:366
call_timer_fn+0x1ac/0x760 kernel/time/timer.c:1404
expire_timers kernel/time/timer.c:1449 [inline]
__run_timers.part.0+0x54c/0xa20 kernel/time/timer.c:1773
__run_timers kernel/time/timer.c:1745 [inline]
run_timer_softirq+0xae/0x1a0 kernel/time/timer.c:1786
__do_softirq+0x34c/0xa60 kernel/softirq.c:292
asm_call_on_stack+0xf/0x20 arch/x86/entry/entry_64.S:711
</IRQ>
__run_on_irqstack arch/x86/include/asm/irq_stack.h:22 [inline]
run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:48 [inline]
do_softirq_own_stack+0x111/0x170 arch/x86/kernel/irq_64.c:77
invoke_softirq kernel/softirq.c:387 [inline]
__irq_exit_rcu kernel/softirq.c:417 [inline]
irq_exit_rcu+0x229/0x270 kernel/softirq.c:429
sysvec_apic_timer_interrupt+0x54/0x120 arch/x86/kernel/apic/apic.c:1091
asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:587
RIP: 0010:qlist_free_all+0x2f/0x140 mm/kasan/quarantine.c:165
Code: 55 41 54 55 53 48 8b 1f 48 85 db 0f 84 08 01 00 00 48 89 f5 49 89 fd 48 85 ed 49 89 ee 0f 84 8b 00 00 00 49 63 86 3c 01 00 00 <4c> 8b 23 48 29 c3 48 83 3d 2b bf 01 08 00 0f 84 e6 00 00 00 9c 58
RSP: 0018:ffffc90001b27470 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff8880214bb380 RCX: ffffea00009d7e07
RDX: 0000000000000000 RSI: ffffffff8134589a RDI: 0000000000000007
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8880214bb380
R13: ffffc90001b274a8 R14: ffff88802c8001c0 R15: 0000000000000282
quarantine_reduce+0x17e/0x200 mm/kasan/quarantine.c:260
__kasan_kmalloc.constprop.0+0x9e/0xd0 mm/kasan/common.c:475
slab_post_alloc_hook mm/slab.h:586 [inline]
slab_alloc_node mm/slab.c:3263 [inline]
kmem_cache_alloc_node_trace+0x140/0x400 mm/slab.c:3593
kmalloc_node include/linux/slab.h:573 [inline]
kzalloc_node include/linux/slab.h:680 [inline]
__get_vm_area_node+0x126/0x3b0 mm/vmalloc.c:2105
__vmalloc_node_range mm/vmalloc.c:2536 [inline]
__vmalloc_node mm/vmalloc.c:2584 [inline]
vmalloc+0xf2/0x1a0 mm/vmalloc.c:2617
netlink_alloc_large_skb net/netlink/af_netlink.c:1180 [inline]
netlink_sendmsg+0x5f0/0xd90 net/netlink/af_netlink.c:1893
sock_sendmsg_nosec net/socket.c:652 [inline]
sock_sendmsg+0xcf/0x120 net/socket.c:672
sock_no_sendpage+0xee/0x130 net/core/sock.c:2853
kernel_sendpage net/socket.c:3642 [inline]
sock_sendpage+0xe5/0x140 net/socket.c:945
pipe_to_sendpage+0x2ad/0x380 fs/splice.c:448
splice_from_pipe_feed fs/splice.c:502 [inline]
__splice_from_pipe+0x3dc/0x830 fs/splice.c:626
splice_from_pipe fs/splice.c:661 [inline]
generic_splice_sendpage+0xd4/0x140 fs/splice.c:834
do_splice_from fs/splice.c:846 [inline]
direct_splice_actor+0x171/0x2f0 fs/splice.c:1016
splice_direct_to_actor+0x38c/0x980 fs/splice.c:971
do_splice_direct+0x1b3/0x280 fs/splice.c:1059
do_sendfile+0x559/0xc30 fs/read_write.c:1540
__do_sys_sendfile64 fs/read_write.c:1601 [inline]
__se_sys_sendfile64 fs/read_write.c:1587 [inline]
__x64_sys_sendfile64+0x1cc/0x210 fs/read_write.c:1587
do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45c049
Code: Bad RIP value.
RSP: 002b:00007f44175ebc88 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 0000000000713f40 RCX: 000000000045c049
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000005
RBP: 00000000004a906e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000100006800 R11: 0000000000000246 R12: 000000000074bf00
R13: 00007fff48702fef R14: 00007f44175cc000 R15: 0000000000000003

Allocated by task 61:
save_stack+0x1b/0x40 mm/kasan/common.c:48
set_track mm/kasan/common.c:56 [inline]
__kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:494
kmem_cache_alloc_trace+0x14f/0x2d0 mm/slab.c:3551
kmalloc include/linux/slab.h:555 [inline]
kzalloc include/linux/slab.h:669 [inline]
usblp_probe+0xed/0x1110 drivers/usb/class/usblp.c:1105
usb_probe_interface+0x2f7/0x780 drivers/usb/core/driver.c:374
really_probe+0x282/0x8a0 drivers/base/dd.c:520
driver_probe_device+0xfe/0x1d0 drivers/base/dd.c:696
__device_attach_driver+0x1c2/0x220 drivers/base/dd.c:802
bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:431
__device_attach+0x28d/0x3f0 drivers/base/dd.c:868
bus_probe_device+0x1e4/0x290 drivers/base/bus.c:491
device_add+0xacf/0x1be0 drivers/base/core.c:2700
usb_set_configuration+0xef6/0x17a0 drivers/usb/core/message.c:2032
usb_generic_driver_probe+0xba/0xf2 drivers/usb/core/generic.c:241
usb_probe_device+0xc6/0x210 drivers/usb/core/driver.c:272
really_probe+0x282/0x8a0 drivers/base/dd.c:520
driver_probe_device+0xfe/0x1d0 drivers/base/dd.c:696
__device_attach_driver+0x1c2/0x220 drivers/base/dd.c:802
bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:431
__device_attach+0x28d/0x3f0 drivers/base/dd.c:868
bus_probe_device+0x1e4/0x290 drivers/base/bus.c:491
device_add+0xacf/0x1be0 drivers/base/core.c:2700
usb_new_device.cold+0x748/0x103b drivers/usb/core/hub.c:2554
hub_port_connect drivers/usb/core/hub.c:5208 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5348 [inline]
port_event drivers/usb/core/hub.c:5494 [inline]
hub_event+0x2033/0x3e40 drivers/usb/core/hub.c:5576
process_one_work+0x94c/0x1670 kernel/workqueue.c:2269
worker_thread+0x64c/0x1120 kernel/workqueue.c:2415
kthread+0x3b5/0x4a0 kernel/kthread.c:291
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:293

Freed by task 9476:
save_stack+0x1b/0x40 mm/kasan/common.c:48
set_track mm/kasan/common.c:56 [inline]
kasan_set_free_info mm/kasan/common.c:316 [inline]
__kasan_slab_free+0xf5/0x140 mm/kasan/common.c:455
__cache_free mm/slab.c:3426 [inline]
kfree+0x103/0x2c0 mm/slab.c:3757
usblp_release.cold+0xd/0x12 drivers/usb/class/usblp.c:471
__fput+0x33c/0x880 fs/file_table.c:281
task_work_run+0xdd/0x190 kernel/task_work.c:135
tracehook_notify_resume include/linux/tracehook.h:188 [inline]
exit_to_usermode_loop arch/x86/entry/common.c:239 [inline]
__prepare_exit_to_usermode+0x1e9/0x1f0 arch/x86/entry/common.c:269
do_syscall_64+0x6c/0xe0 arch/x86/entry/common.c:393
entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff88801e938800
which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 320 bytes inside of
1024-byte region [ffff88801e938800, ffff88801e938c00)
The buggy address belongs to the page:
page:ffffea00007a4e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88801e938000
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea00008f7f88 ffffea00003fc5c8 ffff88802c800c40
raw: ffff88801e938000 ffff88801e938000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88801e938800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801e938880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88801e938900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88801e938980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801e938a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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,
Nov 18, 2020, 5:11:13 PM11/18/20
to syzkaller-upst...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages