KASAN: use-after-free Read in vlan_dev_get_iflink

11 views
Skip to first unread message

syzbot

unread,
Apr 25, 2020, 5:56:15 PM4/25/20
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 050272a0 Linux 4.14.177
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10a8dfcfe00000
kernel config: https://syzkaller.appspot.com/x/.config?x=b24dc669afb42f8b
dashboard link: https://syzkaller.appspot.com/bug?extid=4e67765f93c038b2789a
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+4e6776...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in vlan_dev_get_iflink+0x5f/0x70 net/8021q/vlan_dev.c:769
Read of size 4 at addr ffff888098158488 by task syz-executor.0/32516

CPU: 1 PID: 32516 Comm: syz-executor.0 Not tainted 4.14.177-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x13e/0x194 lib/dump_stack.c:58
print_address_description.cold+0x7c/0x1e2 mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xa9/0x2ae mm/kasan/report.c:393
vlan_dev_get_iflink+0x5f/0x70 net/8021q/vlan_dev.c:769
dev_get_iflink+0x73/0xe0 net/core/dev.c:690
rfc2863_policy+0x17e/0x1e0 net/core/link_watch.c:43
linkwatch_do_dev+0x16/0xe0 net/core/link_watch.c:157
linkwatch_forget_dev+0x15c/0x1f0 net/core/link_watch.c:223
netdev_wait_allrefs net/core/dev.c:7832 [inline]
netdev_run_todo+0x234/0x710 net/core/dev.c:7933
rtnl_unlock net/core/rtnetlink.c:106 [inline]
rtnetlink_rcv_msg+0x3cb/0xb10 net/core/rtnetlink.c:4317
netlink_rcv_skb+0x127/0x370 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x620 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x733/0xbe0 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xc5/0x100 net/socket.c:656
___sys_sendmsg+0x70a/0x840 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x45c829
RSP: 002b:00007fed49a17c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000500a40 RCX: 000000000045c829
RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000006
RBP: 000000000078bfa0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000009fe R14: 00000000004ccb57 R15: 00007fed49a186d4

Allocated by task 32499:
save_stack+0x32/0xa0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:529
__do_kmalloc_node mm/slab.c:3682 [inline]
__kmalloc_node+0x4c/0x70 mm/slab.c:3689
kmalloc_node include/linux/slab.h:530 [inline]
kvmalloc_node+0x46/0xd0 mm/util.c:397
kvmalloc include/linux/mm.h:531 [inline]
kvzalloc include/linux/mm.h:539 [inline]
alloc_netdev_mqs+0x76/0xb70 net/core/dev.c:8098
rtnl_create_link+0x1ab/0x880 net/core/rtnetlink.c:2460
rtnl_newlink+0xdd0/0x1720 net/core/rtnetlink.c:2718
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4315
netlink_rcv_skb+0x127/0x370 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x620 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x733/0xbe0 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xc5/0x100 net/socket.c:656
___sys_sendmsg+0x70a/0x840 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 32499:
save_stack+0x32/0xa0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcb/0x260 mm/slab.c:3815
kvfree+0x45/0x50 mm/util.c:416
device_release+0x15f/0x1a0 drivers/base/core.c:833
kobject_cleanup lib/kobject.c:646 [inline]
kobject_release lib/kobject.c:675 [inline]
kref_put include/linux/kref.h:70 [inline]
kobject_put+0x13e/0x1f0 lib/kobject.c:692
netdev_run_todo+0x4a9/0x710 net/core/dev.c:7955
rtnl_unlock net/core/rtnetlink.c:106 [inline]
rtnetlink_rcv_msg+0x3cb/0xb10 net/core/rtnetlink.c:4317
netlink_rcv_skb+0x127/0x370 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x620 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x733/0xbe0 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xc5/0x100 net/socket.c:656
___sys_sendmsg+0x70a/0x840 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff888098158380
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 264 bytes inside of
4096-byte region [ffff888098158380, ffff888098159380)
The buggy address belongs to the page:
page:ffffea0002605600 count:1 mapcount:0 mapping:ffff888098158380 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff888098158380 0000000000000000 0000000100000001
raw: ffffea00016f1ba0 ffffea00026056a0 ffff88812fe54dc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff888098158380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888098158400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888098158480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888098158500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888098158580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Aug 6, 2020, 3:02:17 AM8/6/20
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: ca4f2c56 Linux 4.14.192
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10e029fa900000
kernel config: https://syzkaller.appspot.com/x/.config?x=60834b36c72d3e64
dashboard link: https://syzkaller.appspot.com/bug?extid=4e67765f93c038b2789a
compiler: gcc (GCC) 10.1.0-syz 20200507
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=131289dc900000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=126514c2900000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4e6776...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in vlan_dev_get_iflink+0x5f/0x70 net/8021q/vlan_dev.c:769
Read of size 4 at addr ffff8880905e0488 by task syz-executor582/6951

CPU: 0 PID: 6951 Comm: syz-executor582 Not tainted 4.14.192-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x283 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x194 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load4_noabort+0x68/0x70 mm/kasan/report.c:429
vlan_dev_get_iflink+0x5f/0x70 net/8021q/vlan_dev.c:769
dev_get_iflink+0x73/0xe0 net/core/dev.c:691
rfc2863_policy+0x163/0x1b0 net/core/link_watch.c:43
linkwatch_do_dev+0x1b/0xf0 net/core/link_watch.c:157
linkwatch_forget_dev+0x15c/0x1f0 net/core/link_watch.c:223
netdev_wait_allrefs net/core/dev.c:7837 [inline]
netdev_run_todo+0x284/0xad0 net/core/dev.c:7938
rtnl_unlock net/core/rtnetlink.c:106 [inline]
rtnetlink_rcv_msg+0x3cb/0xb10 net/core/rtnetlink.c:4318
netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x62e/0xb80 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x446d79
RSP: 002b:00007efc89777d98 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 6917:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
__do_kmalloc_node mm/slab.c:3682 [inline]
__kmalloc_node+0x4c/0x70 mm/slab.c:3689
kmalloc_node include/linux/slab.h:530 [inline]
kvmalloc_node+0x46/0xd0 mm/util.c:397
kvmalloc include/linux/mm.h:531 [inline]
kvzalloc include/linux/mm.h:539 [inline]
alloc_netdev_mqs+0x76/0xb70 net/core/dev.c:8103
rtnl_create_link+0x1ab/0x890 net/core/rtnetlink.c:2460
rtnl_newlink+0xe86/0x1830 net/core/rtnetlink.c:2718
rtnetlink_rcv_msg+0x3be/0xb10 net/core/rtnetlink.c:4316
netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x62e/0xb80 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 6917:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xc9/0x250 mm/slab.c:3815
kvfree+0x45/0x50 mm/util.c:416
device_release+0x15f/0x1a0 drivers/base/core.c:833
kobject_cleanup lib/kobject.c:646 [inline]
kobject_release lib/kobject.c:675 [inline]
kref_put include/linux/kref.h:70 [inline]
kobject_put+0x1f3/0x2d0 lib/kobject.c:692
netdev_run_todo+0x747/0xad0 net/core/dev.c:7960
rtnl_unlock net/core/rtnetlink.c:106 [inline]
rtnetlink_rcv_msg+0x3cb/0xb10 net/core/rtnetlink.c:4318
netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2433
netlink_unicast_kernel net/netlink/af_netlink.c:1287 [inline]
netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1313
netlink_sendmsg+0x62e/0xb80 net/netlink/af_netlink.c:1878
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880905e0380
which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 264 bytes inside of
4096-byte region [ffff8880905e0380, ffff8880905e1380)
The buggy address belongs to the page:
page:ffffea0002417800 count:1 mapcount:0 mapping:ffff8880905e0380 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff8880905e0380 0000000000000000 0000000100000001
raw: ffffea000243ba20 ffffea000249a2a0 ffff88812fe52dc0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880905e0380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880905e0400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880905e0480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880905e0500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880905e0580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Reply all
Reply to author
Forward
0 new messages