syzbot


KASAN: use-after-free Read in pppol2tp_connect

Status: fixed on 2018/03/06 13:29
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+9df43faf09bd400f2993@syzkaller.appspotmail.com
Fix commit: 28f5bfb81919 l2tp: fix tunnel lookup use-after-free race
First crash: 2254d, last: 2204d
Discussions (7)
Title Replies (including bot) Last reply
[PATCH 3.16 000/410] 3.16.57-rc1 review 426 (426) 2018/11/12 17:42
[PATCH 4.15 000/122] 4.15.8-stable review 135 (135) 2018/03/08 17:51
[PATCH net 0/5] l2tp: fix API races discovered by syzbot 7 (7) 2018/02/26 17:21
[PATCH net-next v2 00/16] l2tp: fix API races discovered by syzbot 27 (27) 2018/02/15 08:23
[PATCH net-next v3 00/16] l2tp: fix API races discovered by syzbot 18 (18) 2018/02/12 19:00
[PATCH net-next 00/16] l2tp: fix API races discovered by syzbot 18 (18) 2018/02/12 03:37
KASAN: use-after-free Read in pppol2tp_connect 0 (1) 2018/01/16 03:58
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-49 KASAN: use-after-free Read in pppol2tp_connect 8 2046d 2251d 0/3 auto-closed as invalid on 2019/02/22 12:37
android-44 KASAN: use-after-free Read in pppol2tp_connect C 28 2028d 1802d 0/2 public: reported C repro on 2019/04/13 00:00
upstream KASAN: use-after-free Read in pppol2tp_connect (2) net C 10 2187d 2203d 4/26 fixed on 2018/03/23 18:14
linux-4.14 KASAN: use-after-free Read in pppol2tp_connect syz inconclusive 7 1388d 1636d 0/1 upstream: reported syz repro on 2019/09/25 11:59
upstream KASAN: use-after-free Read in pppol2tp_connect (3) net C 22 2167d 2185d 5/26 fixed on 2018/05/08 18:30

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:188 [inline]
BUG: KASAN: use-after-free in sk_dst_get include/net/sock.h:1766 [inline]
BUG: KASAN: use-after-free in pppol2tp_session_init net/l2tp/l2tp_ppp.c:596 [inline]
BUG: KASAN: use-after-free in pppol2tp_connect+0x1a91/0x1dd0 net/l2tp/l2tp_ppp.c:756
Read of size 8 at addr ffff8801b5473928 by task syzkaller944630/6891

CPU: 1 PID: 6891 Comm: syzkaller944630 Not tainted 4.16.0-rc3+ #331
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+0x194/0x24d lib/dump_stack.c:53
 print_address_description+0x73/0x250 mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report+0x23b/0x360 mm/kasan/report.c:412
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 __read_once_size include/linux/compiler.h:188 [inline]
 sk_dst_get include/net/sock.h:1766 [inline]
 pppol2tp_session_init net/l2tp/l2tp_ppp.c:596 [inline]
 pppol2tp_connect+0x1a91/0x1dd0 net/l2tp/l2tp_ppp.c:756
 SYSC_connect+0x213/0x4a0 net/socket.c:1639
 SyS_connect+0x24/0x30 net/socket.c:1620
 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x441429
RSP: 002b:00007ffe8679de38 EFLAGS: 00000217 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441429
RDX: 000000000000002e RSI: 00000000205fafd2 RDI: 0000000000000004
RBP: 000000000000a91b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000217 R12: 0000000000000000
R13: 00000000006cd448 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 6890:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:552
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489
 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3541
 sk_prot_alloc+0x65/0x2a0 net/core/sock.c:1465
 sk_alloc+0x105/0x1440 net/core/sock.c:1525
 inet6_create+0x44d/0x10f0 net/ipv6/af_inet6.c:183
 __sock_create+0x4d4/0x850 net/socket.c:1285
 sock_create net/socket.c:1325 [inline]
 SYSC_socket net/socket.c:1355 [inline]
 SyS_socket+0xeb/0x1d0 net/socket.c:1335
 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 6891:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:520
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:527
 __cache_free mm/slab.c:3485 [inline]
 kmem_cache_free+0x83/0x2a0 mm/slab.c:3743
 sk_prot_free net/core/sock.c:1506 [inline]
 __sk_destruct+0x628/0x920 net/core/sock.c:1590
 sk_destruct+0x47/0x80 net/core/sock.c:1598
 __sk_free+0xf1/0x2b0 net/core/sock.c:1609
 sk_free+0x2a/0x40 net/core/sock.c:1620
 sock_put include/net/sock.h:1658 [inline]
 l2tp_session_free+0x21c/0x2b0 net/l2tp/l2tp_core.c:1662
 l2tp_session_dec_refcount net/l2tp/l2tp_core.h:300 [inline]
 pppol2tp_session_destruct+0xd4/0x110 net/l2tp/l2tp_ppp.c:448
 __sk_destruct+0xfd/0x920 net/core/sock.c:1563
 sk_destruct+0x47/0x80 net/core/sock.c:1598
 __sk_free+0xf1/0x2b0 net/core/sock.c:1609
 sk_free+0x2a/0x40 net/core/sock.c:1620
 sock_put include/net/sock.h:1658 [inline]
 pppol2tp_put_sk+0x49/0x60 net/l2tp/l2tp_ppp.c:457
 __rcu_reclaim kernel/rcu/rcu.h:172 [inline]
 rcu_do_batch kernel/rcu/tree.c:2674 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2933 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2900 [inline]
 rcu_process_callbacks+0xd6c/0x17f0 kernel/rcu/tree.c:2917
 __do_softirq+0x2d7/0xb85 kernel/softirq.c:285

The buggy address belongs to the object at ffff8801b5473700
 which belongs to the cache UDPv6 of size 1664
The buggy address is located 552 bytes inside of
 1664-byte region [ffff8801b5473700, ffff8801b5473d80)
The buggy address belongs to the page:
page:ffffea0006d51cc0 count:1 mapcount:0 mapping:ffff8801b5473000 index:0x0
flags: 0x2fffc0000000100(slab)
raw: 02fffc0000000100 ffff8801b5473000 0000000000000000 0000000100000002
raw: ffffea0006d63860 ffff8801d1889448 ffff8801d1da50c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801b5473800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801b5473880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801b5473900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff8801b5473980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801b5473a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (25):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/02/27 16:24 upstream 6f70eb2b00eb 05b5a32c .config console log report syz C ci-upstream-kasan-gce
2018/02/12 08:56 upstream 7928b2cbe55b 4e9b726d .config console log report syz C ci-upstream-kasan-gce
2018/02/07 16:44 upstream a2e5790d8416 9fb5ec43 .config console log report syz C ci-upstream-kasan-gce
2018/02/01 18:33 upstream 7109a04eae81 67bd3383 .config console log report syz C ci-upstream-kasan-gce
2018/01/26 23:51 upstream c4e0ca7fa241 1d18b112 .config console log report syz C ci-upstream-kasan-gce
2018/01/19 12:17 upstream dda3e15231b3 161c1d64 .config console log report syz C ci-upstream-kasan-gce
2018/02/23 17:55 upstream 0f9da844d877 33464158 .config console log report syz C ci-upstream-kasan-gce-386
2018/02/17 14:32 upstream 1e3510b2b053 c8b3f7c1 .config console log report syz C ci-upstream-kasan-gce-386
2018/02/06 23:48 upstream e237f98a9c13 66c15deb .config console log report syz C ci-upstream-kasan-gce-386
2018/02/05 12:34 upstream 35277995e179 a1bc9d40 .config console log report syz C ci-upstream-kasan-gce-386
2018/02/04 22:19 upstream 617aebe6a97e a1bc9d40 .config console log report syz C ci-upstream-kasan-gce-386
2018/01/20 07:20 upstream ec835f8104a2 fbbdcd92 .config console log report syz C ci-upstream-kasan-gce-386
2018/01/22 13:18 net-next-old ebdd7b491b8a 228e3d95 .config console log report syz C ci-upstream-net-kasan-gce
2018/01/20 12:17 net-next-old 8565d26bcb2f fbbdcd92 .config console log report syz C ci-upstream-net-kasan-gce
2018/01/19 20:52 net-next-old 43dd7512b51c fbbdcd92 .config console log report syz C ci-upstream-net-kasan-gce
2018/02/20 12:05 net-next-old f5c0c6f4299f 5abac192 .config console log report syz C ci-upstream-net-kasan-gce
2018/01/28 14:29 net-next-old 6bb46bc57c8e 08d47756 .config console log report syz C ci-upstream-net-kasan-gce
2018/01/20 03:36 mmots 216435561218 fbbdcd92 .config console log report syz C ci-upstream-mmots-kasan-gce
2018/01/18 21:47 mmots ce3c209f6733 161c1d64 .config console log report syz C ci-upstream-mmots-kasan-gce
2018/01/17 15:29 linux-next 1fec57a31e56 a46e5318 .config console log report syz C ci-upstream-next-kasan-gce
2018/01/16 21:03 mmots ce3c209f6733 a46e5318 .config console log report syz C ci-upstream-mmots-kasan-gce
2018/01/15 22:16 linux-next b625c1ff8227 e17f4a5d .config console log report syz C ci-upstream-next-kasan-gce
2018/01/17 01:39 upstream 41aa5e5d712b a46e5318 .config console log report syz ci-upstream-kasan-gce-386
2018/03/06 11:13 upstream 094b58e1040a aef0b792 .config console log report ci-upstream-kasan-gce
2018/02/02 00:30 upstream 7109a04eae81 67bd3383 .config console log report ci-upstream-kasan-gce
* Struck through repros no longer work on HEAD.