syzbot


KASAN: use-after-free Read in usb_udc_uevent (4)

Status: auto-obsoleted due to no activity on 2024/04/18 10:07
First crash: 307d, last: 307d
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 361d 361d 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 95d 95d 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 525d 525d 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 964d 980d 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 688d 688d 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 1 1407d 1407d 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 682d 720d 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 846d 1633d 22/28 fixed on 2023/02/24 13:50
android-5-10 KASAN: use-after-free Read in usb_udc_uevent 2 650d 673d 0/2 auto-obsoleted due to no activity on 2023/05/11 18:44

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in usb_udc_uevent+0xae/0x110 drivers/usb/gadget/udc/core.c:1597
Read of size 8 at addr ffff8881f22ce010 by task udevd/162

CPU: 1 PID: 162 Comm: udevd Not tainted 5.4.259-syzkaller-00001-g9ca091c99214 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d8/0x241 lib/dump_stack.c:118
 print_address_description+0x8c/0x600 mm/kasan/report.c:384
 __kasan_report+0xf3/0x120 mm/kasan/report.c:516
 kasan_report+0x30/0x60 mm/kasan/common.c:653
 usb_udc_uevent+0xae/0x110 drivers/usb/gadget/udc/core.c:1597
 dev_uevent+0x4e9/0x6f0 drivers/base/core.c:1887
 uevent_show+0x19a/0x320 drivers/base/core.c:1943
 dev_attr_show+0x50/0xb0 drivers/base/core.c:1647
 sysfs_kf_seq_show+0x265/0x3e0 fs/sysfs/file.c:61
 seq_read+0x4df/0xe60 fs/seq_file.c:232
 __vfs_read+0x103/0x730 fs/read_write.c:425
 vfs_read+0x148/0x360 fs/read_write.c:461
 ksys_read+0x199/0x2c0 fs/read_write.c:587
 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Allocated by task 2102:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 __kasan_kmalloc+0x171/0x210 mm/kasan/common.c:529
 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+0x85/0x380 drivers/usb/gadget/legacy/raw_gadget.c:372
 misc_open+0x300/0x370 drivers/char/misc.c:141
 chrdev_open+0x54a/0x630 fs/char_dev.c:414
 do_dentry_open+0x964/0x1130 fs/open.c:796
 do_last fs/namei.c:3515 [inline]
 path_openat+0x2992/0x3480 fs/namei.c:3634
 do_filp_open+0x20b/0x450 fs/namei.c:3664
 do_sys_open+0x39c/0x810 fs/open.c:1113
 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Freed by task 2101:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 kasan_set_free_info mm/kasan/common.c:345 [inline]
 __kasan_slab_free+0x1b5/0x270 mm/kasan/common.c:487
 slab_free_hook mm/slub.c:1455 [inline]
 slab_free_freelist_hook mm/slub.c:1494 [inline]
 slab_free mm/slub.c:3080 [inline]
 kfree+0x123/0x370 mm/slub.c:4071
 raw_release+0x134/0x1e0 drivers/usb/gadget/legacy/raw_gadget.c:411
 __fput+0x262/0x680 fs/file_table.c:281
 task_work_run+0x140/0x170 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop+0x190/0x1a0 arch/x86/entry/common.c:163
 prepare_exit_to_usermode+0x199/0x200 arch/x86/entry/common.c:194
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1

The buggy address belongs to the object at ffff8881f22ce000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 16 bytes inside of
 4096-byte region [ffff8881f22ce000, ffff8881f22cf000)
The buggy address belongs to the page:
page:ffffea0007c8b200 refcount:1 mapcount:0 mapping:ffff8881f5c0c280 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5c0c280
raw: 0000000000000000 0000000000040004 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)
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook mm/page_alloc.c:2165 [inline]
 prep_new_page+0x18f/0x370 mm/page_alloc.c:2171
 get_page_from_freelist+0x2d13/0x2d90 mm/page_alloc.c:3794
 __alloc_pages_nodemask+0x393/0x840 mm/page_alloc.c:4891
 alloc_slab_page+0x39/0x3c0 mm/slub.c:343
 allocate_slab mm/slub.c:1683 [inline]
 new_slab+0x97/0x440 mm/slub.c:1749
 new_slab_objects mm/slub.c:2505 [inline]
 ___slab_alloc+0x2fe/0x490 mm/slub.c:2667
 __slab_alloc+0x62/0xa0 mm/slub.c:2707
 slab_alloc_node mm/slub.c:2792 [inline]
 slab_alloc mm/slub.c:2837 [inline]
 kmem_cache_alloc_trace+0x12d/0x260 mm/slub.c:2854
 kmalloc include/linux/slab.h:556 [inline]
 kzalloc include/linux/slab.h:690 [inline]
 snmp6_alloc_dev net/ipv6/addrconf.c:349 [inline]
 ipv6_add_dev+0x599/0x10a0 net/ipv6/addrconf.c:398
 addrconf_notify+0x59b/0xe50 net/ipv6/addrconf.c:3539
 notifier_call_chain kernel/notifier.c:98 [inline]
 __raw_notifier_call_chain kernel/notifier.c:399 [inline]
 raw_notifier_call_chain+0x95/0x110 kernel/notifier.c:406
 call_netdevice_notifiers_info net/core/dev.c:1670 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:1682 [inline]
 call_netdevice_notifiers net/core/dev.c:1696 [inline]
 register_netdevice+0xeef/0x12a0 net/core/dev.c:9213
 veth_newlink+0x835/0xb50 drivers/net/veth.c:1329
 __rtnl_newlink net/core/rtnetlink.c:3255 [inline]
 rtnl_newlink+0x1567/0x2060 net/core/rtnetlink.c:3314
 rtnetlink_rcv_msg+0x983/0xc70 net/core/rtnetlink.c:5291
 netlink_rcv_skb+0x1d5/0x420 net/netlink/af_netlink.c:2481
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1176 [inline]
 __free_pages_ok+0x847/0x950 mm/page_alloc.c:1438
 free_the_page mm/page_alloc.c:4953 [inline]
 __free_pages+0x91/0x140 mm/page_alloc.c:4959
 __free_slab+0x221/0x2e0 mm/slub.c:1774
 free_slab mm/slub.c:1789 [inline]
 discard_slab mm/slub.c:1795 [inline]
 unfreeze_partials+0x14e/0x180 mm/slub.c:2288
 put_cpu_partial+0x44/0x180 mm/slub.c:2324
 __slab_free+0x297/0x360 mm/slub.c:2971
 qlist_free_all+0x43/0xb0 mm/kasan/quarantine.c:167
 quarantine_reduce+0x1d9/0x210 mm/kasan/quarantine.c:260
 __kasan_kmalloc+0x41/0x210 mm/kasan/common.c:507
 slab_post_alloc_hook mm/slab.h:584 [inline]
 slab_alloc_node mm/slub.c:2829 [inline]
 slab_alloc mm/slub.c:2837 [inline]
 kmem_cache_alloc_trace+0xdc/0x260 mm/slub.c:2854
 kmalloc include/linux/slab.h:556 [inline]
 kzalloc include/linux/slab.h:690 [inline]
 kset_create lib/kobject.c:977 [inline]
 kset_create_and_add+0x55/0x2a0 lib/kobject.c:1020
 register_queue_kobjects net/core/net-sysfs.c:1624 [inline]
 netdev_register_kobject+0x1a0/0x310 net/core/net-sysfs.c:1858
 register_netdevice+0xbc5/0x12a0 net/core/dev.c:9182
 veth_newlink+0x667/0xb50 drivers/net/veth.c:1302
 __rtnl_newlink net/core/rtnetlink.c:3255 [inline]
 rtnl_newlink+0x1567/0x2060 net/core/rtnetlink.c:3314
 rtnetlink_rcv_msg+0x983/0xc70 net/core/rtnetlink.c:5291

Memory state around the buggy address:
 ffff8881f22cdf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881f22cdf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881f22ce000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff8881f22ce080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881f22ce100: 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
2024/01/19 10:03 android12-5.4 9ca091c99214 21772ce4 .config console log report info ci2-android-5-4-kasan KASAN: use-after-free Read in usb_udc_uevent
* Struck through repros no longer work on HEAD.