syzbot


KASAN: use-after-free Read in usbhid_close

Status: closed as dup on 2019/09/03 12:12
Subsystems: input usb
[Documentation on labels]
Reported-by: syzbot+90b997df76897a013829@syzkaller.appspotmail.com
First crash: 1702d, last: 1681d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
general protection fault in __pm_runtime_resume input usb pm C 197 1673d 1736d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in usbhid_close 1 (2) 2019/09/03 12:12
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in usbhid_close (2) input usb 1 1634d 1633d 0/26 auto-closed as invalid on 2020/03/02 09:27
upstream KASAN: use-after-free Read in usbhid_close (3) input usb C 6 1450d 1477d 15/26 fixed on 2020/07/17 17:58
android-54 KASAN: use-after-free Read in usbhid_close syz 1 1472d 1472d 1/2 fixed on 2021/10/13 19:27

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x302a/0x3b50 kernel/locking/lockdep.c:3753
Read of size 8 at addr ffff8881d32268a0 by task syz-executor.0/5923

CPU: 0 PID: 5923 Comm: syz-executor.0 Not tainted 5.3.0-rc7+ #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+0xca/0x13e lib/dump_stack.c:113
 print_address_description+0x6a/0x32c mm/kasan/report.c:351
 __kasan_report.cold+0x1a/0x33 mm/kasan/report.c:482
 kasan_report+0xe/0x12 mm/kasan/common.c:618
 __lock_acquire+0x302a/0x3b50 kernel/locking/lockdep.c:3753
 lock_acquire+0x127/0x320 kernel/locking/lockdep.c:4412
 __raw_spin_lock_irq include/linux/spinlock_api_smp.h:128 [inline]
 _raw_spin_lock_irq+0x2d/0x40 kernel/locking/spinlock.c:167
 spin_lock_irq include/linux/spinlock.h:363 [inline]
 usbhid_close+0x51/0x210 drivers/hid/usbhid/hid-core.c:740
 hid_hw_close+0xa8/0xd0 drivers/hid/hid-core.c:2046
 drop_ref.part.0+0x32/0xe0 drivers/hid/hidraw.c:337
 drop_ref drivers/hid/hidraw.c:360 [inline]
 hidraw_release+0x34f/0x440 drivers/hid/hidraw.c:356
 __fput+0x2d7/0x840 fs/file_table.c:280
 task_work_run+0x13f/0x1c0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x8ef/0x2c00 kernel/exit.c:879
 do_group_exit+0x125/0x340 kernel/exit.c:983
 get_signal+0x466/0x23d0 kernel/signal.c:2734
 do_signal+0x88/0x14e0 arch/x86/kernel/signal.c:815
 exit_to_usermode_loop+0x1a2/0x200 arch/x86/entry/common.c:159
 prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:274 [inline]
 do_syscall_64+0x45f/0x580 arch/x86/entry/common.c:299
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459757
Code: Bad RIP value.
RSP: 002b:00007f2ff12443e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: fffffffffffffffc RBX: 0000000000000003 RCX: 0000000000459757
RDX: 00007f2ff1244830 RSI: 0000000080085502 RDI: 0000000000000004
RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f2ff12456d4
R13: 00000000004c8fc0 R14: 00000000004e0068 R15: 00000000ffffffff

The buggy address belongs to the page:
page:ffffea00074c8980 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0x200000000000000()
raw: 0200000000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881d3226780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8881d3226800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8881d3226880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                               ^
 ffff8881d3226900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8881d3226980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/09/17 01:34 https://github.com/google/kasan.git usb-fuzzer f0df5c1be1e9 51ca0454 .config console log report ci2-upstream-usb
2019/09/07 07:00 https://github.com/google/kasan.git usb-fuzzer f0df5c1be1e9 a60cb4cd .config console log report ci2-upstream-usb
2019/08/27 05:09 https://github.com/google/kasan.git usb-fuzzer eea39f24f4a5 d21c5d9d .config console log report ci2-upstream-usb
* Struck through repros no longer work on HEAD.