syzbot


KASAN: use-after-free Read in l2tp_session_get

Status: public: reported C repro on 2019/04/14 08:51
Reported-by: syzbot+fe9a495f2b3923dca26e@syzkaller.appspotmail.com
First crash: 2471d, last: 2471d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in l2tp_session_get+0x75b/0x770 net/l2tp/l2tp_core.c:315
Read of size 4 at addr ffff8801d8acf690 by task syzkaller568375/5536

CPU: 1 PID: 5536 Comm: syzkaller568375 Not tainted 4.9.81-gd2c57b6 #34
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
 ffff8801d9827a88 ffffffff81d94de9 ffffea000762b380 ffff8801d8acf690
 0000000000000000 ffff8801d8acf690 ffff8801c4b36f20 ffff8801d9827ac0
 ffffffff8153e173 ffff8801d8acf690 0000000000000004 0000000000000000
Call Trace:
 [<ffffffff81d94de9>] __dump_stack lib/dump_stack.c:15 [inline]
 [<ffffffff81d94de9>] dump_stack+0xc1/0x128 lib/dump_stack.c:51
 [<ffffffff8153e173>] print_address_description+0x73/0x280 mm/kasan/report.c:252
 [<ffffffff8153e695>] kasan_report_error mm/kasan/report.c:351 [inline]
 [<ffffffff8153e695>] kasan_report+0x275/0x360 mm/kasan/report.c:408
 [<ffffffff8153e7d4>] __asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:428
 [<ffffffff835893ab>] l2tp_session_get+0x75b/0x770 net/l2tp/l2tp_core.c:315
 [<ffffffff8358c2d0>] pppol2tp_connect+0x510/0x18f0 net/l2tp/l2tp_ppp.c:688
 [<ffffffff82ed86e6>] SYSC_connect+0x1b6/0x310 net/socket.c:1562
 [<ffffffff82edaf64>] SyS_connect+0x24/0x30 net/socket.c:1543
 [<ffffffff81006505>] do_syscall_64+0x1a5/0x490 arch/x86/entry/common.c:282
 [<ffffffff838b3dbd>] entry_SYSCALL_64_after_swapgs+0x47/0xc5

Allocated by task 5549:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:505
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:609
 __kmalloc+0x11d/0x310 mm/slub.c:3741
 kmalloc include/linux/slab.h:495 [inline]
 kzalloc include/linux/slab.h:636 [inline]
 l2tp_session_create+0x38/0x1770 net/l2tp/l2tp_core.c:1839
 pppol2tp_connect+0x10fe/0x18f0 net/l2tp/l2tp_ppp.c:711
 SYSC_connect+0x1b6/0x310 net/socket.c:1562
 SyS_connect+0x24/0x30 net/socket.c:1543
 do_syscall_64+0x1a5/0x490 arch/x86/entry/common.c:282
 entry_SYSCALL_64_after_swapgs+0x47/0xc5

Freed by task 5534:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:57
 save_stack+0x43/0xd0 mm/kasan/kasan.c:505
 set_track mm/kasan/kasan.c:517 [inline]
 kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:582
 slab_free_hook mm/slub.c:1355 [inline]
 slab_free_freelist_hook mm/slub.c:1377 [inline]
 slab_free mm/slub.c:2958 [inline]
 kfree+0x103/0x300 mm/slub.c:3878
 l2tp_session_free+0x166/0x200 net/l2tp/l2tp_core.c:1766
 l2tp_session_dec_refcount_1 net/l2tp/l2tp_core.h:297 [inline]
 pppol2tp_connect+0x108a/0x18f0 net/l2tp/l2tp_ppp.c:783
 SYSC_connect+0x1b6/0x310 net/socket.c:1562
 SyS_connect+0x24/0x30 net/socket.c:1543
 do_syscall_64+0x1a5/0x490 arch/x86/entry/common.c:282
 entry_SYSCALL_64_after_swapgs+0x47/0xc5

The buggy address belongs to the object at ffff8801d8acf680
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 16 bytes inside of
 512-byte region [ffff8801d8acf680, ffff8801d8acf880)
The buggy address belongs to the page:
page:ffffea000762b380 count:1 mapcount:0 mapping:          (null) index:0x0 compound_mapcount: 0
flags: 0x8000000000004080(slab|head)
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801d8acf580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801d8acf600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8801d8acf680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff8801d8acf700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801d8acf780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/02/15 11:20 https://android.googlesource.com/kernel/common android-4.9 d2c57b60569e 77ed06bf .config console log report syz C ci-android-49-kasan-gce
* Struck through repros no longer work on HEAD.