syzbot


KASAN: use-after-free Read in usb_udc_uevent

Status: auto-closed as invalid on 2021/05/14 11:04
Reported-by: syzbot+1e83b5b92e27ef4e548f@syzkaller.appspotmail.com
First crash: 1220d, last: 1220d
Similar bugs (8)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in usb_udc_uevent 1 174d 174d 0/3 auto-obsoleted due to no activity on 2024/03/05 09:48
android-5-10 KASAN: use-after-free Read in usb_udc_uevent (2) 1 338d 338d 0/2 auto-obsoleted due to no activity on 2023/09/13 18:59
android-54 KASAN: use-after-free Read in usb_udc_uevent (2) 2 777d 793d 0/2 auto-closed as invalid on 2022/07/31 07:22
android-5-15 KASAN: use-after-free Read in usb_udc_uevent 1 501d 501d 0/2 auto-obsoleted due to no activity on 2023/04/11 06:40
android-54 KASAN: use-after-free Read in usb_udc_uevent (3) 2 495d 533d 0/2 auto-obsoleted due to no activity on 2023/05/09 15:23
upstream KASAN: use-after-free Read in usb_udc_uevent usb syz error 30 660d 1446d 22/26 fixed on 2023/02/24 13:50
android-5-10 KASAN: use-after-free Read in usb_udc_uevent 2 463d 486d 0/2 auto-obsoleted due to no activity on 2023/05/11 18:44
android-54 KASAN: use-after-free Read in usb_udc_uevent (4) 1 120d 120d 0/2 auto-obsoleted due to no activity on 2024/04/18 10:07

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in usb_udc_uevent+0xac/0x120 drivers/usb/gadget/udc/core.c:1593
Read of size 8 at addr ffff8881eb9b2010 by task systemd-udevd/9285

CPU: 1 PID: 9285 Comm: systemd-udevd Not tainted 5.4.89-syzkaller-00226-ge5e14bf558c4 #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+0x1dd/0x24e lib/dump_stack.c:118
 print_address_description+0x96/0x640 mm/kasan/report.c:374
 __kasan_report+0x177/0x1f0 mm/kasan/report.c:506
 kasan_report+0x30/0x60 mm/kasan/common.c:634
 usb_udc_uevent+0xac/0x120 drivers/usb/gadget/udc/core.c:1593
 dev_uevent+0x4f5/0x740 drivers/base/core.c:1863
 uevent_show+0x1af/0x2f0 drivers/base/core.c:1919
 dev_attr_show+0x50/0xc0 drivers/base/core.c:1623
 sysfs_kf_seq_show+0x265/0x3e0 fs/sysfs/file.c:60
 seq_read+0x4aa/0xd30 fs/seq_file.c:229
 __vfs_read+0xfa/0x710 fs/read_write.c:425
 vfs_read+0x166/0x380 fs/read_write.c:461
 ksys_read+0x186/0x2b0 fs/read_write.c:587
 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7f2d42c12910
Code: b6 fe ff ff 48 8d 3d 0f be 08 00 48 83 ec 08 e8 06 db 01 00 66 0f 1f 44 00 00 83 3d f9 2d 2c 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 de 9b 01 00 48 89 04 24
RSP: 002b:00007fffae487378 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 000055dd141506d0 RCX: 00007f2d42c12910
RDX: 0000000000001000 RSI: 000055dd14148c20 RDI: 0000000000000007
RBP: 00007f2d42ecd440 R08: 00007f2d42ed1178 R09: 0000000000001010
R10: 000055dd141506d0 R11: 0000000000000246 R12: 0000000000001000
R13: 0000000000000d68 R14: 000055dd14148c20 R15: 00007f2d42ecc900

Allocated by task 9260:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 __kasan_kmalloc+0x129/0x1c0 mm/kasan/common.c:510
 kmem_cache_alloc_trace+0xc3/0x290 mm/slub.c:2830
 kmalloc include/linux/slab.h:556 [inline]
 kzalloc include/linux/slab.h:690 [inline]
 dev_new drivers/usb/gadget/legacy/raw_gadget.c:182 [inline]
 raw_open+0x84/0x380 drivers/usb/gadget/legacy/raw_gadget.c:372
 misc_open+0x356/0x3d0 drivers/char/misc.c:141
 chrdev_open+0x585/0x640 fs/char_dev.c:414
 do_dentry_open+0x947/0x10f0 fs/open.c:796
 do_last fs/namei.c:3495 [inline]
 path_openat+0x1294/0x3c20 fs/namei.c:3612
 do_filp_open+0x20a/0x440 fs/namei.c:3642
 do_sys_open+0x380/0x7b0 fs/open.c:1093
 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 9259:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 kasan_set_free_info mm/kasan/common.c:332 [inline]
 __kasan_slab_free+0x17e/0x230 mm/kasan/common.c:471
 slab_free_hook mm/slub.c:1453 [inline]
 slab_free_freelist_hook+0xd0/0x150 mm/slub.c:1486
 slab_free mm/slub.c:3051 [inline]
 kfree+0x12c/0x660 mm/slub.c:4017
 raw_release+0x130/0x1e0 drivers/usb/gadget/legacy/raw_gadget.c:411
 __fput+0x27d/0x6c0 fs/file_table.c:281
 task_work_run+0x176/0x1a0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop arch/x86/entry/common.c:163 [inline]
 prepare_exit_to_usermode+0x2b0/0x310 arch/x86/entry/common.c:194
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8881eb9b2000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 16 bytes inside of
 4096-byte region [ffff8881eb9b2000, ffff8881eb9b3000)
The buggy address belongs to the page:
page:ffffea0007ae6c00 refcount:1 mapcount:0 mapping:ffff8881f600c280 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 ffffea0007889200 0000000300000003 ffff8881f600c280
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881eb9b1f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881eb9b1f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881eb9b2000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff8881eb9b2080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881eb9b2100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/01/14 11:04 android12-5.4 e5e14bf558c4 269d24e8 .config console log report info ci2-android-5-4-kasan
* Struck through repros no longer work on HEAD.