syzbot


KASAN: use-after-free Read in vlan_dev_get_iflink

Status: upstream: reported C repro on 2020/07/23 18:12
Reported-by: syzbot+d702fd2351989927037c@syzkaller.appspotmail.com
First crash: 795d, last: 625d

Cause bisection: failed (bisect log)

Fix bisection: failed (bisect log)
similar bugs (2):
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 17 132d 896d 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 12 19d 883d 0/1 upstream: reported C repro on 2020/04/25 21:56
Patch testing requests:
Created Duration User Patch Repo Result
2022/09/14 01:27 18m upstream OK log
2020/07/24 04:53 17m xiyou.wangcong@gmail.com https://github.com/congwang/linux.git net OK
2020/07/24 01:59 17m xiyou.wangcong@gmail.com https://github.com/congwang/linux.git net report log
2020/07/23 20:09 10m xiyou.wangcong@gmail.com https://github.com/congwang/linux.git net report log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in vlan_dev_get_iflink+0x5f/0x70 net/8021q/vlan_dev.c:767
Read of size 4 at addr ffff88809501a100 by task syz-executor436/8052

CPU: 1 PID: 8052 Comm: syz-executor436 Not tainted 5.8.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x18f/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 vlan_dev_get_iflink+0x5f/0x70 net/8021q/vlan_dev.c:767
 dev_get_iflink+0x73/0xe0 net/core/dev.c:815
 rfc2863_policy+0x243/0x2e0 net/core/link_watch.c:41
 linkwatch_do_dev+0x2a/0x180 net/core/link_watch.c:160
 linkwatch_forget_dev+0x16a/0x200 net/core/link_watch.c:237
 netdev_wait_allrefs net/core/dev.c:9991 [inline]
 netdev_run_todo+0x258/0xac0 net/core/dev.c:10087
 rtnl_unlock net/core/rtnetlink.c:112 [inline]
 rtnetlink_rcv_msg+0x45b/0xad0 net/core/rtnetlink.c:5564
 netlink_rcv_skb+0x15a/0x430 net/netlink/af_netlink.c:2470
 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:671
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2359
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2413
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2446
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x446d79
Code: e8 0c e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 db 06 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f6df83a6d98 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000006dbc78 RCX: 0000000000446d79
RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000000000003
RBP: 00000000006dbc70 R08: 0000000000000018 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000246 R12: 00000000006dbc7c
R13: 0000000000040000 R14: 0000000000000000 R15: 0705001000000048

Allocated by task 8039:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461
 kmalloc_node include/linux/slab.h:577 [inline]
 kvmalloc_node+0x61/0xf0 mm/util.c:574
 kvmalloc include/linux/mm.h:753 [inline]
 kvzalloc include/linux/mm.h:761 [inline]
 alloc_netdev_mqs+0x97/0xdc0 net/core/dev.c:10251
 rtnl_create_link+0x219/0xad0 net/core/rtnetlink.c:3169
 __rtnl_newlink+0xf9b/0x1740 net/core/rtnetlink.c:3431
 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3500
 rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5563
 netlink_rcv_skb+0x15a/0x430 net/netlink/af_netlink.c:2470
 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:671
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2359
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2413
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2446
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 8039:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:56
 kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355
 __kasan_slab_free+0xd8/0x120 mm/kasan/common.c:422
 __cache_free mm/slab.c:3418 [inline]
 kfree+0x103/0x2c0 mm/slab.c:3756
 kvfree+0x42/0x50 mm/util.c:603
 device_release+0x71/0x200 drivers/base/core.c:1800
 kobject_cleanup lib/kobject.c:704 [inline]
 kobject_release lib/kobject.c:735 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x171/0x270 lib/kobject.c:752
 netdev_run_todo+0x765/0xac0 net/core/dev.c:10110
 rtnl_unlock net/core/rtnetlink.c:112 [inline]
 rtnetlink_rcv_msg+0x45b/0xad0 net/core/rtnetlink.c:5564
 netlink_rcv_skb+0x15a/0x430 net/netlink/af_netlink.c:2470
 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:671
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2359
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2413
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2446
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff88809501a000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 256 bytes inside of
 4096-byte region [ffff88809501a000, ffff88809501b000)
The buggy address belongs to the page:
page:00000000483e6e3a refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x9501a
head:00000000483e6e3a order:1 compound_mapcount:0
flags: 0xfffe0000010200(slab|head)
raw: 00fffe0000010200 ffffea0002553088 ffffea0002555188 ffff8880aa040900
raw: 0000000000000000 ffff88809501a000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809501a000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809501a080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88809501a100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff88809501a180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809501a200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (13):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-root 2020/08/10 12:00 upstream 9420f1ce0186 70301872 .config log report syz C
ci-upstream-kasan-gce-root 2020/07/25 18:28 upstream 68845a55c31b 1f7cc1ca .config log report syz C
ci-upstream-kasan-gce 2020/07/23 08:38 upstream 8c26c87b0532 340ea530 .config log report syz C
ci-upstream-kasan-gce-selinux-root 2020/12/05 20:21 upstream b3298500b23f 50503117 .config log report info
ci-upstream-kasan-gce 2020/11/16 23:22 upstream 09162bc32c88 1bf9a662 .config log report info
ci-upstream-kasan-gce-smack-root 2020/10/02 17:58 upstream 472e5b056f00 4969d6ca .config log report info
ci-upstream-kasan-gce-root 2020/09/11 09:21 upstream 581cb3a26baf adfb8b4e .config log report
ci-upstream-kasan-gce-smack-root 2020/09/09 13:25 upstream 34d4ddd359db 0ea7a887 .config log report
ci-upstream-kasan-gce 2020/08/30 10:16 upstream 1127b219ce94 d5a3ae1f .config log report
ci-upstream-kasan-gce-smack-root 2020/08/13 04:21 upstream fb893de323e2 bc15f7db .config log report
ci-upstream-net-this-kasan-gce 2021/01/09 09:11 net 6279d812eab6 c104d4a3 .config log report info
ci-upstream-linux-next-kasan-gce-root 2020/09/24 08:43 linux-next dcf2427baa64 54289b08 .config log report info
ci-upstream-linux-next-kasan-gce-root 2020/09/02 03:50 linux-next b36c969764ab abf9ba4f .config log report
* Struck through repros no longer work on HEAD.