KASAN: slab-out-of-bounds Write in usb_hcd_poll_rh_status

26 views
Skip to first unread message

syzbot

unread,
Sep 1, 2020, 11:08:19 AM9/1/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: f6d5cb9e Linux 4.19.142
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1609da25900000
kernel config: https://syzkaller.appspot.com/x/.config?x=30067df04d3254aa
dashboard link: https://syzkaller.appspot.com/bug?extid=0158aeaaf21c1e19fac4
compiler: gcc (GCC) 10.1.0-syz 20200507

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+0158ae...@syzkaller.appspotmail.com

usb usb9: usbfs: process 11235 (syz-executor.5) did not claim interface 0 before use
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:373 [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 ffff88808d3f5980 by task syz-executor.1/11236

CPU: 0 PID: 11236 Comm: syz-executor.1 Not tainted 4.19.142-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/0x2fe lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1c7 mm/kasan/report.c:354
kasan_report+0x8f/0x96 mm/kasan/report.c:412
memcpy+0x35/0x50 mm/kasan/kasan.c:303
memcpy include/linux/string.h:373 [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:1703 [inline]
run_timer_softirq+0x21c/0x670 kernel/time/timer.c:1716
__do_softirq+0x26c/0x9a0 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:544 [inline]
smp_apic_timer_interrupt+0x136/0x550 arch/x86/kernel/apic/apic.c:1094
apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:894
</IRQ>
RIP: 0010:check_kcov_mode kernel/kcov.c:67 [inline]
RIP: 0010:__sanitizer_cov_trace_pc+0x14/0x50 kernel/kcov.c:101
Code: e8 80 0c eb ff 48 c7 05 c6 2b 28 0a 00 00 00 00 e9 39 ec ff ff 90 48 8b 34 24 65 48 8b 04 25 40 ee 01 00 65 8b 15 3c 3c 98 7e <81> e2 00 01 1f 00 75 2b 8b 90 d8 12 00 00 83 fa 02 75 20 48 8b 88
RSP: 0018:ffff888219057ab8 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13
RAX: ffff8882035c6700 RBX: 0000000000000200 RCX: ffffffff81b7c519
RDX: 0000000080000000 RSI: ffffffff81b7c559 RDI: 0000000000000007
RBP: dffffc0000000000 R08: 0000000000000422 R09: 0000000000000000
R10: 0000000000000007 R11: 0000000000000000 R12: ffff8882162e6700
R13: 000000000000043e R14: 0000000000000010 R15: 0000000000000003
arch_local_irq_disable arch/x86/include/asm/paravirt.h:794 [inline]
lookup_bh_lru fs/buffer.c:1260 [inline]
__find_get_block+0xa9/0xde0 fs/buffer.c:1291
sb_find_get_block include/linux/buffer_head.h:346 [inline]
recently_deleted fs/ext4/ialloc.c:685 [inline]
find_inode_bit+0x213/0x520 fs/ext4/ialloc.c:725
__ext4_new_inode+0x160c/0x5a20 fs/ext4/ialloc.c:917
ext4_symlink+0x3f5/0xc00 fs/ext4/namei.c:3146
vfs_symlink+0x453/0x6c0 fs/namei.c:4129
do_symlinkat+0x258/0x2c0 fs/namei.c:4156
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45d2e7
Code: 0f 1f 00 b8 5c 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 1d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 b8 58 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 fd b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffce6220878 EFLAGS: 00000206 ORIG_RAX: 0000000000000058
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000045d2e7
RDX: 00007ffce6220913 RSI: 00000000004c30cd RDI: 00007ffce6220900
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000013
R10: 0000000000000075 R11: 0000000000000206 R12: 0000000000000000
R13: 00007ffce62208b0 R14: 0000000000000000 R15: 00007ffce62208c0

Allocated by task 11235:
__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 4026:
__cache_free mm/slab.c:3503 [inline]
kfree+0xcc/0x210 mm/slab.c:3822
security_context_to_sid_core+0x2ce/0x590 security/selinux/ss/services.c:1504
security_context_to_sid+0x35/0x40 security/selinux/ss/services.c:1525
selinux_inode_setsecurity+0x197/0x3d0 security/selinux/hooks.c:3501
selinux_inode_notifysecctx+0x2b/0x60 security/selinux/hooks.c:6667
security_inode_notifysecctx+0x50/0xb0 security/security.c:1343
kernfs_refresh_inode+0x328/0x4b0 fs/kernfs/inode.c:195
kernfs_iop_permission+0x6a/0xb0 fs/kernfs/inode.c:302
do_inode_permission fs/namei.c:386 [inline]
inode_permission.part.0+0x276/0x450 fs/namei.c:451
inode_permission fs/namei.c:432 [inline]
may_lookup fs/namei.c:1703 [inline]
link_path_walk.part.0+0x952/0x1230 fs/namei.c:2085
link_path_walk fs/namei.c:2270 [inline]
path_lookupat+0xe4/0x8d0 fs/namei.c:2318
filename_lookup+0x1ac/0x5a0 fs/namei.c:2349
do_readlinkat+0xcd/0x2f0 fs/stat.c:394
__do_sys_readlinkat fs/stat.c:421 [inline]
__se_sys_readlinkat fs/stat.c:418 [inline]
__x64_sys_readlinkat+0x93/0xf0 fs/stat.c:418
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 ffff88808d3f5980
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
32-byte region [ffff88808d3f5980, ffff88808d3f59a0)
The buggy address belongs to the page:
page:ffffea000234fd40 count:1 mapcount:0 mapping:ffff88812c39c1c0 index:0xffff88808d3f5fc1
flags: 0xfffe0000000100(slab)
raw: 00fffe0000000100 ffffea000278c408 ffffea0002a396c8 ffff88812c39c1c0
raw: ffff88808d3f5fc1 ffff88808d3f5000 0000000100000039 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88808d3f5880: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
ffff88808d3f5900: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff88808d3f5980: 01 fc fc fc fc fc fc fc fb fb fb fb fc fc fc fc
^
ffff88808d3f5a00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
ffff88808d3f5a80: fb fb fb fb fc fc fc fc fb fb fb fb 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,
Jan 2, 2021, 3:21:11 AM1/2/21
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.

syzbot

unread,
Jan 5, 2021, 4:57:14 AM1/5/21
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 17529385 Linux 4.14.213
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=133282b3500000
kernel config: https://syzkaller.appspot.com/x/.config?x=f94010bb59bd4675
dashboard link: https://syzkaller.appspot.com/bug?extid=92130a4bfe5658805cf6
compiler: gcc (GCC) 10.1.0-syz 20200507

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+92130a...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:372 [inline]
BUG: KASAN: slab-out-of-bounds in usb_hcd_poll_rh_status+0x326/0x630 drivers/usb/core/hcd.c:782
Write of size 2 at addr ffff8880b2f63380 by task syz-executor.1/26823

CPU: 0 PID: 26823 Comm: syz-executor.1 Not tainted 4.14.213-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:17 [inline]
dump_stack+0x1b2/0x283 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x194 mm/kasan/report.c:351
kasan_report+0x6f/0x7b mm/kasan/report.c:409
memcpy+0x35/0x50 mm/kasan/kasan.c:303
memcpy include/linux/string.h:372 [inline]
usb_hcd_poll_rh_status+0x326/0x630 drivers/usb/core/hcd.c:782
call_timer_fn+0x14a/0x650 kernel/time/timer.c:1280
expire_timers+0x232/0x4d0 kernel/time/timer.c:1319
__run_timers kernel/time/timer.c:1637 [inline]
run_timer_softirq+0x1d5/0x5a0 kernel/time/timer.c:1650
__do_softirq+0x254/0xa1d kernel/softirq.c:288
invoke_softirq kernel/softirq.c:368 [inline]
irq_exit+0x193/0x240 kernel/softirq.c:409
exiting_irq arch/x86/include/asm/apic.h:648 [inline]
smp_apic_timer_interrupt+0x141/0x5e0 arch/x86/kernel/apic/apic.c:1102
apic_timer_interrupt+0x93/0xa0 arch/x86/entry/entry_64.S:793
</IRQ>
RIP: 0010:arch_local_irq_restore arch/x86/include/asm/paravirt.h:779 [inline]
RIP: 0010:lock_acquire+0x1ec/0x3f0 kernel/locking/lockdep.c:4001
RSP: 0018:ffff88809586f3e0 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff10
RAX: 1ffffffff11e1251 RBX: ffff888054e7c580 RCX: c02a250b657a8078
RDX: dffffc0000000000 RSI: 0000000000000001 RDI: 0000000000000286
RBP: ffffffff88f77640 R08: 0000000000000000 R09: 0000000000020012
R10: ffff888054e7ce30 R11: ffff888054e7c580 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000002 R15: 0000000000000000
rcu_lock_acquire include/linux/rcupdate.h:242 [inline]
rcu_read_lock include/linux/rcupdate.h:629 [inline]
is_bpf_text_address+0x35/0x150 kernel/bpf/core.c:456
kernel_text_address kernel/extable.c:150 [inline]
kernel_text_address+0xbd/0xf0 kernel/extable.c:120
__kernel_text_address+0x9/0x30 kernel/extable.c:105
unwind_get_return_address arch/x86/kernel/unwind_orc.c:252 [inline]
unwind_get_return_address+0x51/0x90 arch/x86/kernel/unwind_orc.c:247
__save_stack_trace+0xa0/0x160 arch/x86/kernel/stacktrace.c:45
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
kmem_cache_alloc_node_trace+0x153/0x400 mm/slab.c:3661
__do_kmalloc_node mm/slab.c:3681 [inline]
__kmalloc_node_track_caller+0x38/0x70 mm/slab.c:3696
__kmalloc_reserve net/core/skbuff.c:137 [inline]
__alloc_skb+0x96/0x510 net/core/skbuff.c:205
alloc_skb_fclone include/linux/skbuff.h:1022 [inline]
sk_stream_alloc_skb+0xb1/0x760 net/ipv4/tcp.c:855
tso_fragment net/ipv4/tcp_output.c:1860 [inline]
tcp_write_xmit+0x1cdb/0x5570 net/ipv4/tcp_output.c:2378
__tcp_push_pending_frames+0xa0/0x2d0 net/ipv4/tcp_output.c:2580
tcp_push_pending_frames include/net/tcp.h:1778 [inline]
tcp_data_snd_check net/ipv4/tcp_input.c:5132 [inline]
tcp_rcv_established+0x71a/0x1810 net/ipv4/tcp_input.c:5581
tcp_v4_do_rcv+0x541/0x7d0 net/ipv4/tcp_ipv4.c:1476
sk_backlog_rcv include/net/sock.h:921 [inline]
__release_sock+0x12a/0x350 net/core/sock.c:2269
__sk_flush_backlog+0x22/0x30 net/core/sock.c:2289
sk_flush_backlog include/net/sock.h:1008 [inline]
tcp_sendmsg_locked+0x2486/0x2ef0 net/ipv4/tcp.c:1296
tcp_sendmsg+0x2b/0x40 net/ipv4/tcp.c:1457
inet_sendmsg+0x11a/0x4e0 net/ipv4/af_inet.c:762
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
SYSC_sendto net/socket.c:1763 [inline]
SyS_sendto+0x1c7/0x2c0 net/socket.c:1731
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x45e219
RSP: 002b:00007f3a98f94c68 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 000000000045e219
RDX: 000000000000fe6a RSI: 00000000200012c0 RDI: 0000000000000004
RBP: 000000000119bfd8 R08: 0000000000000000 R09: fffffffffffffe2b
R10: 000000000000000e R11: 0000000000000246 R12: 000000000119bf8c
R13: 00007ffce5914f2f R14: 00007f3a98f959c0 R15: 000000000119bf8c

Allocated by task 26858:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
__do_kmalloc mm/slab.c:3720 [inline]
__kmalloc+0x15a/0x400 mm/slab.c:3729
kmalloc include/linux/slab.h:493 [inline]
proc_do_submiturb+0x280f/0x3610 drivers/usb/core/devio.c:1684
proc_submiturb drivers/usb/core/devio.c:1841 [inline]
usbdev_do_ioctl+0x665/0x2b70 drivers/usb/core/devio.c:2495
usbdev_ioctl+0x21/0x30 drivers/usb/core/devio.c:2599
vfs_ioctl fs/ioctl.c:46 [inline]
file_ioctl fs/ioctl.c:500 [inline]
do_vfs_ioctl+0x75a/0xff0 fs/ioctl.c:684
SYSC_ioctl fs/ioctl.c:701 [inline]
SyS_ioctl+0x7f/0xb0 fs/ioctl.c:692
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 25727:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xc9/0x250 mm/slab.c:3815
aa_free_task_context+0xda/0x130 security/apparmor/context.c:54
apparmor_cred_free+0x34/0x70 security/apparmor/lsm.c:58
security_cred_free+0x71/0xb0 security/security.c:1003
put_cred_rcu+0xe3/0x300 kernel/cred.c:117
__put_cred+0x1a1/0x210 kernel/cred.c:151
put_cred include/linux/cred.h:271 [inline]
SYSC_faccessat fs/open.c:444 [inline]
SyS_faccessat+0x52a/0x680 fs/open.c:353
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880b2f63380
which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
32-byte region [ffff8880b2f63380, ffff8880b2f633a0)
The buggy address belongs to the page:
page:ffffea0002cbd8c0 count:1 mapcount:0 mapping:ffff8880b2f63000 index:0xffff8880b2f63fc1
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880b2f63000 ffff8880b2f63fc1 000000010000003f
raw: ffffea0002d310e0 ffffea000284c320 ffff88813fe801c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880b2f63280: 00 01 fc fc fc fc fc fc fb fb fb fb fc fc fc fc
ffff8880b2f63300: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff8880b2f63380: 01 fc fc fc fc fc fc fc 00 04 fc fc fc fc fc fc
^
ffff8880b2f63400: 00 00 03 fc fc fc fc fc fb fb fb fb fc fc fc fc
ffff8880b2f63480: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc

syzbot

unread,
Sep 14, 2021, 10:45:16 AM9/14/21
to syzkaller...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages