syzbot


KASAN: slab-use-after-free Write in enqueue_timer

Status: auto-obsoleted due to no activity on 2023/08/22 15:17
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+c2775460db0e1c70018e@syzkaller.appspotmail.com
First crash: 537d, last: 513d
Discussions (3)
Title Replies (including bot) Last reply
[syzbot] [wireguard?] KASAN: slab-use-after-free Write in enqueue_timer 17 (18) 2023/05/24 15:39
Re: [syzbot] Monthly wireguard report (Apr 2023) 1 (1) 2023/05/02 09:03
[syzbot] Monthly wireguard report (Apr 2023) 0 (1) 2023/05/01 09:03
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-54 KASAN: use-after-free Write in enqueue_timer C 4288 99d 605d 0/2 auto-obsoleted due to no activity on 2024/09/11 16:22
upstream KASAN: use-after-free Write in enqueue_timer net 1 695d 695d 22/28 fixed on 2023/02/24 13:50
android-5-15 KASAN: use-after-free Write in enqueue_timer 1 266d 266d 0/2 auto-obsoleted due to no activity on 2024/04/17 12:01
android-6-1 KASAN: use-after-free Write in enqueue_timer 21 16d 77d 0/2 upstream: reported on 2024/07/25 13:16
upstream KASAN: invalid-access Write in enqueue_timer ext4 20 1310d 1332d 0/28 auto-closed as invalid on 2021/07/08 00:48

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in hlist_add_head include/linux/list.h:945 [inline]
BUG: KASAN: slab-use-after-free in enqueue_timer+0xad/0x560 kernel/time/timer.c:605
Write of size 8 at addr ffff88807ef35500 by task kworker/0:20/18976

CPU: 0 PID: 18976 Comm: kworker/0:20 Not tainted 6.3.0-syzkaller-13091-g3c4aa4434377 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
Workqueue: wg-crypt-wg1 wg_packet_decrypt_worker
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:351 [inline]
 print_report+0x163/0x540 mm/kasan/report.c:462
 kasan_report+0x176/0x1b0 mm/kasan/report.c:572
 hlist_add_head include/linux/list.h:945 [inline]
 enqueue_timer+0xad/0x560 kernel/time/timer.c:605
 __mod_timer+0x9dd/0xf40 kernel/time/timer.c:1129
 mod_peer_timer+0x158/0x220 drivers/net/wireguard/timers.c:37
 wg_packet_consume_data_done drivers/net/wireguard/receive.c:354 [inline]
 wg_packet_rx_poll+0xd9e/0x2250 drivers/net/wireguard/receive.c:474
 __napi_poll+0xc7/0x470 net/core/dev.c:6496
 napi_poll net/core/dev.c:6563 [inline]
 net_rx_action+0x78b/0x1010 net/core/dev.c:6696
 __do_softirq+0x2ab/0x908 kernel/softirq.c:571
 do_softirq+0x166/0x250 kernel/softirq.c:472
 </IRQ>
 <TASK>
 __local_bh_enable_ip+0x1b5/0x1f0 kernel/softirq.c:396
 spin_unlock_bh include/linux/spinlock.h:395 [inline]
 ptr_ring_consume_bh include/linux/ptr_ring.h:367 [inline]
 wg_packet_decrypt_worker+0xd40/0xde0 drivers/net/wireguard/receive.c:499
 process_one_work+0x8a0/0x10e0 kernel/workqueue.c:2405
 worker_thread+0xa63/0x1210 kernel/workqueue.c:2552
 kthread+0x2b8/0x350 kernel/kthread.c:379
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
 </TASK>

Allocated by task 17147:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:196 [inline]
 __do_kmalloc_node mm/slab_common.c:966 [inline]
 __kmalloc_node+0xb8/0x230 mm/slab_common.c:973
 kmalloc_node include/linux/slab.h:579 [inline]
 kvmalloc_node+0x72/0x180 mm/util.c:604
 kvmalloc include/linux/slab.h:697 [inline]
 kvzalloc include/linux/slab.h:705 [inline]
 alloc_netdev_mqs+0x89/0xf30 net/core/dev.c:10626
 rtnl_create_link+0x2f7/0xc00 net/core/rtnetlink.c:3315
 rtnl_newlink_create net/core/rtnetlink.c:3433 [inline]
 __rtnl_newlink net/core/rtnetlink.c:3660 [inline]
 rtnl_newlink+0x1379/0x2010 net/core/rtnetlink.c:3673
 rtnetlink_rcv_msg+0x825/0xf40 net/core/rtnetlink.c:6395
 netlink_rcv_skb+0x1df/0x430 net/netlink/af_netlink.c:2546
 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
 netlink_unicast+0x7c3/0x990 net/netlink/af_netlink.c:1365
 netlink_sendmsg+0xa2a/0xd60 net/netlink/af_netlink.c:1913
 sock_sendmsg_nosec net/socket.c:724 [inline]
 sock_sendmsg net/socket.c:747 [inline]
 __sys_sendto+0x475/0x630 net/socket.c:2144
 __do_sys_sendto net/socket.c:2156 [inline]
 __se_sys_sendto net/socket.c:2152 [inline]
 __x64_sys_sendto+0xde/0xf0 net/socket.c:2152
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 5233:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4f/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:521
 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:162 [inline]
 slab_free_hook mm/slub.c:1781 [inline]
 slab_free_freelist_hook mm/slub.c:1807 [inline]
 slab_free mm/slub.c:3786 [inline]
 __kmem_cache_free+0x264/0x3c0 mm/slub.c:3799
 device_release+0x95/0x1c0
 kobject_cleanup lib/kobject.c:683 [inline]
 kobject_release lib/kobject.c:714 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x228/0x470 lib/kobject.c:731
 netdev_run_todo+0xe5a/0xf50 net/core/dev.c:10400
 default_device_exit_batch+0x5c9/0x630 net/core/dev.c:11392
 ops_exit_list net/core/net_namespace.c:175 [inline]
 cleanup_net+0x767/0xb80 net/core/net_namespace.c:614
 process_one_work+0x8a0/0x10e0 kernel/workqueue.c:2405
 worker_thread+0xa63/0x1210 kernel/workqueue.c:2552
 kthread+0x2b8/0x350 kernel/kthread.c:379
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Last potentially related work creation:
 kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:491
 insert_work+0x54/0x3d0 kernel/workqueue.c:1365
 __queue_work+0xb37/0xf10 kernel/workqueue.c:1526
 call_timer_fn+0x178/0x580 kernel/time/timer.c:1700
 expire_timers kernel/time/timer.c:1746 [inline]
 __run_timers+0x67a/0x860 kernel/time/timer.c:2022
 run_timer_softirq+0x67/0xf0 kernel/time/timer.c:2035
 __do_softirq+0x2ab/0x908 kernel/softirq.c:571

Second to last potentially related work creation:
 kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:491
 insert_work+0x54/0x3d0 kernel/workqueue.c:1365
 __queue_work+0xb37/0xf10 kernel/workqueue.c:1526
 call_timer_fn+0x178/0x580 kernel/time/timer.c:1700
 expire_timers kernel/time/timer.c:1746 [inline]
 __run_timers+0x67a/0x860 kernel/time/timer.c:2022
 run_timer_softirq+0x67/0xf0 kernel/time/timer.c:2035
 __do_softirq+0x2ab/0x908 kernel/softirq.c:571

The buggy address belongs to the object at ffff88807ef34000
 which belongs to the cache kmalloc-cg-8k of size 8192
The buggy address is located 5376 bytes inside of
 freed 8192-byte region [ffff88807ef34000, ffff88807ef36000)

The buggy address belongs to the physical page:
page:ffffea0001fbcc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7ef30
head:ffffea0001fbcc00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff8880209801c1
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000010200 ffff88801244f640 ffffea0001129400 dead000000000004
raw: 0000000000000000 0000000000020002 00000001ffffffff ffff8880209801c1
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d60c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 7061, tgid 7061 (kworker/0:11), ts 1086041426049, free_ts 1064485220044
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1731
 prep_new_page mm/page_alloc.c:1738 [inline]
 get_page_from_freelist+0x321c/0x33a0 mm/page_alloc.c:3502
 __alloc_pages+0x255/0x670 mm/page_alloc.c:4768
 alloc_slab_page+0x6a/0x160 mm/slub.c:1851
 allocate_slab mm/slub.c:1998 [inline]
 new_slab+0x84/0x2f0 mm/slub.c:2051
 ___slab_alloc+0xa85/0x10a0 mm/slub.c:3192
 __slab_alloc mm/slub.c:3291 [inline]
 __slab_alloc_node mm/slub.c:3344 [inline]
 slab_alloc_node mm/slub.c:3441 [inline]
 __kmem_cache_alloc_node+0x1b8/0x290 mm/slub.c:3490
 __do_kmalloc_node mm/slab_common.c:965 [inline]
 __kmalloc_node+0xa7/0x230 mm/slab_common.c:973
 kmalloc_node include/linux/slab.h:579 [inline]
 kvmalloc_node+0x72/0x180 mm/util.c:604
 kvmalloc include/linux/slab.h:697 [inline]
 kvzalloc include/linux/slab.h:705 [inline]
 alloc_netdev_mqs+0x89/0xf30 net/core/dev.c:10626
 usbnet_probe+0x196/0x2770 drivers/net/usb/usbnet.c:1698
 usb_probe_interface+0x5c4/0xb00 drivers/usb/core/driver.c:396
 really_probe+0x294/0xc30 drivers/base/dd.c:658
 __driver_probe_device+0x1a2/0x3d0 drivers/base/dd.c:800
 driver_probe_device+0x50/0x420 drivers/base/dd.c:830
 __device_attach_driver+0x2d3/0x520 drivers/base/dd.c:958
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1302 [inline]
 free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2564
 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2659
 discard_slab mm/slub.c:2097 [inline]
 __unfreeze_partials+0x1b1/0x1f0 mm/slub.c:2636
 put_cpu_partial+0x116/0x180 mm/slub.c:2712
 qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:185
 kasan_quarantine_reduce+0x14b/0x160 mm/kasan/quarantine.c:292
 __kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:186 [inline]
 slab_post_alloc_hook+0x68/0x3a0 mm/slab.h:711
 slab_alloc_node mm/slub.c:3451 [inline]
 __kmem_cache_alloc_node+0x14c/0x290 mm/slub.c:3490
 __do_kmalloc_node mm/slab_common.c:965 [inline]
 __kmalloc+0xa8/0x230 mm/slab_common.c:979
 kmalloc include/linux/slab.h:563 [inline]
 kernfs_fop_write_iter+0x15b/0x4f0 fs/kernfs/file.c:311
 do_iter_write+0x7b1/0xcb0 fs/read_write.c:860
 vfs_writev fs/read_write.c:933 [inline]
 do_writev+0x27f/0x470 fs/read_write.c:976
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Memory state around the buggy address:
 ffff88807ef35400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807ef35480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807ef35500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88807ef35580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807ef35600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (18):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/05/05 03:59 upstream 3c4aa4434377 518a39a6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-use-after-free Write in enqueue_timer
2023/04/30 18:01 upstream 825a0714d2b3 62df2017 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Write in enqueue_timer
2023/04/26 17:11 upstream 0cfd8703e7da 19a3dabe .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-use-after-free Write in enqueue_timer
2023/05/06 18:26 upstream 2e1e1337881b 90c93c40 .config console log report info ci-qemu-upstream-386 KASAN: slab-use-after-free Write in enqueue_timer
2023/05/06 03:38 bpf 415d7a49cd79 4cec9341 .config console log report info ci-upstream-bpf-kasan-gce KASAN: slab-use-after-free Write in enqueue_timer
2023/05/04 21:33 bpf 415d7a49cd79 3a560463 .config console log report info ci-upstream-bpf-kasan-gce KASAN: slab-use-after-free Write in enqueue_timer
2023/05/04 11:59 net b9850ec0027c 3a560463 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Write in enqueue_timer
2023/05/04 02:00 bpf 415d7a49cd79 b5918830 .config console log report info ci-upstream-bpf-kasan-gce KASAN: slab-use-after-free Write in enqueue_timer
2023/05/01 22:56 bpf 415d7a49cd79 62df2017 .config console log report info ci-upstream-bpf-kasan-gce KASAN: slab-use-after-free Write in enqueue_timer
2023/04/30 16:31 net 6686317855c6 62df2017 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Write in enqueue_timer
2023/05/16 00:40 bpf-next 90564f1e3dd6 71b00cfb .config console log report info ci-upstream-bpf-next-kasan-gce KASAN: slab-use-after-free Write in enqueue_timer
2023/05/14 11:58 bpf-next 79b3604d6221 2b9ba477 .config console log report info ci-upstream-bpf-next-kasan-gce KASAN: slab-use-after-free Write in enqueue_timer
2023/05/13 12:47 bpf-next bdeeed3498c7 2b9ba477 .config console log report info ci-upstream-bpf-next-kasan-gce KASAN: slab-use-after-free Write in enqueue_timer
2023/05/10 10:10 bpf-next 6e61c5fa4d43 14b12a99 .config console log report info ci-upstream-bpf-next-kasan-gce KASAN: slab-use-after-free Write in enqueue_timer
2023/05/08 10:35 net-next ed23734c23d2 90c93c40 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Write in enqueue_timer
2023/04/30 23:11 bpf-next 31f4f810d533 62df2017 .config console log report info ci-upstream-bpf-next-kasan-gce KASAN: slab-use-after-free Write in enqueue_timer
2023/04/30 13:53 bpf-next 31f4f810d533 62df2017 .config console log report info ci-upstream-bpf-next-kasan-gce KASAN: slab-use-after-free Write in enqueue_timer
2023/04/22 16:08 linux-next d3e1ee0e67e7 2b32bd34 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-linux-next-kasan-gce-root KASAN: slab-use-after-free Write in enqueue_timer
* Struck through repros no longer work on HEAD.