syzbot


KASAN: use-after-free Read in qfq_reset_qdisc

Status: closed as invalid on 2022/02/17 02:00
Subsystems: net
[Documentation on labels]
First crash: 1058d, last: 1058d
Similar bugs (9)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream general protection fault in qfq_reset_qdisc net 5 850d 922d 0/28 auto-obsoleted due to no activity on 2022/11/11 06:00
linux-4.19 KASAN: use-after-free Read in qfq_reset_qdisc 2 1768d 1778d 0/1 auto-closed as invalid on 2020/06/06 11:35
linux-4.14 KASAN: use-after-free Read in qfq_reset_qdisc 6 1561d 1874d 0/1 auto-closed as invalid on 2020/12/30 04:03
linux-4.19 KASAN: use-after-free Read in qfq_reset_qdisc (2) 1 1596d 1596d 0/1 auto-closed as invalid on 2020/11/25 14:56
linux-4.19 KASAN: use-after-free Read in qfq_reset_qdisc (3) 1 1465d 1465d 0/1 auto-closed as invalid on 2021/04/05 19:15
linux-4.14 general protection fault in qfq_reset_qdisc (2) 2 1353d 1430d 0/1 auto-closed as invalid on 2021/07/26 19:48
upstream KASAN: slab-use-after-free Read in qfq_reset_qdisc net 3 499d 541d 0/28 closed as invalid on 2023/09/21 09:36
upstream general protection fault in qfq_reset_qdisc (3) net 2 295d 346d 0/28 closed as invalid on 2024/03/12 16:19
upstream general protection fault in qfq_reset_qdisc (2) net 1 422d 422d 0/28 closed as invalid on 2023/12/05 18:14

Sample crash report:
bridge0: port 1(bridge_slave_0) entered disabled state
device veth1_vlan left promiscuous mode
==================================================================
BUG: KASAN: use-after-free in qfq_reset_qdisc+0x3b2/0x4d0 net/sched/sch_qfq.c:1455
Read of size 8 at addr ffff8880238dd450 by task kworker/u4:16/1252

CPU: 1 PID: 1252 Comm: kworker/u4:16 Not tainted 5.16.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: netns cleanup_net
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:255
 __kasan_report mm/kasan/report.c:442 [inline]
 kasan_report.cold+0x83/0xdf mm/kasan/report.c:459
 qfq_reset_qdisc+0x3b2/0x4d0 net/sched/sch_qfq.c:1455
 qdisc_reset+0xdb/0x730 net/sched/sch_generic.c:1027
 qdisc_destroy+0x91/0x4f0 net/sched/sch_generic.c:1072
 qdisc_put+0xcd/0xe0 net/sched/sch_generic.c:1094
 dev_shutdown+0x298/0x4a0 net/sched/sch_generic.c:1478
 unregister_netdevice_many+0x816/0x1850 net/core/dev.c:10402
 default_device_exit_batch+0x2fa/0x3c0 net/core/dev.c:10939
 ops_exit_list+0x10d/0x160 net/core/net_namespace.c:171
 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:595
 process_one_work+0x9b2/0x1660 kernel/workqueue.c:2298
 worker_thread+0x65d/0x1130 kernel/workqueue.c:2445
 kthread+0x405/0x4f0 kernel/kthread.c:327
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
 </TASK>

Allocated by task 19658:
 kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:437 [inline]
 ____kasan_kmalloc mm/kasan/common.c:516 [inline]
 ____kasan_kmalloc mm/kasan/common.c:475 [inline]
 __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:525
 kmalloc include/linux/slab.h:582 [inline]
 __hw_addr_create net/core/dev_addr_lists.c:58 [inline]
 __hw_addr_add_ex+0x22d/0x7e0 net/core/dev_addr_lists.c:116
 __hw_addr_add net/core/dev_addr_lists.c:133 [inline]
 dev_addr_init+0x13a/0x220 net/core/dev_addr_lists.c:556
 alloc_netdev_mqs+0x27b/0x1060 net/core/dev.c:10174
 __ip_tunnel_create+0x201/0x5c0 net/ipv4/ip_tunnel.c:254
 ip_tunnel_init_net+0x2e4/0x9d0 net/ipv4/ip_tunnel.c:1070
 ops_init+0xaf/0x470 net/core/net_namespace.c:140
 setup_net+0x54f/0xbb0 net/core/net_namespace.c:328
 copy_net_ns+0x318/0x760 net/core/net_namespace.c:472
 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226
 ksys_unshare+0x445/0x920 kernel/fork.c:3075
 __do_sys_unshare kernel/fork.c:3146 [inline]
 __se_sys_unshare kernel/fork.c:3144 [inline]
 __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3144
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 1252:
 kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38
 kasan_set_track+0x21/0x30 mm/kasan/common.c:46
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370
 ____kasan_slab_free mm/kasan/common.c:367 [inline]
 ____kasan_slab_free+0x130/0x160 mm/kasan/common.c:329
 kasan_slab_free include/linux/kasan.h:236 [inline]
 slab_free_hook mm/slub.c:1728 [inline]
 slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1754
 slab_free mm/slub.c:3509 [inline]
 kfree+0xcb/0x280 mm/slub.c:4562
 mpls_dev_sysctl_unregister net/mpls/af_mpls.c:1442 [inline]
 mpls_dev_notify+0x503/0x8a0 net/mpls/af_mpls.c:1654
 notifier_call_chain+0xb5/0x200 kernel/notifier.c:84
 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1919
 call_netdevice_notifiers_extack net/core/dev.c:1931 [inline]
 call_netdevice_notifiers net/core/dev.c:1945 [inline]
 unregister_netdevice_many+0x964/0x1850 net/core/dev.c:10409
 default_device_exit_batch+0x2fa/0x3c0 net/core/dev.c:10939
 ops_exit_list+0x10d/0x160 net/core/net_namespace.c:171
 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:595
 process_one_work+0x9b2/0x1660 kernel/workqueue.c:2298
 worker_thread+0x65d/0x1130 kernel/workqueue.c:2445
 kthread+0x405/0x4f0 kernel/kthread.c:327
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Last potentially related work creation:
 kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348
 kvfree_call_rcu+0x74/0x990 kernel/rcu/tree.c:3550
 __hw_addr_flush+0x152/0x240 net/core/dev_addr_lists.c:488
 dev_addr_flush+0x1d/0x50 net/core/dev_addr_lists.c:533
 free_netdev+0x1f5/0x5b0 net/core/dev.c:10277
 netdev_run_todo+0x8a0/0xaa0 net/core/dev.c:9958
 ip_tunnel_delete_nets+0x3a4/0x5b0 net/ipv4/ip_tunnel.c:1124
 ops_exit_list+0x10d/0x160 net/core/net_namespace.c:171
 setup_net+0x779/0xbb0 net/core/net_namespace.c:351
 copy_net_ns+0x318/0x760 net/core/net_namespace.c:472
 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226
 ksys_unshare+0x445/0x920 kernel/fork.c:3075
 __do_sys_unshare kernel/fork.c:3146 [inline]
 __se_sys_unshare kernel/fork.c:3144 [inline]
 __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3144
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Second to last potentially related work creation:
 kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348
 kvfree_call_rcu+0x74/0x990 kernel/rcu/tree.c:3550
 __hw_addr_flush+0x152/0x240 net/core/dev_addr_lists.c:488
 dev_addr_flush+0x1d/0x50 net/core/dev_addr_lists.c:533
 free_netdev+0x1f5/0x5b0 net/core/dev.c:10277
 netdev_run_todo+0x8a0/0xaa0 net/core/dev.c:9958
 ip_tunnel_delete_nets+0x3a4/0x5b0 net/ipv4/ip_tunnel.c:1124
 ops_exit_list+0x10d/0x160 net/core/net_namespace.c:171
 setup_net+0x779/0xbb0 net/core/net_namespace.c:351
 copy_net_ns+0x318/0x760 net/core/net_namespace.c:472
 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226
 ksys_unshare+0x445/0x920 kernel/fork.c:3075
 __do_sys_unshare kernel/fork.c:3146 [inline]
 __se_sys_unshare kernel/fork.c:3144 [inline]
 __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3144
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff8880238dd400
 which belongs to the cache kmalloc-128 of size 128
The buggy address is located 80 bytes inside of
 128-byte region [ffff8880238dd400, ffff8880238dd480)
The buggy address belongs to the page:
page:ffffea00008e3740 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x238dd
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea0001e30540 dead000000000002 ffff888010c418c0
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 13152, ts 1335550032796, free_ts 1335501289831
 prep_new_page mm/page_alloc.c:2418 [inline]
 get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369
 __alloc_pages_node include/linux/gfp.h:570 [inline]
 alloc_slab_page mm/slub.c:1801 [inline]
 allocate_slab mm/slub.c:1944 [inline]
 new_slab+0xab/0x3b0 mm/slub.c:2004
 ___slab_alloc+0x87c/0xe90 mm/slub.c:3018
 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105
 slab_alloc_node mm/slub.c:3196 [inline]
 __kmalloc_node+0x2cb/0x390 mm/slub.c:4468
 kmalloc_array_node include/linux/slab.h:678 [inline]
 kcalloc_node include/linux/slab.h:683 [inline]
 memcg_alloc_slab_cgroups+0x8b/0x140 mm/memcontrol.c:2827
 account_slab mm/slab.h:642 [inline]
 allocate_slab mm/slub.c:1960 [inline]
 new_slab+0x2ee/0x3b0 mm/slub.c:2004
 ___slab_alloc+0x87c/0xe90 mm/slub.c:3018
 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105
 slab_alloc_node mm/slub.c:3196 [inline]
 slab_alloc mm/slub.c:3238 [inline]
 kmem_cache_alloc+0x35c/0x3a0 mm/slub.c:3243
 vm_area_alloc+0x1c/0x110 kernel/fork.c:348
 mmap_region+0xa98/0x1630 mm/mmap.c:1766
 do_mmap+0x869/0xfb0 mm/mmap.c:1575
 vm_mmap_pgoff+0x1b7/0x290 mm/util.c:519
 ksys_mmap_pgoff+0x40d/0x5a0 mm/mmap.c:1623
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1338 [inline]
 free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389
 free_unref_page_prepare mm/page_alloc.c:3309 [inline]
 free_unref_page+0x19/0x690 mm/page_alloc.c:3388
 __vunmap+0x781/0xb70 mm/vmalloc.c:2632
 free_work+0x58/0x70 mm/vmalloc.c:95
 process_one_work+0x9b2/0x1660 kernel/workqueue.c:2298
 worker_thread+0x65d/0x1130 kernel/workqueue.c:2445
 kthread+0x405/0x4f0 kernel/kthread.c:327
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Memory state around the buggy address:
 ffff8880238dd300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880238dd380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880238dd400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff8880238dd480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880238dd500: fa 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
2022/01/17 16:06 net-next-old fe8152b38d3a 731a2d23 .config console log report info ci-upstream-net-kasan-gce KASAN: use-after-free Read in qfq_reset_qdisc
* Struck through repros no longer work on HEAD.