syzbot


KASAN: use-after-free Read in usb_udc_uevent

Status: auto-obsoleted due to no activity on 2023/04/11 06:40
Reported-by: syzbot+321a699a782362b39270@syzkaller.appspotmail.com
First crash: 690d, last: 690d
Similar bugs (9)
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 362d 362d 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 (3) 1 97d 97d 0/2 auto-obsoleted due to no activity on 2024/11/16 03:41
android-5-10 KASAN: use-after-free Read in usb_udc_uevent (2) 1 526d 526d 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 966d 981d 0/2 auto-closed as invalid on 2022/07/31 07:22
android-54 KASAN: use-after-free Read in usb_udc_uevent 1 1408d 1408d 0/2 auto-closed as invalid on 2021/05/14 11:04
android-54 KASAN: use-after-free Read in usb_udc_uevent (3) 2 683d 722d 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 848d 1634d 22/28 fixed on 2023/02/24 13:50
android-5-10 KASAN: use-after-free Read in usb_udc_uevent 2 651d 675d 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 308d 308d 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+0xb2/0x120 drivers/usb/gadget/udc/core.c:1744
Read of size 8 at addr ffff88817568a010 by task udevd/182

CPU: 1 PID: 182 Comm: udevd Not tainted 5.15.78-syzkaller-00911-gc73b4619ad86 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description+0x87/0x3d0 mm/kasan/report.c:256
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x1a6/0x1f0 mm/kasan/report.c:452
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
 usb_udc_uevent+0xb2/0x120 drivers/usb/gadget/udc/core.c:1744
 dev_uevent+0x4f1/0x700 drivers/base/core.c:2347
 uevent_show+0x1a6/0x330 drivers/base/core.c:2403
 dev_attr_show+0x56/0xd0 drivers/base/core.c:2105
 sysfs_kf_seq_show+0x26b/0x400 fs/sysfs/file.c:61
 kernfs_seq_show+0x117/0x160 fs/kernfs/file.c:168
 seq_read_iter+0x429/0xd20 fs/seq_file.c:230
 kernfs_fop_read_iter+0x161/0x490 fs/kernfs/file.c:241
 call_read_iter include/linux/fs.h:2132 [inline]
 new_sync_read fs/read_write.c:404 [inline]
 vfs_read+0xabc/0xd80 fs/read_write.c:485
 ksys_read+0x198/0x2c0 fs/read_write.c:623
 __do_sys_read fs/read_write.c:633 [inline]
 __se_sys_read fs/read_write.c:631 [inline]
 __x64_sys_read+0x7b/0x90 fs/read_write.c:631
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f3eeb47c8fe
Code: c0 e9 e6 fe ff ff 50 48 8d 3d 0e c7 09 00 e8 c9 cf 01 00 66 0f 1f 84 00 00 00 00 00 64 8b 04 25 18 00 00 00 85 c0 75 14 0f 05 <48> 3d 00 f0 ff ff 77 5a c3 66 0f 1f 84 00 00 00 00 00 48 83 ec 28
RSP: 002b:00007ffce2be9cf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 000055cf80f885c0 RCX: 00007f3eeb47c8fe
RDX: 0000000000001000 RSI: 000055cf80fa0fb0 RDI: 000000000000000c
RBP: 00007f3eeb549380 R08: 000000000000000c R09: 00007f3eeb54ca60
R10: 0000000000000063 R11: 0000000000000246 R12: 000055cf80f885c0
R13: 0000000000000d68 R14: 00007f3eeb548780 R15: 0000000000000d68
 </TASK>

Allocated by task 28159:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:433 [inline]
 ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:512
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:521
 kasan_kmalloc include/linux/kasan.h:254 [inline]
 kmem_cache_alloc_trace+0x1e3/0x310 mm/slub.c:3263
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 dev_new drivers/usb/gadget/legacy/raw_gadget.c:191 [inline]
 raw_open+0x8a/0x3c0 drivers/usb/gadget/legacy/raw_gadget.c:385
 misc_open+0x3ea/0x440 drivers/char/misc.c:141
 chrdev_open+0x5fb/0x680 fs/char_dev.c:414
 do_dentry_open+0x859/0x1050 fs/open.c:828
 vfs_open+0x73/0x80 fs/open.c:958
 do_open fs/namei.c:3480 [inline]
 path_openat+0x2673/0x2ea0 fs/namei.c:3615
 do_filp_open+0x277/0x4f0 fs/namei.c:3642
 do_sys_openat2+0x13b/0x500 fs/open.c:1234
 do_sys_open fs/open.c:1250 [inline]
 __do_sys_openat fs/open.c:1266 [inline]
 __se_sys_openat fs/open.c:1261 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1261
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 28194:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1721 [inline]
 slab_free_freelist_hook+0xc9/0x1a0 mm/slub.c:1747
 slab_free mm/slub.c:3515 [inline]
 kfree+0xc8/0x210 mm/slub.c:4575
 dev_free drivers/usb/gadget/legacy/raw_gadget.c:227 [inline]
 kref_put+0x79f/0x860 include/linux/kref.h:65
 raw_release+0x141/0x1e0 drivers/usb/gadget/legacy/raw_gadget.c:424
 __fput+0x3f9/0x910 fs/file_table.c:280
 ____fput+0x15/0x20 fs/file_table.c:308
 task_work_run+0x147/0x1b0 kernel/task_work.c:164
 exit_task_work include/linux/task_work.h:32 [inline]
 do_exit+0x67e/0x24d0 kernel/exit.c:828
 do_group_exit+0x13a/0x300 kernel/exit.c:925
 get_signal+0x77e/0x1600 kernel/signal.c:2890
 arch_do_signal_or_restart+0x9f/0x670 arch/x86/kernel/signal.c:865
 handle_signal_work kernel/entry/common.c:148 [inline]
 exit_to_user_mode_loop+0xd4/0x110 kernel/entry/common.c:172
 exit_to_user_mode_prepare kernel/entry/common.c:207 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
 syscall_exit_to_user_mode+0x79/0xc0 kernel/entry/common.c:300
 do_syscall_64+0x50/0xd0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff88817568a000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 16 bytes inside of
 4096-byte region [ffff88817568a000, ffff88817568b000)
The buggy address belongs to the page:
page:ffffea0005d5a200 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88817568e000 pfn:0x175688
head:ffffea0005d5a200 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 ffffea0004400408 ffffea0004576a08 ffff888100043380
raw: ffff88817568e000 0000000000040003 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 662, ts 260047418140, free_ts 0
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1ab/0x1b0 mm/page_alloc.c:2495
 prep_new_page mm/page_alloc.c:2501 [inline]
 get_page_from_freelist+0x38b/0x400 mm/page_alloc.c:4281
 __alloc_pages+0x3a8/0x7c0 mm/page_alloc.c:5548
 allocate_slab+0x62/0x580 mm/slub.c:1928
 new_slab mm/slub.c:1991 [inline]
 ___slab_alloc+0x2e2/0x6f0 mm/slub.c:3024
 __slab_alloc+0x4a/0x90 mm/slub.c:3111
 slab_alloc_node mm/slub.c:3202 [inline]
 slab_alloc mm/slub.c:3244 [inline]
 __kmalloc_track_caller+0x25a/0x350 mm/slub.c:4941
 kmemdup+0x24/0x50 mm/util.c:131
 __devinet_sysctl_register+0xad/0x2b0 net/ipv4/devinet.c:2565
 devinet_sysctl_register+0x169/0x1e0 net/ipv4/devinet.c:2617
 inetdev_init+0x27a/0x4b0 net/ipv4/devinet.c:276
 inetdev_event+0x202/0x1090 net/ipv4/devinet.c:1530
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0x9e/0x110 kernel/notifier.c:391
 call_netdevice_notifiers_info net/core/dev.c:2005 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2017 [inline]
 call_netdevice_notifiers+0x14e/0x1d0 net/core/dev.c:2031
 register_netdevice+0x13bb/0x1720 net/core/dev.c:10363
 __ip_tunnel_create+0x2af/0x370 net/ipv4/ip_tunnel.c:267
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888175689f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888175689f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88817568a000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff88817568a080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88817568a100: 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
2023/01/03 06:00 android13-5.15-lts c73b4619ad86 ab32d508 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in usb_udc_uevent
* Struck through repros no longer work on HEAD.