syzbot


KASAN: use-after-free Read in vlan_dev_get_iflink

Status: upstream: reported on 2024/07/31 22:57
Reported-by: syzbot+aa9696808b5294ae3307@syzkaller.appspotmail.com
First crash: 112d, last: 83d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in vlan_dev_get_iflink C error 18 744d 1683d 0/1 upstream: reported C repro on 2020/04/13 08:02
linux-4.14 KASAN: use-after-free Read in vlan_dev_get_iflink C error 12 807d 1670d 0/1 upstream: reported C repro on 2020/04/25 21:56
upstream KASAN: use-after-free Read in vlan_dev_get_iflink net C error error 13 1412d 1582d 0/28 auto-obsoleted due to no activity on 2022/09/27 12:32
android-5-15 KASAN: use-after-free Read in vlan_dev_get_iflink 2 50d 100d 0/2 premoderation: reported on 2024/08/13 02:40

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in vlan_dev_get_iflink+0x6b/0x70 net/8021q/vlan_dev.c:789
Read of size 4 at addr ffff88801a0f00d0 by task kworker/u4:8/3859

CPU: 0 PID: 3859 Comm: kworker/u4:8 Not tainted 5.15.165-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Workqueue: events_unbound linkwatch_event
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 vlan_dev_get_iflink+0x6b/0x70 net/8021q/vlan_dev.c:789
 default_operstate net/core/link_watch.c:41 [inline]
 rfc2863_policy+0x120/0x2b0 net/core/link_watch.c:53
 linkwatch_do_dev+0x38/0x160 net/core/link_watch.c:160
 __linkwatch_run_queue+0x4ca/0x7f0 net/core/link_watch.c:213
 linkwatch_event+0x48/0x50 net/core/link_watch.c:252
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

Allocated by task 4891:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc+0xba/0xf0 mm/kasan/common.c:513
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 __kmalloc_node+0x199/0x390 mm/slub.c:4455
 kmalloc_node include/linux/slab.h:614 [inline]
 kvmalloc_node+0x80/0x140 mm/util.c:619
 kvmalloc include/linux/mm.h:805 [inline]
 kvzalloc include/linux/mm.h:813 [inline]
 alloc_netdev_mqs+0x85/0xc10 net/core/dev.c:10844
 rtnl_create_link+0x2e9/0x9c0 net/core/rtnetlink.c:3200
 __rtnl_newlink net/core/rtnetlink.c:3482 [inline]
 rtnl_newlink+0x13f6/0x2070 net/core/rtnetlink.c:3540
 rtnetlink_rcv_msg+0x993/0xee0 net/core/rtnetlink.c:5618
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2504
 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
 netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1352
 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1920
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 __sys_sendto+0x564/0x720 net/socket.c:2058
 __do_sys_sendto net/socket.c:2070 [inline]
 __se_sys_sendto net/socket.c:2066 [inline]
 __x64_sys_sendto+0xda/0xf0 net/socket.c:2066
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 4060:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0xf1/0x270 mm/slub.c:4559
 device_release+0x91/0x1c0
 kobject_cleanup lib/kobject.c:713 [inline]
 kobject_release lib/kobject.c:744 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x224/0x460 lib/kobject.c:761
 netdev_run_todo+0xaaf/0xc40 net/core/dev.c:10662
 default_device_exit_batch+0x395/0x3f0 net/core/dev.c:11628
 ops_exit_list net/core/net_namespace.c:177 [inline]
 cleanup_net+0x763/0xb60 net/core/net_namespace.c:599
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

The buggy address belongs to the object at ffff88801a0f0000
 which belongs to the cache kmalloc-cg-4k of size 4096
The buggy address is located 208 bytes inside of
 4096-byte region [ffff88801a0f0000, ffff88801a0f1000)
The buggy address belongs to the page:
page:ffffea0000683c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1a0f0
head:ffffea0000683c00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888011c4c280
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 0xd60c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3576, ts 45010288937, free_ts 44929329771
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5423
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 __kmalloc_node+0x1fa/0x390 mm/slub.c:4451
 kmalloc_node include/linux/slab.h:614 [inline]
 kvmalloc_node+0x80/0x140 mm/util.c:619
 kvmalloc include/linux/mm.h:805 [inline]
 kvzalloc include/linux/mm.h:813 [inline]
 alloc_netdev_mqs+0x85/0xc10 net/core/dev.c:10844
 rtnl_create_link+0x2e9/0x9c0 net/core/rtnetlink.c:3200
 veth_newlink+0x2df/0xe20 drivers/net/veth.c:1667
 __rtnl_newlink net/core/rtnetlink.c:3492 [inline]
 rtnl_newlink+0x14e1/0x2070 net/core/rtnetlink.c:3540
 rtnetlink_rcv_msg+0x993/0xee0 net/core/rtnetlink.c:5618
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2504
 netlink_unicast_kernel net/netlink/af_netlink.c:1326 [inline]
 netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1352
 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1920
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 __sys_sendto+0x564/0x720 net/socket.c:2058
 __do_sys_sendto net/socket.c:2070 [inline]
 __se_sys_sendto net/socket.c:2066 [inline]
 __x64_sys_sendto+0xda/0xf0 net/socket.c:2066
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 free_slab mm/slub.c:2015 [inline]
 discard_slab mm/slub.c:2021 [inline]
 __unfreeze_partials+0x1b7/0x210 mm/slub.c:2507
 put_cpu_partial+0x132/0x1a0 mm/slub.c:2587
 do_slab_free mm/slub.c:3487 [inline]
 ___cache_free+0xe3/0x100 mm/slub.c:3506
 qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 kmem_cache_alloc_node+0x121/0x2c0 mm/slub.c:3256
 __alloc_skb+0xdd/0x590 net/core/skbuff.c:415
 alloc_skb include/linux/skbuff.h:1167 [inline]
 nlmsg_new include/net/netlink.h:953 [inline]
 rtmsg_ifinfo_build_skb+0x81/0x180 net/core/rtnetlink.c:3852
 rtmsg_ifinfo_event net/core/rtnetlink.c:3888 [inline]
 rtnetlink_event+0xee/0x1b0 net/core/rtnetlink.c:5669
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:391
 call_netdevice_notifiers_info net/core/dev.c:2018 [inline]
 netdev_lower_state_changed+0x1b9/0x260 net/core/dev.c:8566
 team_lower_state_changed drivers/net/team/team.c:89 [inline]
 team_refresh_port_linkup drivers/net/team/team.c:99 [inline]
 __team_port_change_send+0x215/0x5b0 drivers/net/team/team.c:2936

Memory state around the buggy address:
 ffff88801a0eff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88801a0f0000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88801a0f0080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff88801a0f0100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801a0f0180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/08/29 21:23 linux-5.15.y fa93fa65db6e 9bd464fc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in vlan_dev_get_iflink
2024/08/28 18:30 linux-5.15.y fa93fa65db6e ef3de9e8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in vlan_dev_get_iflink
2024/08/01 23:42 linux-5.15.y 7e89efd3ae1c 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in vlan_dev_get_iflink
2024/07/31 22:56 linux-5.15.y 7e89efd3ae1c 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in vlan_dev_get_iflink
* Struck through repros no longer work on HEAD.