syzbot


KASAN: use-after-free Read in mod_delayed_work_on

Status: auto-obsoleted due to no activity on 2024/07/15 12:27
Reported-by: syzbot+95117de15ead8ad35e95@syzkaller.appspotmail.com
First crash: 254d, last: 236d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-54 KASAN: use-after-free Write in mod_delayed_work_on 1 862d 862d 0/2 auto-obsoleted due to no activity on 2022/11/27 09:05

Sample crash report:
bridge0: port 1(bridge_slave_0) entered blocking state
bridge0: port 1(bridge_slave_0) entered forwarding state
==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0xa6/0x130 lib/list_debug.c:62
Read of size 8 at addr ffff88811cbe4cf0 by task syz-executor.0/25702

CPU: 1 PID: 25702 Comm: syz-executor.0 Tainted: G        W          6.1.75-syzkaller-00027-g77fec6cefe26 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0x158/0x4e0 mm/kasan/report.c:427
 kasan_report+0x13c/0x170 mm/kasan/report.c:531
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:351
 __list_del_entry_valid+0xa6/0x130 lib/list_debug.c:62
 __list_del_entry include/linux/list.h:134 [inline]
 list_del_init include/linux/list.h:206 [inline]
 try_to_grab_pending+0x3ea/0x5d0 kernel/workqueue.c:1329
 mod_delayed_work_on+0xb3/0x190 kernel/workqueue.c:1745
 mod_delayed_work include/linux/workqueue.h:540 [inline]
 linkwatch_schedule_work+0x185/0x190 net/core/link_watch.c:142
 linkwatch_fire_event+0x211/0x240 net/core/link_watch.c:278
 netif_carrier_on+0xa8/0x130 net/sched/sch_generic.c:581
 veth_open+0x168/0x1b0 drivers/net/veth.c:1345
 __dev_open+0x35b/0x4e0 net/core/dev.c:1464
 __dev_change_flags+0x1db/0x6e0 net/core/dev.c:8589
 dev_change_flags+0x8c/0x1a0 net/core/dev.c:8660
 do_setlink+0xdb8/0x4060 net/core/rtnetlink.c:2801
 __rtnl_newlink net/core/rtnetlink.c:3576 [inline]
 rtnl_newlink+0x170f/0x2030 net/core/rtnetlink.c:3623
 rtnetlink_rcv_msg+0x9a5/0xca0 net/core/rtnetlink.c:6122
 netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2518
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:6140
 netlink_unicast_kernel net/netlink/af_netlink.c:1327 [inline]
 netlink_unicast+0x906/0xab0 net/netlink/af_netlink.c:1353
 netlink_sendmsg+0xa15/0xd30 net/netlink/af_netlink.c:1875
 sock_sendmsg_nosec net/socket.c:716 [inline]
 __sock_sendmsg net/socket.c:728 [inline]
 __sys_sendto+0x480/0x600 net/socket.c:2138
 __do_sys_sendto net/socket.c:2150 [inline]
 __se_sys_sendto net/socket.c:2146 [inline]
 __x64_sys_sendto+0xe5/0x100 net/socket.c:2146
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7ff5cfe7fb43
Code: 64 89 02 48 c7 c0 ff ff ff ff eb b7 66 2e 0f 1f 84 00 00 00 00 00 90 80 3d c1 03 10 00 00 41 89 ca 74 14 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 75 c3 0f 1f 40 00 55 48 83 ec 30 44 89 4c 24
RSP: 002b:00007fffee06e138 EFLAGS: 00000202
 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007ff5d0ad4620 RCX: 00007ff5cfe7fb43
RDX: 000000000000002c RSI: 00007ff5d0ad4670 RDI: 0000000000000003
RBP: 0000000000000001 R08: 00007fffee06e154 R09: 000000000000000c
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000003
R13: 0000000000000000 R14: 00007ff5d0ad4670 R15: 0000000000000000
 </TASK>

Allocated by task 325:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:379 [inline]
 __kasan_kmalloc+0x9c/0xb0 mm/kasan/common.c:388
 kasan_kmalloc include/linux/kasan.h:212 [inline]
 __do_kmalloc_node mm/slab_common.c:957 [inline]
 __kmalloc_node+0xb4/0x1e0 mm/slab_common.c:964
 kmalloc_node include/linux/slab.h:579 [inline]
 kvmalloc_node+0x221/0x640 mm/util.c:592
 kvmalloc include/linux/slab.h:706 [inline]
 kvzalloc include/linux/slab.h:714 [inline]
 alloc_netdev_mqs+0x8c/0xf90 net/core/dev.c:10626
 alloc_etherdev_mqs+0x36/0x40 net/ethernet/eth.c:394
 usbnet_probe+0x207/0x27c0 drivers/net/usb/usbnet.c:1693
 usb_probe_interface+0x5b6/0xa90 drivers/usb/core/driver.c:397
 really_probe+0x2b8/0x920 drivers/base/dd.c:639
 __driver_probe_device+0x1a0/0x310 drivers/base/dd.c:808
 driver_probe_device+0x54/0x3d0 drivers/base/dd.c:838
 __device_attach_driver+0x2e3/0x490 drivers/base/dd.c:966
 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:427
 __device_attach+0x312/0x510 drivers/base/dd.c:1038
 device_initial_probe+0x1a/0x20 drivers/base/dd.c:1087
 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:487
 device_add+0xb60/0xf10 drivers/base/core.c:3664
 usb_set_configuration+0x190f/0x1e80 drivers/usb/core/message.c:2165
 usb_generic_driver_probe+0x8b/0x150 drivers/usb/core/generic.c:238
 usb_probe_device+0x144/0x260 drivers/usb/core/driver.c:294
 really_probe+0x2b8/0x920 drivers/base/dd.c:639
 __driver_probe_device+0x1a0/0x310 drivers/base/dd.c:808
 driver_probe_device+0x54/0x3d0 drivers/base/dd.c:838
 __device_attach_driver+0x2e3/0x490 drivers/base/dd.c:966
 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:427
 __device_attach+0x312/0x510 drivers/base/dd.c:1038
 device_initial_probe+0x1a/0x20 drivers/base/dd.c:1087
 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:487
 device_add+0xb60/0xf10 drivers/base/core.c:3664
 usb_new_device+0xf32/0x1810 drivers/usb/core/hub.c:2608
 hub_port_connect drivers/usb/core/hub.c:5511 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5651 [inline]
 port_event drivers/usb/core/hub.c:5811 [inline]
 hub_event+0x2db1/0x4830 drivers/usb/core/hub.c:5893
 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299
 worker_thread+0xa60/0x1260 kernel/workqueue.c:2446
 kthread+0x26d/0x300 kernel/kthread.c:386
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

Freed by task 325:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:516
 ____kasan_slab_free+0x131/0x180 mm/kasan/common.c:241
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:249
 kasan_slab_free include/linux/kasan.h:178 [inline]
 slab_free_hook mm/slub.c:1745 [inline]
 slab_free_freelist_hook mm/slub.c:1771 [inline]
 slab_free mm/slub.c:3684 [inline]
 __kmem_cache_free+0x218/0x3b0 mm/slub.c:3697
 kfree+0x7a/0xf0 mm/slab_common.c:1009
 kvfree+0x35/0x40 mm/util.c:639
 netdev_freemem+0x3f/0x60 net/core/dev.c:10580
 netdev_release+0x7f/0xb0 net/core/net-sysfs.c:1906
 device_release+0x95/0x1c0
 kobject_cleanup lib/kobject.c:681 [inline]
 kobject_release lib/kobject.c:712 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x178/0x260 lib/kobject.c:729
 put_device+0x1f/0x30 drivers/base/core.c:3772
 free_netdev+0x393/0x480 net/core/dev.c:10773
 usbnet_disconnect+0x245/0x390 drivers/net/usb/usbnet.c:1632
 usb_unbind_interface+0x1fa/0x8c0 drivers/usb/core/driver.c:459
 device_remove drivers/base/dd.c:550 [inline]
 __device_release_driver drivers/base/dd.c:1283 [inline]
 device_release_driver_internal+0x53e/0x870 drivers/base/dd.c:1309
 device_release_driver+0x19/0x20 drivers/base/dd.c:1332
 bus_remove_device+0x2fa/0x360 drivers/base/bus.c:529
 device_del+0x663/0xe90 drivers/base/core.c:3852
 usb_disable_device+0x380/0x720 drivers/usb/core/message.c:1414
 usb_disconnect+0x32a/0x890 drivers/usb/core/hub.c:2271
 hub_port_connect drivers/usb/core/hub.c:5350 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5651 [inline]
 port_event drivers/usb/core/hub.c:5811 [inline]
 hub_event+0x1ed8/0x4830 drivers/usb/core/hub.c:5893
 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299
 process_scheduled_works kernel/workqueue.c:2362 [inline]
 worker_thread+0xd71/0x1260 kernel/workqueue.c:2448
 kthread+0x26d/0x300 kernel/kthread.c:386
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496
 insert_work+0x56/0x310 kernel/workqueue.c:1368
 __queue_work+0x9b6/0xd70 kernel/workqueue.c:1527
 queue_work_on+0x105/0x170 kernel/workqueue.c:1555
 usbnet_link_change+0xeb/0x100
 usbnet_probe+0x1dbe/0x27c0 drivers/net/usb/usbnet.c:1840
 usb_probe_interface+0x5b6/0xa90 drivers/usb/core/driver.c:397
 really_probe+0x2b8/0x920 drivers/base/dd.c:639
 __driver_probe_device+0x1a0/0x310 drivers/base/dd.c:808
 driver_probe_device+0x54/0x3d0 drivers/base/dd.c:838
 __device_attach_driver+0x2e3/0x490 drivers/base/dd.c:966
 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:427
 __device_attach+0x312/0x510 drivers/base/dd.c:1038
 device_initial_probe+0x1a/0x20 drivers/base/dd.c:1087
 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:487
 device_add+0xb60/0xf10 drivers/base/core.c:3664
 usb_set_configuration+0x190f/0x1e80 drivers/usb/core/message.c:2165
 usb_generic_driver_probe+0x8b/0x150 drivers/usb/core/generic.c:238
 usb_probe_device+0x144/0x260 drivers/usb/core/driver.c:294
 really_probe+0x2b8/0x920 drivers/base/dd.c:639
 __driver_probe_device+0x1a0/0x310 drivers/base/dd.c:808
 driver_probe_device+0x54/0x3d0 drivers/base/dd.c:838
 __device_attach_driver+0x2e3/0x490 drivers/base/dd.c:966
 bus_for_each_drv+0x183/0x200 drivers/base/bus.c:427
 __device_attach+0x312/0x510 drivers/base/dd.c:1038
 device_initial_probe+0x1a/0x20 drivers/base/dd.c:1087
 bus_probe_device+0xbe/0x1e0 drivers/base/bus.c:487
 device_add+0xb60/0xf10 drivers/base/core.c:3664
 usb_new_device+0xf32/0x1810 drivers/usb/core/hub.c:2608
 hub_port_connect drivers/usb/core/hub.c:5511 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5651 [inline]
 port_event drivers/usb/core/hub.c:5811 [inline]
 hub_event+0x2db1/0x4830 drivers/usb/core/hub.c:5893
 process_one_work+0x73d/0xcb0 kernel/workqueue.c:2299
 worker_thread+0xa60/0x1260 kernel/workqueue.c:2446
 kthread+0x26d/0x300 kernel/kthread.c:386
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

The buggy address belongs to the object at ffff88811cbe4000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 3312 bytes inside of
 4096-byte region [ffff88811cbe4000, ffff88811cbe5000)

The buggy address belongs to the physical page:
page:ffffea000472f800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11cbe0
head:ffffea000472f800 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 0000000000000000 dead000000000001 ffff888100043380
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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 13644, tgid 13644 (syz-executor.2), ts 343738455164, free_ts 343725227322
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x213/0x220 mm/page_alloc.c:2590
 prep_new_page+0x1b/0x110 mm/page_alloc.c:2597
 get_page_from_freelist+0x27ea/0x2870 mm/page_alloc.c:4425
 __alloc_pages+0x3a1/0x780 mm/page_alloc.c:5712
 alloc_slab_page+0x6c/0xf0
 allocate_slab mm/slub.c:1962 [inline]
 new_slab+0x90/0x3e0 mm/slub.c:2015
 ___slab_alloc+0x6f9/0xb80 mm/slub.c:3203
 __slab_alloc+0x5d/0xa0 mm/slub.c:3302
 slab_alloc_node mm/slub.c:3387 [inline]
 __kmem_cache_alloc_node+0x1af/0x250 mm/slub.c:3460
 kmalloc_trace+0x2a/0xa0 mm/slab_common.c:1047
 kmalloc include/linux/slab.h:553 [inline]
 kzalloc include/linux/slab.h:689 [inline]
 kobject_uevent_env+0x262/0x720 lib/kobject_uevent.c:524
 kobject_uevent+0x1f/0x30 lib/kobject_uevent.c:642
 netdev_queue_add_kobject net/core/net-sysfs.c:1673 [inline]
 netdev_queue_update_kobjects+0x235/0x4a0 net/core/net-sysfs.c:1714
 register_queue_kobjects net/core/net-sysfs.c:1775 [inline]
 netdev_register_kobject+0x270/0x320 net/core/net-sysfs.c:2015
 register_netdevice+0xe43/0x1490 net/core/dev.c:10103
 veth_newlink+0x7fc/0xc70 drivers/net/veth.c:1793
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1498 [inline]
 free_pcp_prepare mm/page_alloc.c:1572 [inline]
 free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3498
 free_unref_page+0xb2/0x5c0 mm/page_alloc.c:3594
 free_the_page mm/page_alloc.c:798 [inline]
 __free_pages+0x61/0xf0 mm/page_alloc.c:5801
 __free_slab+0xce/0x1a0 mm/slub.c:2039
 free_slab mm/slub.c:2054 [inline]
 discard_slab mm/slub.c:2060 [inline]
 __unfreeze_partials+0x165/0x1a0 mm/slub.c:2609
 put_cpu_partial+0xa9/0x100 mm/slub.c:2685
 __slab_free+0x1c8/0x280 mm/slub.c:3561
 do_slab_free mm/slub.c:3638 [inline]
 ___cache_free+0xc6/0xd0 mm/slub.c:3691
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0xc5/0x140 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x24/0x80 mm/kasan/common.c:310
 kasan_slab_alloc include/linux/kasan.h:202 [inline]
 slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:768
 slab_alloc_node mm/slub.c:3421 [inline]
 slab_alloc mm/slub.c:3429 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3436 [inline]
 kmem_cache_alloc_lru+0x102/0x220 mm/slub.c:3452
 alloc_inode_sb include/linux/fs.h:3187 [inline]
 sock_alloc_inode+0x28/0xc0 net/socket.c:304
 alloc_inode fs/inode.c:261 [inline]
 new_inode_pseudo+0x65/0x1d0 fs/inode.c:1020
 sock_alloc net/socket.c:629 [inline]
 __sock_create+0x135/0x760 net/socket.c:1504

Memory state around the buggy address:
 ffff88811cbe4b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811cbe4c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88811cbe4c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff88811cbe4d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811cbe4d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
device veth0_vlan entered promiscuous mode
device veth1_macvtap entered promiscuous mode
EXT4-fs error (device loop0): mb_free_blocks:1795: group 0, inode 16: block 35:freeing already freed block (bit 34); block bitmap corrupt.

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/16 12:27 android14-6.1 77fec6cefe26 0d592ce4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: use-after-free Read in mod_delayed_work_on
2024/03/29 22:17 android14-6.1 5b8114ec3c92 c52bcb23 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-6-1 KASAN: use-after-free Read in mod_delayed_work_on
* Struck through repros no longer work on HEAD.