syzbot


KASAN: slab-use-after-free Read in qfq_reset_qdisc

Status: closed as invalid on 2023/09/21 09:36
Subsystems: net
[Documentation on labels]
First crash: 543d, last: 501d
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 general protection fault in qfq_reset_qdisc (2) 2 1355d 1432d 0/1 auto-closed as invalid on 2021/07/26 19:48
upstream general protection fault in qfq_reset_qdisc net 5 852d 924d 0/28 auto-obsoleted due to no activity on 2022/11/11 06:00
upstream general protection fault in qfq_reset_qdisc (3) net 2 297d 348d 0/28 closed as invalid on 2024/03/12 16:19
upstream KASAN: use-after-free Read in qfq_reset_qdisc net 1 1060d 1060d 0/28 closed as invalid on 2022/02/17 02:00
upstream general protection fault in qfq_reset_qdisc (2) net 1 424d 424d 0/28 closed as invalid on 2023/12/05 18:14
linux-4.14 general protection fault in qfq_reset_qdisc 1 1763d 1763d 0/1 auto-closed as invalid on 2020/06/13 20:08

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in qfq_reset_qdisc+0x335/0x440 net/sched/sch_qfq.c:1447
Read of size 8 at addr ffff888052b6a650 by task kworker/u4:9/11630

CPU: 0 PID: 11630 Comm: kworker/u4:9 Not tainted 6.4.0-rc6-syzkaller-01310-ga52305a81d6b #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Workqueue: netns cleanup_net
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:351
 print_report mm/kasan/report.c:462 [inline]
 kasan_report+0x11c/0x130 mm/kasan/report.c:572
 qfq_reset_qdisc+0x335/0x440 net/sched/sch_qfq.c:1447
 qdisc_reset+0xda/0x620 net/sched/sch_generic.c:1022
 __qdisc_destroy+0x91/0x450 net/sched/sch_generic.c:1060
 qdisc_put+0xd1/0xf0 net/sched/sch_generic.c:1090
 dev_shutdown+0x1ce/0x430 net/sched/sch_generic.c:1478
 unregister_netdevice_many_notify+0x5fc/0x18c0 net/core/dev.c:10840
 unregister_netdevice_many net/core/dev.c:10906 [inline]
 default_device_exit_batch+0x451/0x5b0 net/core/dev.c:11359
 ops_exit_list+0x125/0x170 net/core/net_namespace.c:175
 cleanup_net+0x4ee/0xb10 net/core/net_namespace.c:614
 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2405
 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2552
 kthread+0x344/0x440 kernel/kthread.c:379
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
 </TASK>

Allocated by task 19046:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 ____kasan_kmalloc mm/kasan/common.c:333 [inline]
 __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383
 kmalloc include/linux/slab.h:559 [inline]
 __hw_addr_create net/core/dev_addr_lists.c:60 [inline]
 __hw_addr_add_ex+0x22d/0x7f0 net/core/dev_addr_lists.c:118
 __dev_mc_add net/core/dev_addr_lists.c:867 [inline]
 dev_mc_add+0xc1/0x110 net/core/dev_addr_lists.c:885
 igmp6_group_added+0x4f0/0x5b0 net/ipv6/mcast.c:680
 __ipv6_dev_mc_inc+0x724/0xc60 net/ipv6/mcast.c:949
 ipv6_add_dev+0xa98/0x13b0 net/ipv6/addrconf.c:465
 addrconf_notify+0x7ca/0x19b0 net/ipv6/addrconf.c:3552
 notifier_call_chain+0xb6/0x3c0 kernel/notifier.c:93
 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1962
 call_netdevice_notifiers_extack net/core/dev.c:2000 [inline]
 call_netdevice_notifiers net/core/dev.c:2014 [inline]
 register_netdevice+0xfb4/0x1640 net/core/dev.c:10084
 veth_newlink+0x352/0x9d0 drivers/net/veth.c:1907
 rtnl_newlink_create net/core/rtnetlink.c:3472 [inline]
 __rtnl_newlink+0x10f2/0x1860 net/core/rtnetlink.c:3689
 rtnl_newlink+0x68/0xa0 net/core/rtnetlink.c:3702
 rtnetlink_rcv_msg+0x43d/0xd50 net/core/rtnetlink.c:6424
 netlink_rcv_skb+0x165/0x440 net/netlink/af_netlink.c:2548
 netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
 netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1365
 netlink_sendmsg+0x925/0xe30 net/netlink/af_netlink.c:1913
 sock_sendmsg_nosec net/socket.c:724 [inline]
 sock_sendmsg+0xde/0x190 net/socket.c:747
 ____sys_sendmsg+0x733/0x920 net/socket.c:2493
 ___sys_sendmsg+0x110/0x1b0 net/socket.c:2547
 __sys_sendmsg+0xf7/0x1c0 net/socket.c:2576
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd

Freed by task 7896:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 kasan_set_track+0x25/0x30 mm/kasan/common.c:52
 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:521
 ____kasan_slab_free mm/kasan/common.c:236 [inline]
 ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200
 kasan_slab_free include/linux/kasan.h:162 [inline]
 slab_free_hook mm/slub.c:1781 [inline]
 slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807
 slab_free mm/slub.c:3786 [inline]
 kmem_cache_free_bulk.part.0+0x20c/0x680 mm/slub.c:3904
 kfree_bulk include/linux/slab.h:476 [inline]
 kvfree_rcu_bulk+0x3c2/0x4d0 kernel/rcu/tree.c:2931
 kvfree_rcu_drain_ready kernel/rcu/tree.c:3101 [inline]
 kfree_rcu_monitor+0x401/0x1240 kernel/rcu/tree.c:3119
 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2405
 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2552
 kthread+0x344/0x440 kernel/kthread.c:379
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Last potentially related work creation:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:491
 kvfree_call_rcu+0x70/0xad0 kernel/rcu/tree.c:3332
 __hw_addr_del_entry+0x2e5/0x3c0 net/core/dev_addr_lists.c:161
 __hw_addr_del_ex net/core/dev_addr_lists.c:200 [inline]
 __dev_mc_del net/core/dev_addr_lists.c:908 [inline]
 dev_mc_del+0x106/0x180 net/core/dev_addr_lists.c:926
 igmp6_group_dropped+0x31e/0xf20 net/ipv6/mcast.c:715
 ipv6_mc_down+0xb2/0x4f0 net/ipv6/mcast.c:2719
 ipv6_mc_destroy_dev+0x29/0x670 net/ipv6/mcast.c:2788
 addrconf_ifdown.isra.0+0x12c2/0x1940 net/ipv6/addrconf.c:3898
 addrconf_notify+0x104/0x19b0 net/ipv6/addrconf.c:3678
 notifier_call_chain+0xb6/0x3c0 kernel/notifier.c:93
 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1962
 call_netdevice_notifiers_extack net/core/dev.c:2000 [inline]
 call_netdevice_notifiers net/core/dev.c:2014 [inline]
 unregister_netdevice_many_notify+0x75f/0x18c0 net/core/dev.c:10850
 unregister_netdevice_many net/core/dev.c:10906 [inline]
 default_device_exit_batch+0x451/0x5b0 net/core/dev.c:11359
 ops_exit_list+0x125/0x170 net/core/net_namespace.c:175
 cleanup_net+0x4ee/0xb10 net/core/net_namespace.c:614
 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2405
 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2552
 kthread+0x344/0x440 kernel/kthread.c:379
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Second to last potentially related work creation:
 kasan_save_stack+0x22/0x40 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:491
 kvfree_call_rcu+0x70/0xad0 kernel/rcu/tree.c:3332
 __hw_addr_flush+0x150/0x240 net/core/dev_addr_lists.c:490
 dev_addr_flush+0x21/0x60 net/core/dev_addr_lists.c:535
 free_netdev+0x1fe/0x620 net/core/dev.c:10718
 netdev_run_todo+0xbdc/0x1100 net/core/dev.c:10360
 sit_exit_batch_net+0x4a9/0x580 net/ipv6/sit.c:1888
 ops_exit_list+0x125/0x170 net/core/net_namespace.c:175
 cleanup_net+0x4ee/0xb10 net/core/net_namespace.c:614
 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2405
 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2552
 kthread+0x344/0x440 kernel/kthread.c:379
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

The buggy address belongs to the object at ffff888052b6a600
 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 80 bytes inside of
 freed 128-byte region [ffff888052b6a600, ffff888052b6a680)

The buggy address belongs to the physical page:
page:ffffea00014ada80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x52b6a
ksm flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000200 ffff8880124418c0 ffffea0000d121c0 dead000000000003
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 14748, tgid 14738 (syz-executor.3), ts 1667207073723, free_ts 1667175537881
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x2db/0x350 mm/page_alloc.c:1731
 prep_new_page mm/page_alloc.c:1738 [inline]
 get_page_from_freelist+0xf41/0x2c00 mm/page_alloc.c:3502
 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:4768
 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2279
 alloc_slab_page mm/slub.c:1851 [inline]
 allocate_slab+0x25f/0x390 mm/slub.c:1998
 new_slab mm/slub.c:2051 [inline]
 ___slab_alloc+0xa91/0x1400 mm/slub.c:3192
 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3291
 __slab_alloc_node mm/slub.c:3344 [inline]
 slab_alloc_node mm/slub.c:3441 [inline]
 __kmem_cache_alloc_node+0x136/0x320 mm/slub.c:3490
 __do_kmalloc_node mm/slab_common.c:965 [inline]
 __kmalloc_node_track_caller+0x4f/0x1a0 mm/slab_common.c:986
 kmemdup+0x2c/0x60 mm/util.c:131
 kmemdup include/linux/fortify-string.h:702 [inline]
 mpls_dev_sysctl_register+0xaa/0x310 net/mpls/af_mpls.c:1407
 mpls_add_dev net/mpls/af_mpls.c:1477 [inline]
 mpls_dev_notify+0x3ec/0x9a0 net/mpls/af_mpls.c:1617
 notifier_call_chain+0xb6/0x3c0 kernel/notifier.c:93
 call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1962
 call_netdevice_notifiers_extack net/core/dev.c:2000 [inline]
 call_netdevice_notifiers net/core/dev.c:2014 [inline]
 register_netdevice+0xfb4/0x1640 net/core/dev.c:10084
 register_netdev+0x31/0x50 net/core/dev.c:10179
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+0x62e/0xcb0 mm/page_alloc.c:2564
 free_unref_page+0x33/0x370 mm/page_alloc.c:2659
 vfree+0x180/0x7e0 mm/vmalloc.c:2798
 delayed_vfree_work+0x57/0x70 mm/vmalloc.c:2719
 process_one_work+0x99a/0x15e0 kernel/workqueue.c:2405
 worker_thread+0x67d/0x10c0 kernel/workqueue.c:2552
 kthread+0x344/0x440 kernel/kthread.c:379
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Memory state around the buggy address:
 ffff888052b6a500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888052b6a580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888052b6a600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff888052b6a680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888052b6a700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/18 05:23 net-next a52305a81d6b f3921d4d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in qfq_reset_qdisc
2023/07/30 11:47 upstream 12214540ad87 92476829 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-386 general protection fault in qfq_reset_qdisc
2023/06/27 08:26 net 6709d4b7bc2e 4cd5bb25 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce general protection fault in qfq_reset_qdisc
* Struck through repros no longer work on HEAD.