syzbot


KASAN: use-after-free Read in vlan_dev_get_iflink

Status: premoderation: reported on 2024/08/13 02:40
Reported-by: syzbot+ada687bbc7aa6882b4c9@syzkaller.appspotmail.com
First crash: 100d, last: 49d
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 806d 1670d 0/1 upstream: reported C repro on 2020/04/25 21:56
linux-5.15 KASAN: use-after-free Read in vlan_dev_get_iflink 4 83d 112d 0/3 upstream: reported on 2024/07/31 22:57
upstream KASAN: use-after-free Read in vlan_dev_get_iflink net C error error 13 1412d 1581d 0/28 auto-obsoleted due to no activity on 2022/09/27 12:32

Sample crash report:
IPv6: ADDRCONF(NETDEV_CHANGE): bridge0: link becomes ready
==================================================================
BUG: KASAN: use-after-free in vlan_dev_get_iflink+0x70/0x80 net/8021q/vlan_dev.c:789
Read of size 4 at addr ffff8881077b20d0 by task kworker/1:4/325

CPU: 1 PID: 325 Comm: kworker/1:4 Not tainted 5.15.161-syzkaller-00463-g8e36931104ac #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Workqueue: events linkwatch_event
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1c0 lib/dump_stack.c:106
 print_address_description+0x87/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:444
 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308
 vlan_dev_get_iflink+0x70/0x80 net/8021q/vlan_dev.c:789
 dev_get_iflink+0x6f/0xc0 net/core/dev.c:711
 default_operstate net/core/link_watch.c:41 [inline]
 rfc2863_policy+0x127/0x2b0 net/core/link_watch.c:53
 linkwatch_do_dev+0x3c/0x160 net/core/link_watch.c:160
 __linkwatch_run_queue+0x4ca/0x7f0 net/core/link_watch.c:213
 linkwatch_event+0x4c/0x60 net/core/link_watch.c:252
 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325
 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472
 kthread+0x421/0x510 kernel/kthread.c:337
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:300
 </TASK>

Allocated by task 1002:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:433 [inline]
 ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:512
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:521
 kasan_kmalloc include/linux/kasan.h:227 [inline]
 __kmalloc+0x13a/0x270 mm/slub.c:4427
 __kmalloc_node include/linux/slab.h:469 [inline]
 kmalloc_node include/linux/slab.h:626 [inline]
 kvmalloc_node+0x1f0/0x4d0 mm/util.c:628
 kvmalloc include/linux/mm.h:851 [inline]
 kvzalloc include/linux/mm.h:859 [inline]
 alloc_netdev_mqs+0x8c/0xc90 net/core/dev.c:10859
 rtnl_create_link+0x2e1/0x9d0 net/core/rtnetlink.c:3206
 __rtnl_newlink net/core/rtnetlink.c:3491 [inline]
 rtnl_newlink+0x13a7/0x2050 net/core/rtnetlink.c:3549
 rtnetlink_rcv_msg+0x951/0xc40 net/core/rtnetlink.c:5629
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2508
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5647
 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
 netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1356
 netlink_sendmsg+0xa0a/0xd20 net/netlink/af_netlink.c:1924
 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+0xe5/0x100 net/socket.c:2066
 x64_sys_call+0x15c/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:45
 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 45:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:193 [inline]
 slab_free_hook mm/slub.c:1723 [inline]
 slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1749
 slab_free mm/slub.c:3519 [inline]
 kfree+0xc8/0x220 mm/slub.c:4579
 kvfree+0x35/0x40 mm/util.c:664
 netdev_freemem+0x3f/0x60 net/core/dev.c:10813
 netdev_release+0x7f/0xb0 net/core/net-sysfs.c:1903
 device_release+0x95/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+0x178/0x260 lib/kobject.c:761
 netdev_run_todo+0x869/0x9f0 net/core/dev.c:10669
 rtnl_unlock+0xe/0x10 net/core/rtnetlink.c:112
 default_device_exit_batch+0x38f/0x3f0 net/core/dev.c:11643
 ops_exit_list net/core/net_namespace.c:177 [inline]
 cleanup_net+0x6ce/0xc00 net/core/net_namespace.c:599
 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325
 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472
 kthread+0x421/0x510 kernel/kthread.c:337
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:300

The buggy address belongs to the object at ffff8881077b2000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 208 bytes inside of
 4096-byte region [ffff8881077b2000, ffff8881077b3000)
The buggy address belongs to the page:
page:ffffea00041dec00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1077b0
head:ffffea00041dec00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 dead000000000100 dead000000000122 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, ts 1095153336, free_ts 0
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2605
 prep_new_page+0x1b/0x110 mm/page_alloc.c:2611
 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4485
 __alloc_pages+0x27e/0x8f0 mm/page_alloc.c:5779
 allocate_slab mm/slub.c:1932 [inline]
 new_slab+0x9a/0x4e0 mm/slub.c:1995
 ___slab_alloc+0x39e/0x830 mm/slub.c:3028
 __slab_alloc+0x4a/0x90 mm/slub.c:3115
 slab_alloc_node mm/slub.c:3206 [inline]
 slab_alloc mm/slub.c:3248 [inline]
 kmem_cache_alloc_trace+0x142/0x210 mm/slub.c:3265
 kmalloc include/linux/slab.h:603 [inline]
 kzalloc include/linux/slab.h:733 [inline]
 kobject_uevent_env+0x269/0x700 lib/kobject_uevent.c:524
 kobject_uevent+0x1f/0x30 lib/kobject_uevent.c:642
 kernel_add_sysfs_param+0x108/0x130 kernel/params.c:816
 param_sysfs_builtin+0x16a/0x1f0 kernel/params.c:851
 param_sysfs_init+0x6a/0x70 kernel/params.c:970
 do_one_initcall+0x182/0x610 init/main.c:1302
 do_initcall_level+0x186/0x310 init/main.c:1375
 do_initcalls+0x4e/0x90 init/main.c:1391
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8881077b1f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881077b2000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8881077b2080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff8881077b2100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881077b2180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/10/02 17:06 android13-5.15-lts 8e36931104ac 02f9582a .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in vlan_dev_get_iflink
2024/08/13 02:39 android13-5.15-lts 70e1a731d986 7b0f4b46 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Read in vlan_dev_get_iflink
* Struck through repros no longer work on HEAD.