syzbot


KASAN: use-after-free Write in l2tp_session_delete

Status: auto-obsoleted due to no activity on 2023/11/08 00:22
Reported-by: syzbot+3fe3379e09eae68b20f4@syzkaller.appspotmail.com
First crash: 589d, last: 500d
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Write in l2tp_session_delete 2 51d 75d 0/2 premoderation: reported on 2024/09/28 01:24
linux-6.1 KASAN: use-after-free Write in l2tp_session_delete 2 83d 105d 0/3 upstream: reported on 2024/08/29 01:02
android-5-15 KASAN: use-after-free Write in l2tp_session_delete 2 168d 182d 0/2 auto-obsoleted due to no activity on 2024/09/25 05:09
android-5-15 KASAN: use-after-free Write in l2tp_session_delete (2) 2 22d 28d 0/2 premoderation: reported on 2024/11/14 20:24
linux-5.15 KASAN: use-after-free Write in l2tp_session_delete (2) 1 83d 83d 0/3 upstream: reported on 2024/09/19 22:43
android-6-1 KASAN: use-after-free Write in l2tp_session_delete syz 5 20d 65d 0/2 premoderation: reported syz repro on 2024/10/08 10:15
upstream KASAN: slab-use-after-free Write in l2tp_session_delete net C done 1286 150d 170d 27/28 fixed on 2024/08/14 03:44

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: use-after-free in test_and_set_bit include/asm-generic/bitops/instrumented-atomic.h:70 [inline]
BUG: KASAN: use-after-free in l2tp_session_delete+0x21/0x540 net/l2tp/l2tp_core.c:1552
Write of size 8 at addr ffff88807e1ae808 by task kworker/u4:17/5174

CPU: 1 PID: 5174 Comm: kworker/u4:17 Not tainted 5.15.123-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023
Workqueue: l2tp l2tp_tunnel_del_work
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 kasan_check_range+0x27e/0x290 mm/kasan/generic.c:189
 instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
 test_and_set_bit include/asm-generic/bitops/instrumented-atomic.h:70 [inline]
 l2tp_session_delete+0x21/0x540 net/l2tp/l2tp_core.c:1552
 l2tp_tunnel_closeall net/l2tp/l2tp_core.c:1207 [inline]
 l2tp_tunnel_del_work+0x1a2/0x340 net/l2tp/l2tp_core.c:1247
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
 </TASK>

Allocated by task 10432:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc+0xba/0xf0 mm/kasan/common.c:513
 kasan_kmalloc include/linux/kasan.h:264 [inline]
 __kmalloc+0x168/0x300 mm/slub.c:4407
 kmalloc include/linux/slab.h:596 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 l2tp_session_create+0x37/0xb30 net/l2tp/l2tp_core.c:1588
 pppol2tp_connect+0xc3d/0x1720 net/l2tp/l2tp_ppp.c:782
 __sys_connect_file net/socket.c:1899 [inline]
 __sys_connect+0x38b/0x410 net/socket.c:1916
 __do_sys_connect net/socket.c:1926 [inline]
 __se_sys_connect net/socket.c:1923 [inline]
 __x64_sys_connect+0x76/0x80 net/socket.c:1923
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 8945:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0xf1/0x270 mm/slub.c:4559
 __sk_destruct+0x54/0x840 net/core/sock.c:1933
 rcu_do_batch kernel/rcu/tree.c:2510 [inline]
 rcu_core+0xa15/0x1650 kernel/rcu/tree.c:2750
 __do_softirq+0x3b3/0x93a kernel/softirq.c:558

Last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:2994 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3074
 pppol2tp_release+0x247/0x340 net/l2tp/l2tp_ppp.c:458
 __sock_release net/socket.c:649 [inline]
 sock_close+0xcd/0x230 net/socket.c:1317
 __fput+0x3bf/0x890 fs/file_table.c:280
 task_work_run+0x129/0x1a0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:175
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:208
 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
 syscall_exit_to_user_mode+0x5d/0x250 kernel/entry/common.c:301
 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff88807e1ae800
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 8 bytes inside of
 1024-byte region [ffff88807e1ae800, ffff88807e1aec00)
The buggy address belongs to the page:
page:ffffea0001f86a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7e1a8
head:ffffea0001f86a00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 0000000f00000001 ffff888011c41dc0
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 14, ts 105748275603, free_ts 105744305246
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 __kmalloc_node_track_caller+0x1f6/0x390 mm/slub.c:4958
 kmalloc_reserve net/core/skbuff.c:356 [inline]
 __alloc_skb+0x12c/0x590 net/core/skbuff.c:427
 alloc_skb include/linux/skbuff.h:1167 [inline]
 __tcp_send_ack+0x9c/0x630 net/ipv4/tcp_output.c:3963
 tcp_rcv_established+0x135b/0x1e20 net/ipv4/tcp_input.c:5937
 tcp_v4_do_rcv+0x423/0x960 net/ipv4/tcp_ipv4.c:1727
 tcp_v4_rcv+0x2740/0x2d80 net/ipv4/tcp_ipv4.c:2129
 ip_protocol_deliver_rcu+0x381/0x730 net/ipv4/ip_input.c:204
 ip_local_deliver_finish+0x1db/0x320 net/ipv4/ip_input.c:231
 NF_HOOK+0x364/0x410 include/linux/netfilter.h:302
 dst_input include/net/dst.h:453 [inline]
 ip_sublist_rcv_finish net/ipv4/ip_input.c:577 [inline]
 ip_list_rcv_finish net/ipv4/ip_input.c:627 [inline]
 ip_sublist_rcv+0xaa1/0xde0 net/ipv4/ip_input.c:635
 ip_list_rcv+0x422/0x470 net/ipv4/ip_input.c:670
 __netif_receive_skb_list_ptype net/core/dev.c:5505 [inline]
 __netif_receive_skb_list_core+0x6b1/0x890 net/core/dev.c:5553
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 skb_free_frag include/linux/skbuff.h:3024 [inline]
 skb_free_head net/core/skbuff.c:653 [inline]
 skb_release_data+0x749/0x8a0 net/core/skbuff.c:677
 skb_release_all net/core/skbuff.c:742 [inline]
 __kfree_skb+0x4c/0x60 net/core/skbuff.c:756
 sk_eat_skb include/net/sock.h:2697 [inline]
 tcp_recvmsg_locked+0x1629/0x29b0 net/ipv4/tcp.c:2512
 tcp_recvmsg+0x24e/0x7f0 net/ipv4/tcp.c:2558
 inet_recvmsg+0x157/0x280 net/ipv4/af_inet.c:856
 sock_recvmsg_nosec net/socket.c:947 [inline]
 sock_recvmsg net/socket.c:965 [inline]
 sock_read_iter+0x353/0x480 net/socket.c:1038
 call_read_iter include/linux/fs.h:2097 [inline]
 new_sync_read fs/read_write.c:404 [inline]
 vfs_read+0xa9f/0xe10 fs/read_write.c:485
 ksys_read+0x1a2/0x2c0 fs/read_write.c:623
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Memory state around the buggy address:
 ffff88807e1ae700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88807e1ae780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88807e1ae800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff88807e1ae880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807e1ae900: 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
2023/07/31 00:21 linux-5.15.y 09996673e313 2a0d0f29 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in l2tp_session_delete
2023/05/03 14:41 linux-5.15.y 8a7f2a5c5aa1 b5918830 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Write in l2tp_session_delete
* Struck through repros no longer work on HEAD.