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: 111d, last: 9d07h
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 755d 1694d 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 818d 1682d 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 95d 124d 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 1423d 1593d 0/28 auto-obsoleted due to no activity on 2022/09/27 12:32

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

CPU: 1 PID: 312 Comm: kworker/u4:3 Not tainted 5.15.168-syzkaller-00719-g101e665d55a8 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024
Workqueue: netns cleanup_net
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_forget_dev+0x170/0x180 net/core/link_watch.c:238
 netdev_run_todo+0x2ec/0x9f0 net/core/dev.c:10651
 rtnl_unlock+0xe/0x10 net/core/rtnetlink.c:112
 default_device_exit_batch+0x38f/0x3f0 net/core/dev.c:11648
 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:287
 </TASK>

Allocated by task 2640:
 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:10864
 rtnl_create_link+0x2e1/0x9d0 net/core/rtnetlink.c:3229
 __rtnl_newlink net/core/rtnetlink.c:3511 [inline]
 rtnl_newlink+0x13dc/0x2050 net/core/rtnetlink.c:3569
 rtnetlink_rcv_msg+0x951/0xc40 net/core/rtnetlink.c:5647
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2508
 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5665
 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:2063
 __do_sys_sendto net/socket.c:2075 [inline]
 __se_sys_sendto net/socket.c:2071 [inline]
 __x64_sys_sendto+0xe5/0x100 net/socket.c:2071
 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 312:
 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:10818
 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:10674
 rtnl_unlock+0xe/0x10 net/core/rtnetlink.c:112
 default_device_exit_batch+0x38f/0x3f0 net/core/dev.c:11648
 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:287

The buggy address belongs to the object at ffff888112f52000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 208 bytes inside of
 4096-byte region [ffff888112f52000, ffff888112f53000)
The buggy address belongs to the page:
page:ffffea00044bd400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x112f50
head:ffffea00044bd400 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 106, ts 5208945680, 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]
 __kmalloc+0x16d/0x270 mm/slub.c:4423
 __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]
 seq_buf_alloc fs/seq_file.c:38 [inline]
 seq_read_iter+0x1ff/0xd00 fs/seq_file.c:210
 kernfs_fop_read_iter+0x145/0x470 fs/kernfs/file.c:241
 call_read_iter include/linux/fs.h:2200 [inline]
 new_sync_read fs/read_write.c:404 [inline]
 vfs_read+0xa81/0xd40 fs/read_write.c:485
 ksys_read+0x199/0x2c0 fs/read_write.c:623
 __do_sys_read fs/read_write.c:633 [inline]
 __se_sys_read fs/read_write.c:631 [inline]
 __x64_sys_read+0x7b/0x90 fs/read_write.c:631
 x64_sys_call+0x28/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:1
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888112f51f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888112f52000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888112f52080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                 ^
 ffff888112f52100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888112f52180: fb 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
2024/11/23 18:36 android13-5.15-lts 101e665d55a8 68da6d95 .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/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.