syzbot


KASAN: use-after-free Read in destroy_async_on_interface

Status: fixed on 2018/10/11 14:33
Subsystems: usb
[Documentation on labels]
Reported-by: syzbot+f84aa7209ccec829536f@syzkaller.appspotmail.com
Fix commit: bd729f9d67aa USB: fix error handling in usb_driver_claim_interface()
First crash: 2061d, last: 2035d
Discussions (8)
Title Replies (including bot) Last reply
[PATCH 3.16 000/328] 3.16.62-rc1 review 338 (338) 2018/12/16 22:01
[PATCH 3.18 000/120] 3.18.124-stable review 134 (134) 2018/10/13 06:42
[PATCH 4.4 000/113] 4.4.160-stable review 129 (129) 2018/10/10 15:03
[PATCH 4.18 000/228] 4.18.12-stable review 243 (243) 2018/10/08 19:59
[PATCH 4.14 000/137] 4.14.74-stable review 145 (145) 2018/10/04 15:44
[PATCH 4.9 00/94] 4.9.131-stable review 99 (99) 2018/10/03 19:50
[2/2] USB: fix error handling in usb_driver_claim_interface() 1 (1) 2018/09/10 17:59
KASAN: use-after-free Read in destroy_async_on_interface 0 (1) 2018/09/03 17:51

Sample crash report:
RDX: 0000000020000280 RSI: 000000008108551b RDI: 0000000000000003
RBP: 00007ffcce5daab0 R08: 0000000000000001 R09: 0000000000000000
R10: 000000000000000a R11: 0000000000000246 R12: ffffffffffffffff
R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000000
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x3829/0x5020 kernel/locking/lockdep.c:3291
Read of size 8 at addr ffff8801b87825b8 by task syz-executor735/4685

CPU: 0 PID: 4685 Comm: syz-executor735 Not tainted 4.19.0-rc1-next-20180830+ #52
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_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 __lock_acquire+0x3829/0x5020 kernel/locking/lockdep.c:3291
 lock_acquire+0x1e4/0x4f0 kernel/locking/lockdep.c:3901
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x96/0xc0 kernel/locking/spinlock.c:152
 destroy_async_on_interface+0x155/0x5c0 drivers/usb/core/devio.c:653
 driver_disconnect+0xea/0x150 drivers/usb/core/devio.c:699
 usb_unbind_interface+0x25a/0xbe0 drivers/usb/core/driver.c:423
 __device_release_driver drivers/base/dd.c:966 [inline]
 device_release_driver_internal+0x651/0x750 drivers/base/dd.c:999
 device_release_driver+0x19/0x20 drivers/base/dd.c:1024
 usb_driver_release_interface+0x110/0x190 drivers/usb/core/driver.c:604
 proc_disconnect_claim+0x288/0x410 drivers/usb/core/devio.c:2281
 usbdev_do_ioctl+0x17ee/0x3b30 drivers/usb/core/devio.c:2523
 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:0x444ca9
Code: e8 0c ad 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 db ce fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffcce5daa98 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000444ca9
RDX: 0000000020000280 RSI: 000000008108551b RDI: 0000000000000003
RBP: 00007ffcce5daab0 R08: 0000000000000001 R09: 0000000000000000
R10: 000000000000000a R11: 0000000000000246 R12: ffffffffffffffff
R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 4683:
 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]
 usbdev_open+0xe4/0xad0 drivers/usb/core/devio.c:976
 chrdev_open+0x25a/0x770 fs/char_dev.c:417
 do_dentry_open+0x499/0x1250 fs/open.c:771
 vfs_open+0xa0/0xd0 fs/open.c:880
 do_last fs/namei.c:3418 [inline]
 path_openat+0x130f/0x5340 fs/namei.c:3534
 do_filp_open+0x255/0x380 fs/namei.c:3564
 do_sys_open+0x584/0x720 fs/open.c:1063
 __do_sys_open fs/open.c:1081 [inline]
 __se_sys_open fs/open.c:1076 [inline]
 __x64_sys_open+0x7e/0xc0 fs/open.c:1076
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4683:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x210 mm/slab.c:3813
 usbdev_release+0x3f1/0x520 drivers/usb/core/devio.c:1059
 __fput+0x3c1/0xa80 fs/file_table.c:279
 ____fput+0x15/0x20 fs/file_table.c:312
 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x318/0x380 arch/x86/entry/common.c:166
 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
 do_syscall_64+0x6be/0x820 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8801b8782580
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 56 bytes inside of
 512-byte region [ffff8801b8782580, ffff8801b8782780)
The buggy address belongs to the page:
page:ffffea0006e1e080 count:1 mapcount:0 mapping:ffff8801dac00940 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffffea0007410708 ffffea0006e22b88 ffff8801dac00940
raw: 0000000000000000 ffff8801b8782080 0000000100000006 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801b8782480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801b8782500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8801b8782580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                        ^
 ffff8801b8782600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801b8782680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (134):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/08/30 17:51 linux-next 3d18c2437944 938220fd .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2018/09/25 17:25 upstream 2dd68cc7fd8c 0e7547d7 .config console log report ci-upstream-kasan-gce-root
2018/09/25 13:50 upstream 2dd68cc7fd8c 0e7547d7 .config console log report ci-upstream-kasan-gce
2018/09/25 08:32 upstream 02214bfc89c7 0e7547d7 .config console log report ci-upstream-kasan-gce
2018/09/25 02:30 upstream 02214bfc89c7 0e7547d7 .config console log report ci-upstream-kasan-gce-smack-root
2018/09/24 17:21 upstream 02214bfc89c7 2f485cdf .config console log report ci-upstream-kasan-gce-smack-root
2018/09/24 06:20 upstream 6bf4ca7fbc85 28d9ac76 .config console log report ci-upstream-kasan-gce-selinux-root
2018/09/24 04:33 upstream 6bf4ca7fbc85 28d9ac76 .config console log report ci-upstream-kasan-gce-selinux-root
2018/09/23 22:34 upstream 6bf4ca7fbc85 28d9ac76 .config console log report ci-upstream-kasan-gce-selinux-root
2018/09/23 15:24 upstream 328c6333ba3d 37079712 .config console log report ci-upstream-kasan-gce-selinux-root
2018/09/23 11:24 upstream 328c6333ba3d 37079712 .config console log report ci-upstream-kasan-gce-selinux-root
2018/09/23 01:07 upstream 10dc890d4228 37079712 .config console log report ci-upstream-kasan-gce-selinux-root
2018/09/22 21:47 upstream 10dc890d4228 37079712 .config console log report ci-upstream-kasan-gce-root
2018/09/22 19:29 upstream 10dc890d4228 37079712 .config console log report ci-upstream-kasan-gce-root
2018/09/22 08:55 upstream 10dc890d4228 37079712 .config console log report ci-upstream-kasan-gce-root
2018/09/22 07:52 upstream 10dc890d4228 37079712 .config console log report ci-upstream-kasan-gce
2018/09/22 06:01 upstream 10dc890d4228 37079712 .config console log report ci-upstream-kasan-gce
2018/09/22 01:30 upstream 10dc890d4228 37079712 .config console log report ci-upstream-kasan-gce
2018/09/21 23:34 upstream 10dc890d4228 37079712 .config console log report ci-upstream-kasan-gce-smack-root
2018/09/21 16:29 upstream 234b69e3e089 37079712 .config console log report ci-upstream-kasan-gce-root
2018/09/21 14:34 upstream 234b69e3e089 37079712 .config console log report ci-upstream-kasan-gce-selinux-root
2018/09/21 10:28 upstream 234b69e3e089 37079712 .config console log report ci-upstream-kasan-gce-smack-root
2018/09/21 05:39 upstream ae596de1a0c8 6cee973c .config console log report ci-upstream-kasan-gce
2018/09/10 04:19 upstream 9a5682765a2e 6b5120a4 .config console log report ci-upstream-kasan-gce-root
2018/09/25 04:08 upstream 02214bfc89c7 0e7547d7 .config console log report ci-upstream-kasan-gce-386
2018/09/24 21:53 upstream 02214bfc89c7 2f485cdf .config console log report ci-upstream-kasan-gce-386
2018/09/24 14:21 upstream 6bf4ca7fbc85 2f485cdf .config console log report ci-upstream-kasan-gce-386
2018/09/22 02:34 upstream 10dc890d4228 37079712 .config console log report ci-upstream-kasan-gce-386
2018/09/19 10:16 upstream eba2d6b34a32 7f125108 .config console log report ci-upstream-kasan-gce-386
2018/09/18 00:18 upstream 3918c21eacb0 7f125108 .config console log report ci-upstream-kasan-gce-386
2018/09/17 21:12 upstream c0747ad363ff 7f125108 .config console log report ci-upstream-kasan-gce-386
2018/09/17 14:14 upstream c0747ad363ff 7f125108 .config console log report ci-upstream-kasan-gce-386
2018/09/17 06:04 upstream 7876320f8880 a343a400 .config console log report ci-upstream-kasan-gce-386
2018/09/17 04:24 upstream 7876320f8880 a343a400 .config console log report ci-upstream-kasan-gce-386
2018/09/16 15:58 upstream 27c5a778dfe2 a343a400 .config console log report ci-upstream-kasan-gce-386
2018/09/16 14:29 upstream 27c5a778dfe2 a343a400 .config console log report ci-upstream-kasan-gce-386
2018/09/15 23:45 upstream 3a5af36b6d0e a343a400 .config console log report ci-upstream-kasan-gce-386
2018/09/15 03:28 upstream 090b75bcba62 a343a400 .config console log report ci-upstream-kasan-gce-386
2018/09/13 19:34 upstream 54eda9df17f3 19e9088b .config console log report ci-upstream-kasan-gce-386
2018/09/13 18:22 upstream 54eda9df17f3 19e9088b .config console log report ci-upstream-kasan-gce-386
2018/09/11 18:23 upstream 11da3a7f84f1 4ae17b1f .config console log report ci-upstream-kasan-gce-386
2018/09/10 21:15 upstream 11da3a7f84f1 f167cb6b .config console log report ci-upstream-kasan-gce-386
2018/09/10 09:31 upstream 11da3a7f84f1 6b5120a4 .config console log report ci-upstream-kasan-gce-386
2018/09/21 00:07 linux-next a0cb0cabe4bb 6cee973c .config console log report ci-upstream-linux-next-kasan-gce-root
2018/08/30 16:45 linux-next 3d18c2437944 938220fd .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.