syzbot


KASAN: slab-out-of-bounds Read in vhci_hub_control

Status: fixed on 2018/10/30 01:28
Subsystems: usb
[Documentation on labels]
Reported-by: syzbot+bccc1fe10b70fadc78d0@syzkaller.appspotmail.com
Fix commit: 81f7567c51ad usb: usbip: Fix BUG: KASAN: slab-out-of-bounds in vhci_hub_control()
First crash: 2057d, last: 2008d
Discussions (6)
Title Replies (including bot) Last reply
[PATCH 3.16 000/328] 3.16.62-rc1 review 338 (338) 2018/12/16 22:01
[PATCH 4.18 00/34] 4.18.18-stable review 41 (41) 2018/11/10 15:24
[PATCH 4.14 00/31] 4.14.80-stable review 42 (42) 2018/11/10 15:24
usbip: vhci_hcd: Check rhport everywhere in vhci_hub_control() 1 (1) 2018/10/11 14:37
KASAN: slab-out-of-bounds Read in vhci_hub_control 8 (9) 2018/10/11 07:48
[PATCH] selftests: usbip: add wait after attach and before checking port status 2 (2) 2018/10/05 22:17

Sample crash report:
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
vhci_hcd: invalid port number 132
==================================================================
BUG: KASAN: slab-out-of-bounds in vhci_hub_control+0x1b88/0x1bf0 drivers/usb/usbip/vhci_hcd.c:441
Read of size 4 at addr ffff8801ce615ebc by task syz-executor741/4647

CPU: 1 PID: 4647 Comm: syz-executor741 Not tainted 4.19.0-rc1+ #217
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+0x1c9/0x2b4 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x30d mm/kasan/report.c:412
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:432
 vhci_hub_control+0x1b88/0x1bf0 drivers/usb/usbip/vhci_hcd.c:441
 rh_call_control drivers/usb/core/hcd.c:679 [inline]
 rh_urb_enqueue drivers/usb/core/hcd.c:838 [inline]
 usb_hcd_submit_urb+0x184a/0x2160 drivers/usb/core/hcd.c:1651
 usb_submit_urb+0x895/0x14d0 drivers/usb/core/urb.c:570
 usb_start_wait_urb+0x140/0x360 drivers/usb/core/message.c:57
 usb_internal_control_msg drivers/usb/core/message.c:101 [inline]
 usb_control_msg+0x332/0x4e0 drivers/usb/core/message.c:152
 proc_control+0x99b/0xef0 drivers/usb/core/devio.c:1106
 usbdev_do_ioctl+0x1eb4/0x3b30 drivers/usb/core/devio.c:2394
 usbdev_ioctl+0x25/0x30 drivers/usb/core/devio.c:2551
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0x1de/0x1720 fs/ioctl.c:685
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:702
 __do_sys_ioctl fs/ioctl.c:709 [inline]
 __se_sys_ioctl fs/ioctl.c:707 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:707
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x449329
Code: e8 ac b7 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 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 0f 83 ab d6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f8653ff9da8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00000000006dac28 RCX: 0000000000449329
RDX: 0000000020000100 RSI: 00000000c0185500 RDI: 0000000000000003
RBP: 00000000006dac20 R08: 00000000006dac2c R09: 0000000000000000
R10: 00007f8653ffa700 R11: 0000000000000246 R12: 00000000006dac2c
R13: 2330302f6273752f R14: 7375622f7665642f R15: 00000000006dad2c

Allocated by task 1:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 kmem_cache_alloc_trace+0x152/0x730 mm/slab.c:3620
 kmalloc include/linux/slab.h:513 [inline]
 kzalloc include/linux/slab.h:707 [inline]
 usb_set_configuration+0x10e9/0x19f0 drivers/usb/core/message.c:1834
 generic_probe+0xb6/0x110 drivers/usb/core/generic.c:174
 usb_probe_device+0xaf/0x110 drivers/usb/core/driver.c:266
 really_probe+0x5be/0x850 drivers/base/dd.c:500
 driver_probe_device+0x108/0x210 drivers/base/dd.c:662
 __device_attach_driver+0x25a/0x2d0 drivers/base/dd.c:758
 bus_for_each_drv+0x16b/0x1f0 drivers/base/bus.c:461
 __device_attach+0x2a1/0x430 drivers/base/dd.c:815
 device_initial_probe+0x1a/0x20 drivers/base/dd.c:862
 bus_probe_device+0x1fb/0x2a0 drivers/base/bus.c:521
 device_add+0x93e/0x17b0 drivers/base/core.c:1927
 usb_new_device+0x8ac/0x12b0 drivers/usb/core/hub.c:2485
 register_root_hub drivers/usb/core/hcd.c:1105 [inline]
 usb_add_hcd+0xb1f/0x1910 drivers/usb/core/hcd.c:2882
 vhci_hcd_probe+0xfb/0x240 drivers/usb/usbip/vhci_hcd.c:1316
 platform_drv_probe+0x96/0x160 drivers/base/platform.c:579
 really_probe+0x5be/0x850 drivers/base/dd.c:500
 driver_probe_device+0x108/0x210 drivers/base/dd.c:662
 __device_attach_driver+0x25a/0x2d0 drivers/base/dd.c:758
 bus_for_each_drv+0x16b/0x1f0 drivers/base/bus.c:461
 __device_attach+0x2a1/0x430 drivers/base/dd.c:815
 device_initial_probe+0x1a/0x20 drivers/base/dd.c:862
 bus_probe_device+0x1fb/0x2a0 drivers/base/bus.c:521
 device_add+0x93e/0x17b0 drivers/base/core.c:1927
 platform_device_add+0x36e/0x6f0 drivers/base/platform.c:417
 vhci_hcd_init+0x386/0x4e0 drivers/usb/usbip/vhci_hcd.c:1500
 do_one_initcall+0x127/0x838 init/main.c:885
 do_initcall_level init/main.c:953 [inline]
 do_initcalls init/main.c:961 [inline]
 do_basic_setup init/main.c:979 [inline]
 kernel_init_freeable+0x4bb/0x5ae init/main.c:1144
 kernel_init+0x11/0x1b3 init/main.c:1063
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:413

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8801ce615300
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 956 bytes to the right of
 2048-byte region [ffff8801ce615300, ffff8801ce615b00)
The buggy address belongs to the page:
page:ffffea0007398500 count:1 mapcount:0 mapping:ffff8801dac00c40 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffffea0007397988 ffffea0007398788 ffff8801dac00c40
raw: 0000000000000000 ffff8801ce614200 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801ce615d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801ce615e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8801ce615e80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                        ^
 ffff8801ce615f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8801ce615f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (43):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/09/01 09:27 upstream 420f51f4ab6b a4718693 .config console log report syz C ci-upstream-kasan-gce
2018/08/31 18:47 linux-next a880148cb2af a4718693 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2018/10/19 13:50 upstream 91b15613ce7f 9aba67b5 .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/18 13:22 upstream 9bd871df56a7 d257b2d2 .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/18 01:26 upstream c343db455eb3 b2695b95 .config console log report ci-upstream-kasan-gce-root
2018/10/18 01:23 upstream c343db455eb3 b2695b95 .config console log report ci-upstream-kasan-gce
2018/10/18 01:23 upstream c343db455eb3 b2695b95 .config console log report ci-upstream-kasan-gce-root
2018/10/18 01:22 upstream c343db455eb3 b2695b95 .config console log report ci-upstream-kasan-gce-smack-root
2018/10/17 04:26 upstream b955a910d7fd 1ba7fd7e .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/16 14:37 upstream f0a7d1883d9f 1ba7fd7e .config console log report ci-upstream-kasan-gce
2018/10/15 20:45 upstream f0a7d1883d9f 8cd30605 .config console log report ci-upstream-kasan-gce
2018/10/14 13:12 upstream 3a27203102eb caf12900 .config console log report ci-upstream-kasan-gce
2018/10/13 20:22 upstream 7ec21823634d caf12900 .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/13 15:17 upstream bab5c80b2110 caf12900 .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/12 04:38 upstream 9dcd936c5312 ba6ddb43 .config console log report ci-upstream-kasan-gce-smack-root
2018/10/12 04:35 upstream 9dcd936c5312 ba6ddb43 .config console log report ci-upstream-kasan-gce
2018/10/11 01:19 upstream b8db9e69dba9 5f818b4b .config console log report ci-upstream-kasan-gce
2018/10/09 12:14 upstream 64c5e530ac2c 8b311eaf .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/07 02:39 upstream c1d84a1b42ef 8b311eaf .config console log report ci-upstream-kasan-gce-root
2018/10/05 01:54 upstream 10be83cc6418 8b311eaf .config console log report ci-upstream-kasan-gce-smack-root
2018/10/04 04:28 upstream cec4de302c5f 8b311eaf .config console log report ci-upstream-kasan-gce-selinux-root
2018/10/03 19:21 upstream 6bebe37927f3 8b311eaf .config console log report ci-upstream-kasan-gce-root
2018/10/03 19:21 upstream 6bebe37927f3 8b311eaf .config console log report ci-upstream-kasan-gce
2018/09/29 11:53 upstream e704966c45e4 41e4b329 .config console log report ci-upstream-kasan-gce
2018/09/29 10:04 upstream e704966c45e4 41e4b329 .config console log report ci-upstream-kasan-gce-smack-root
2018/09/28 19:01 upstream ad0371482b1e 137d7c66 .config console log report ci-upstream-kasan-gce-selinux-root
2018/09/25 05:51 upstream 02214bfc89c7 0e7547d7 .config console log report ci-upstream-kasan-gce-selinux-root
2018/09/01 19:05 upstream 420f51f4ab6b a4718693 .config console log report ci-upstream-kasan-gce
2018/09/01 17:59 upstream 420f51f4ab6b a4718693 .config console log report ci-upstream-kasan-gce
2018/09/01 15:50 upstream 420f51f4ab6b a4718693 .config console log report ci-upstream-kasan-gce
2018/09/01 11:06 upstream 420f51f4ab6b a4718693 .config console log report ci-upstream-kasan-gce
2018/09/01 06:07 upstream 420f51f4ab6b a4718693 .config console log report ci-upstream-kasan-gce
2018/10/15 13:55 upstream 35a7f35ad1b1 caf12900 .config console log report ci-upstream-kasan-gce-386
2018/10/15 02:33 upstream 3a27203102eb caf12900 .config console log report ci-upstream-kasan-gce-386
2018/10/13 19:46 upstream 7ec21823634d caf12900 .config console log report ci-upstream-kasan-gce-386
2018/10/13 11:33 upstream bab5c80b2110 caf12900 .config console log report ci-upstream-kasan-gce-386
2018/10/02 22:22 upstream 1d2ba7fee28b a316a2af .config console log report ci-upstream-kasan-gce-386
2018/10/13 11:38 linux-next 774ea0551a29 caf12900 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/10/01 00:53 linux-next 4794a36bf08d 41e4b329 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/09/21 15:15 linux-next 46c163a036b4 37079712 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/09/10 03:45 linux-next f2b6e66e9885 6b5120a4 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/08/31 17:44 linux-next a880148cb2af a4718693 .config console log report ci-upstream-linux-next-kasan-gce-root
2018/08/31 17:41 linux-next a880148cb2af a4718693 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.