syzbot


KASAN: use-after-free Read in vlan_dev_get_iflink

Status: upstream: reported C repro on 2020/04/13 08:02
Reported-by: syzbot+7a5cf69ec079d962792f@syzkaller.appspotmail.com
First crash: 804d, last: 40d

Fix bisection: failed (bisect log)
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in vlan_dev_get_iflink C 12 18d 792d 0/1 upstream: reported C repro on 2020/04/25 21:56
upstream KASAN: use-after-free Read in vlan_dev_get_iflink C error error 13 533d 703d 0/22 upstream: reported C repro on 2020/07/23 18:12

Sample crash report:
netlink: 24 bytes leftover after parsing attributes in process `syz-executor170'.
netlink: 24 bytes leftover after parsing attributes in process `syz-executor170'.
==================================================================
BUG: KASAN: use-after-free in vlan_dev_get_iflink+0x5f/0x70 net/8021q/vlan_dev.c:771
Read of size 4 at addr ffff8880ab50e588 by task syz-executor170/8290

CPU: 1 PID: 8290 Comm: syz-executor170 Not tainted 4.19.211-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+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load4_noabort+0x88/0x90 mm/kasan/report.c:432
 vlan_dev_get_iflink+0x5f/0x70 net/8021q/vlan_dev.c:771
 dev_get_iflink+0x73/0xe0 net/core/dev.c:692
 rfc2863_policy+0x1af/0x200 net/core/link_watch.c:43
 linkwatch_do_dev+0x1d/0x110 net/core/link_watch.c:157
 linkwatch_forget_dev+0x16a/0x200 net/core/link_watch.c:223
 netdev_wait_allrefs net/core/dev.c:8892 [inline]
 netdev_run_todo+0x258/0xab0 net/core/dev.c:8988
 rtnl_unlock net/core/rtnetlink.c:117 [inline]
 rtnetlink_rcv_msg+0x460/0xb80 net/core/rtnetlink.c:4783
 netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2463
 netlink_unicast_kernel net/netlink/af_netlink.c:1325 [inline]
 netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1351
 netlink_sendmsg+0x6c3/0xc50 net/netlink/af_netlink.c:1917
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xc3/0x120 net/socket.c:661
 ___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2227
 __sys_sendmsg net/socket.c:2265 [inline]
 __do_sys_sendmsg net/socket.c:2274 [inline]
 __se_sys_sendmsg net/socket.c:2272 [inline]
 __x64_sys_sendmsg+0x132/0x220 net/socket.c:2272
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7fee36976ea9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 90 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fee36907318 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fee369ff438 RCX: 00007fee36976ea9
RDX: 0000000000000004 RSI: 0000000020000140 RDI: 0000000000000003
RBP: 00007fee369ff430 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000005 R11: 0000000000000246 R12: 00007fee369cd074
R13: 00007ffe587befdf R14: 00007fee36907400 R15: 0000000000022000

Allocated by task 8274:
 __do_kmalloc_node mm/slab.c:3689 [inline]
 __kmalloc_node+0x4c/0x70 mm/slab.c:3696
 kmalloc_node include/linux/slab.h:557 [inline]
 kvmalloc_node+0x61/0xf0 mm/util.c:423
 kvmalloc include/linux/mm.h:577 [inline]
 kvzalloc include/linux/mm.h:585 [inline]
 alloc_netdev_mqs+0x97/0xd50 net/core/dev.c:9152
 rtnl_create_link+0x1d4/0xa40 net/core/rtnetlink.c:2869
 rtnl_newlink+0xf45/0x15c0 net/core/rtnetlink.c:3131
 rtnetlink_rcv_msg+0x453/0xb80 net/core/rtnetlink.c:4782
 netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2463
 netlink_unicast_kernel net/netlink/af_netlink.c:1325 [inline]
 netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1351
 netlink_sendmsg+0x6c3/0xc50 net/netlink/af_netlink.c:1917
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xc3/0x120 net/socket.c:661
 ___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2227
 __sys_sendmsg net/socket.c:2265 [inline]
 __do_sys_sendmsg net/socket.c:2274 [inline]
 __se_sys_sendmsg net/socket.c:2272 [inline]
 __x64_sys_sendmsg+0x132/0x220 net/socket.c:2272
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8302:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 kvfree+0x59/0x60 mm/util.c:452
 device_release+0x76/0x210 drivers/base/core.c:1076
 kobject_cleanup lib/kobject.c:662 [inline]
 kobject_release lib/kobject.c:691 [inline]
 kref_put include/linux/kref.h:70 [inline]
 kobject_put+0x28b/0x5d0 lib/kobject.c:708
 netdev_run_todo+0x77f/0xab0 net/core/dev.c:9011
 rtnl_unlock net/core/rtnetlink.c:117 [inline]
 rtnetlink_rcv_msg+0x460/0xb80 net/core/rtnetlink.c:4783
 netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2463
 netlink_unicast_kernel net/netlink/af_netlink.c:1325 [inline]
 netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1351
 netlink_sendmsg+0x6c3/0xc50 net/netlink/af_netlink.c:1917
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xc3/0x120 net/socket.c:661
 ___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2227
 __sys_sendmsg net/socket.c:2265 [inline]
 __do_sys_sendmsg net/socket.c:2274 [inline]
 __se_sys_sendmsg net/socket.c:2272 [inline]
 __x64_sys_sendmsg+0x132/0x220 net/socket.c:2272
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880ab50e480
 which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 264 bytes inside of
 4096-byte region [ffff8880ab50e480, ffff8880ab50f480)
The buggy address belongs to the page:
page:ffffea0002ad4380 count:1 mapcount:0 mapping:ffff88813bff0dc0 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea00024d4a08 ffffea0002ad4888 ffff88813bff0dc0
raw: 0000000000000000 ffff8880ab50e480 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880ab50e480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880ab50e500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880ab50e580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff8880ab50e600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880ab50e680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (17):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-19 2022/05/17 02:56 linux-4.19.y 3f8a27f9e27b 744a39e2 .config log report syz C KASAN: use-after-free Read in vlan_dev_get_iflink
ci2-linux-4-19 2020/08/08 10:01 linux-4.19.y 961f830af065 ff51e522 .config log report syz C
ci2-linux-4-19 2020/07/21 01:22 linux-4.19.y 17a87580a885 8caeeeb7 .config log report syz C
ci2-linux-4-19 2022/05/16 21:21 linux-4.19.y 3f8a27f9e27b 744a39e2 .config log report info KASAN: use-after-free Read in vlan_dev_get_iflink
ci2-linux-4-19 2022/02/19 13:52 linux-4.19.y 3f8a27f9e27b 3cd800e4 .config log report info KASAN: use-after-free Read in vlan_dev_get_iflink
ci2-linux-4-19 2021/08/16 05:00 linux-4.19.y 59456c9cc40c 2489ab88 .config log report info KASAN: use-after-free Read in vlan_dev_get_iflink
ci2-linux-4-19 2021/07/14 14:22 linux-4.19.y fcfbdfe9626e 94e0b707 .config log report info KASAN: use-after-free Read in vlan_dev_get_iflink
ci2-linux-4-19 2021/04/23 10:57 linux-4.19.y 2965db2e004c 590921a5 .config log report info KASAN: use-after-free Read in vlan_dev_get_iflink
ci2-linux-4-19 2021/03/05 08:53 linux-4.19.y dfb571610ba3 9d751681 .config log report info KASAN: use-after-free Read in vlan_dev_get_iflink
ci2-linux-4-19 2021/01/16 07:37 linux-4.19.y 675cc038067f 65a7a854 .config log report info
ci2-linux-4-19 2020/10/31 19:01 linux-4.19.y f5d8eef067ac 8bc4594f .config log report info
ci2-linux-4-19 2020/09/25 15:18 linux-4.19.y d09b80172c22 4a006f63 .config log report info
ci2-linux-4-19 2020/08/25 20:22 linux-4.19.y d18b78abc0c6 344da168 .config log report
ci2-linux-4-19 2020/08/24 15:48 linux-4.19.y d18b78abc0c6 67b599d1 .config log report
ci2-linux-4-19 2020/08/20 01:29 linux-4.19.y a834132bd465 ed282a3a .config log report
ci2-linux-4-19 2020/07/21 00:06 linux-4.19.y 17a87580a885 8caeeeb7 .config log report
ci2-linux-4-19 2020/04/13 08:01 linux-4.19.y dda0e2920330 17a986e5 .config log report