syzbot


KASAN: slab-out-of-bounds Read in read_descriptors (2)

Status: fixed on 2020/10/10 01:52
Subsystems: usb
[Documentation on labels]
Reported-by: syzbot+256e56ddde8b8957eabd@syzkaller.appspotmail.com
Fix commit: a18cd6c9b6bc usb: core: fix slab-out-of-bounds Read in read_descriptors
First crash: 1554d, last: 1554d
Discussions (8)
Title Replies (including bot) Last reply
[PATCH 4.19 00/78] 4.19.146-rc1 review 95 (95) 2020/09/23 18:57
[PATCH 4.14 00/94] 4.14.199-rc1 review 97 (97) 2020/09/22 20:18
[PATCH 4.9 00/70] 4.9.237-rc1 review 73 (73) 2020/09/22 20:17
[PATCH 5.8 000/177] 5.8.10-rc1 review 196 (196) 2020/09/17 17:40
[PATCH 5.4 000/132] 5.4.66-rc1 review 139 (139) 2020/09/15 16:41
[PATCH] usb: core: fix slab-out-of-bounds Read in read_descriptors 1 (1) 2020/09/04 06:37
[PATCH] USB: core: limit access to rawdescriptors which were not allocated 5 (5) 2020/08/26 06:56
KASAN: slab-out-of-bounds Read in read_descriptors (2) 0 (1) 2020/08/25 06:03
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: slab-out-of-bounds Read in read_descriptors origin:upstream C error 1 480d 524d 0/3 auto-obsoleted due to no activity on 2023/11/08 10:43
linux-5.15 KASAN: slab-out-of-bounds Read in read_descriptors origin:upstream missing-backport C error 2 433d 524d 0/3 auto-obsoleted due to no activity on 2024/10/04 16:22
upstream KASAN: slab-out-of-bounds Read in read_descriptors usb 1 1859d 1857d 0/28 auto-closed as invalid on 2020/02/18 03:02
upstream KASAN: slab-out-of-bounds Read in read_descriptors (3) usb C error 7 494d 521d 23/28 fixed on 2023/10/12 12:48

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in read_descriptors+0x25f/0x280 drivers/usb/core/sysfs.c:903
Read of size 8 at addr ffff88809100b848 by task systemd-udevd/22769

CPU: 1 PID: 22769 Comm: systemd-udevd Not tainted 5.9.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x18f/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 read_descriptors+0x25f/0x280 drivers/usb/core/sysfs.c:903
 sysfs_kf_bin_read+0x196/0x270 fs/sysfs/file.c:99
 kernfs_file_direct_read fs/kernfs/file.c:213 [inline]
 kernfs_fop_read+0x2eb/0x590 fs/kernfs/file.c:253
 vfs_read+0x1df/0x5a0 fs/read_write.c:479
 ksys_read+0x12d/0x250 fs/read_write.c:607
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f6f8ba80210
Code: 73 01 c3 48 8b 0d 98 7d 20 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d b9 c1 20 00 00 75 10 b8 00 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 4e fc ff ff 48 89 04 24
RSP: 002b:00007ffecd2e3168 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00005600a56b04a0 RCX: 00007f6f8ba80210
RDX: 0000000000010011 RSI: 00007ffecd2e3190 RDI: 0000000000000007
RBP: 0000000000000000 R08: 00005600a56b5d00 R09: 0000000000000001
R10: 0000000000000073 R11: 0000000000000246 R12: 00005600a56a6690
R13: 0000000000000007 R14: 00007ffecd2e3190 R15: 0000000000000000

Allocated by task 29772:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461
 __do_kmalloc mm/slab.c:3655 [inline]
 __kmalloc+0x1a8/0x320 mm/slab.c:3664
 kmalloc include/linux/slab.h:559 [inline]
 kzalloc include/linux/slab.h:666 [inline]
 usb_get_configuration+0x186/0x3840 drivers/usb/core/config.c:887
 usb_enumerate_device drivers/usb/core/hub.c:2387 [inline]
 usb_new_device+0x387/0x6d0 drivers/usb/core/hub.c:2523
 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:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294

The buggy address belongs to the object at ffff88809100b840
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 8 bytes inside of
 32-byte region [ffff88809100b840, ffff88809100b860)
The buggy address belongs to the page:
page:00000000227ef938 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88809100bfc1 pfn:0x9100b
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea00015c1948 ffffea00007fcd88 ffff8880aa040100
raw: ffff88809100bfc1 ffff88809100b000 000000010000003f 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809100b700: 05 fc fc fc fc fc fc fc fa fb fb fb fc fc fc fc
 ffff88809100b780: 05 fc fc fc fc fc fc fc fa fb fb fb fc fc fc fc
>ffff88809100b800: 06 fc fc fc fc fc fc fc 00 fc fc fc fc fc fc fc
                                              ^
 ffff88809100b880: 00 00 00 fc fc fc fc fc 00 04 fc fc fc fc fc fc
 ffff88809100b900: 00 05 fc fc fc fc fc fc 05 fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/08/21 04:40 upstream da2968ff879b 1d75fe45 .config console log report ci-upstream-kasan-gce
* Struck through repros no longer work on HEAD.