syzbot


KASAN: use-after-free Read in pppol2tp_session_init (2)

Status: upstream: reported C repro on 2021/01/14 16:13
Reported-by: syzbot+40ca26d3a4cd349a2e1f@syzkaller.appspotmail.com
First crash: 1408d, last: 659d
Fix bisection the fix commit could be any of (bisect log):
  cfb41ef9deb1 Linux 4.14.237
  65640c873dcf Linux 4.14.292
  
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 KASAN: use-after-free Read in pppol2tp_session_init 1 1554d 1554d 0/1 auto-closed as invalid on 2020/12/20 11:25
linux-4.14 general protection fault in pppol2tp_session_init C error 553 628d 1639d 0/1 upstream: reported C repro on 2020/05/29 02:01
Fix bisection attempts (12)
Created Duration User Patch Repo Result
2022/09/09 12:40 17m bisect fix linux-4.14.y OK (2) job log
2022/08/10 12:00 30m bisect fix linux-4.14.y OK (0) job log log
2022/06/17 23:06 28m bisect fix linux-4.14.y OK (0) job log log
2022/05/18 20:57 21m bisect fix linux-4.14.y OK (0) job log log
2022/04/18 20:24 25m bisect fix linux-4.14.y OK (0) job log log
2022/03/19 19:26 20m bisect fix linux-4.14.y OK (0) job log log
2022/02/13 13:34 29m bisect fix linux-4.14.y OK (0) job log log
2021/11/27 20:14 22m bisect fix linux-4.14.y OK (0) job log log
2021/10/28 19:48 26m bisect fix linux-4.14.y OK (0) job log log
2021/09/25 12:11 26m bisect fix linux-4.14.y OK (0) job log log
2021/08/26 11:47 24m bisect fix linux-4.14.y OK (0) job log log
2021/07/27 11:13 27m bisect fix linux-4.14.y OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:185 [inline]
BUG: KASAN: use-after-free in sk_dst_get include/net/sock.h:1772 [inline]
BUG: KASAN: use-after-free in pppol2tp_session_init+0x4b4/0x4d0 net/l2tp/l2tp_ppp.c:607
Read of size 8 at addr ffff888093557a28 by task syz-executor191/9100

CPU: 1 PID: 9100 Comm: syz-executor191 Not tainted 4.14.299-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1b2/0x281 lib/dump_stack.c:58
 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
 kasan_report mm/kasan/report.c:409 [inline]
 __asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430
 __read_once_size include/linux/compiler.h:185 [inline]
 sk_dst_get include/net/sock.h:1772 [inline]
 pppol2tp_session_init+0x4b4/0x4d0 net/l2tp/l2tp_ppp.c:607
 pppol2tp_connect+0xd5c/0x13d0 net/l2tp/l2tp_ppp.c:781
 SYSC_connect net/socket.c:1655 [inline]
 SyS_connect+0x1f4/0x240 net/socket.c:1636
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Allocated by task 9074:
 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
 kmem_cache_alloc+0x124/0x3c0 mm/slab.c:3552
 sk_prot_alloc+0x5f/0x290 net/core/sock.c:1478
 sk_alloc+0x36/0xcd0 net/core/sock.c:1538
 inet6_create net/ipv6/af_inet6.c:183 [inline]
 inet6_create+0x2df/0xe20 net/ipv6/af_inet6.c:110
 __sock_create+0x303/0x620 net/socket.c:1275
 sock_create net/socket.c:1315 [inline]
 SYSC_socket net/socket.c:1345 [inline]
 SyS_socket+0xd1/0x1b0 net/socket.c:1325
 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x5e/0xd3

Freed by task 9100:
 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]
 kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758
 sk_prot_free net/core/sock.c:1519 [inline]
 __sk_destruct+0x442/0x760 net/core/sock.c:1600
 sk_destruct net/core/sock.c:1615 [inline]
 __sk_free+0xd9/0x2d0 net/core/sock.c:1623
 sk_free+0x2b/0x40 net/core/sock.c:1634
 sock_put include/net/sock.h:1664 [inline]
 l2tp_session_free+0x1a0/0x200 net/l2tp/l2tp_core.c:1720
 l2tp_session_dec_refcount_1 net/l2tp/l2tp_core.h:303 [inline]
 pppol2tp_session_destruct+0xcd/0x110 net/l2tp/l2tp_ppp.c:475
 __sk_destruct+0x49/0x760 net/core/sock.c:1574
 sk_destruct net/core/sock.c:1615 [inline]
 __sk_free+0xd9/0x2d0 net/core/sock.c:1623
 sk_free+0x2b/0x40 net/core/sock.c:1634
 sock_put include/net/sock.h:1664 [inline]
 pppol2tp_put_sk+0x4c/0x60 net/l2tp/l2tp_ppp.c:443
 __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+0x780/0x1180 kernel/rcu/tree.c:2946
 __do_softirq+0x24d/0x9ff kernel/softirq.c:288

The buggy address belongs to the object at ffff888093557800
 which belongs to the cache UDPv6 of size 1728
The buggy address is located 552 bytes inside of
 1728-byte region [ffff888093557800, ffff888093557ec0)
The buggy address belongs to the page:
page:ffffea00024d55c0 count:1 mapcount:0 mapping:ffff8880935570c0 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880935570c0 0000000000000000 0000000100000002
raw: ffffea00024d5360 ffffea000253fca0 ffff888235412a80 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888093557900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888093557980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888093557a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
 ffff888093557a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888093557b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (13):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/11/19 11:31 linux-4.14.y e911713e40ca 5bb70014 .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-linux-4-14 KASAN: use-after-free Read in pppol2tp_session_init
2021/06/27 11:12 linux-4.14.y cfb41ef9deb1 9d2ab5df .config console log report syz C ci2-linux-4-14 KASAN: use-after-free Read in pppol2tp_session_init
2023/02/03 12:51 linux-4.14.y 3949d1610004 1b2f701a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-4-14 KASAN: use-after-free Read in pppol2tp_session_init
2022/07/11 11:51 linux-4.14.y 1048779a1d7d f3f217ff .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in pppol2tp_session_init
2022/02/17 19:18 linux-4.14.y a35d65bedfbc 3cd800e4 .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in pppol2tp_session_init
2022/02/16 21:58 linux-4.14.y a35d65bedfbc 50221962 .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in pppol2tp_session_init
2022/01/14 13:34 linux-4.14.y 4ba8e26127c3 b8d780ab .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in pppol2tp_session_init
2022/01/04 21:08 linux-4.14.y a6ca7c65b137 0a2584dd .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in pppol2tp_session_init
2021/12/07 06:51 linux-4.14.y 66722c42ec91 0230ba3e .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in pppol2tp_session_init
2021/05/03 14:48 linux-4.14.y 7d7d1c0ab3eb ad61f371 .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in pppol2tp_session_init
2021/04/13 12:21 linux-4.14.y 958e517f4e16 6a81331a .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in pppol2tp_session_init
2021/02/22 23:42 linux-4.14.y 29c52025152b c26fb06b .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in pppol2tp_session_init
2021/01/14 16:13 linux-4.14.y f79dc86058bc 468dbb55 .config console log report info ci2-linux-4-14
* Struck through repros no longer work on HEAD.