syzbot


KASAN: use-after-free Read in l2tp_nl_tunnel_send

Status: auto-closed as invalid on 2020/08/06 15:22
Reported-by: syzbot+4264b9036c985be0654c@syzkaller.appspotmail.com
First crash: 1716d, last: 1689d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in l2tp_nl_tunnel_send+0xcb7/0xcf0 net/l2tp/l2tp_netlink.c:406
Read of size 2 at addr ffff8880865467e0 by task syz-executor.4/20312

CPU: 1 PID: 20312 Comm: syz-executor.4 Not tainted 4.14.175-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
 l2tp_nl_tunnel_send+0xcb7/0xcf0 net/l2tp/l2tp_netlink.c:406
 l2tp_tunnel_notify.constprop.0+0xab/0x140 net/l2tp/l2tp_netlink.c:121
 l2tp_nl_cmd_tunnel_delete+0xd5/0x160 net/l2tp/l2tp_netlink.c:282
 genl_family_rcv_msg+0x57c/0xb30 net/netlink/genetlink.c:600
 genl_rcv_msg+0xaf/0x140 net/netlink/genetlink.c:625
 netlink_rcv_skb+0x127/0x370 net/netlink/af_netlink.c:2433
 genl_rcv+0x24/0x40 net/netlink/genetlink.c:636
 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:0x45c889
RSP: 002b:00007fa115d5ac78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007fa115d5b6d4 RCX: 000000000045c889
RDX: 0000000000000000 RSI: 0000000020000100 RDI: 0000000000000004
RBP: 000000000076c040 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 0000000000000942 R14: 00000000004d58c0 R15: 000000000076c04c

Allocated by task 20306:
 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
 kmem_cache_alloc+0x127/0x770 mm/slab.c:3552
 sk_prot_alloc+0x5f/0x290 net/core/sock.c:1461
 sk_alloc+0x36/0xd60 net/core/sock.c:1521
 inet_create net/ipv4/af_inet.c:318 [inline]
 inet_create+0x2f5/0xca0 net/ipv4/af_inet.c:244
 __sock_create+0x2f2/0x620 net/socket.c:1275
 udp_sock_create4+0x81/0x390 net/ipv4/udp_tunnel.c:19
 udp_sock_create include/net/udp_tunnel.h:58 [inline]
 l2tp_tunnel_sock_create+0x921/0xac0 net/l2tp/l2tp_core.c:1461
 l2tp_tunnel_create+0x2d9/0xd10 net/l2tp/l2tp_core.c:1554
 pppol2tp_connect+0x1106/0x17b0 net/l2tp/l2tp_ppp.c:677
 SYSC_connect+0x1c6/0x250 net/socket.c:1655
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 0:
 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]
 kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758
 sk_prot_free net/core/sock.c:1502 [inline]
 __sk_destruct+0x3b1/0x640 net/core/sock.c:1581
 __rcu_reclaim kernel/rcu/rcu.h:195 [inline]
 rcu_do_batch kernel/rcu/tree.c:2699 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2962 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2929 [inline]
 rcu_process_callbacks+0x792/0x1190 kernel/rcu/tree.c:2946
 __do_softirq+0x254/0x9bf kernel/softirq.c:288

The buggy address belongs to the object at ffff888086546380
 which belongs to the cache UDP of size 1536
The buggy address is located 1120 bytes inside of
 1536-byte region [ffff888086546380, ffff888086546980)
The buggy address belongs to the page:
page:ffffea0002195180 count:1 mapcount:0 mapping:ffff888086546380 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffff888086546380 0000000000000000 0000000100000004
raw: ffffea0002a36c20 ffffea0000df2ba0 ffff88821a907d80 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888086546680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888086546700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888086546780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff888086546800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888086546880: 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
2020/04/08 15:22 linux-4.14.y 4520f06b03ae db9bcd4b .config console log report ci2-linux-4-14
2020/03/12 22:54 linux-4.14.y 12cd844a39ed d850e9d0 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.