syzbot


KASAN: use-after-free Write in l2tp_session_delete (3)

Status: upstream: reported on 2025/07/25 00:17
Reported-by: syzbot+9588efd8924e6769d0b4@syzkaller.appspotmail.com
First crash: 41d, last: 41d
Similar bugs (9)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Write in l2tp_session_delete 24 2 317d 341d 0/2 auto-obsoleted due to no activity on 2025/01/19 22:14
android-5-10 KASAN: use-after-free Write in l2tp_session_delete (2) 24 3 117d 217d 0/2 auto-obsoleted due to no activity on 2025/08/08 12:20
linux-6.1 KASAN: use-after-free Write in l2tp_session_delete 24 2 349d 371d 0/3 auto-obsoleted due to no activity on 2024/12/29 03:40
android-5-15 KASAN: use-after-free Write in l2tp_session_delete 24 2 434d 447d 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) origin:downstream 24 C 14 32d 175d 0/2 upstream: reported C repro on 2025/03/13 02:24
linux-5.15 KASAN: use-after-free Write in l2tp_session_delete 24 2 766d 854d 0/3 auto-obsoleted due to no activity on 2023/11/08 00:22
linux-5.15 KASAN: use-after-free Write in l2tp_session_delete (2) 24 2 262d 349d 0/3 auto-obsoleted due to no activity on 2025/03/26 11:58
android-6-1 KASAN: use-after-free Write in l2tp_session_delete origin:downstream 24 syz 18 4d05h 331d 0/2 premoderation: reported syz repro on 2024/10/08 10:15
upstream KASAN: slab-use-after-free Write in l2tp_session_delete net 24 C done 1286 416d 435d 27/29 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+0x20/0x510 net/l2tp/l2tp_core.c:1563
Write of size 8 at addr ffff888074f56808 by task kworker/u4:12/11507

CPU: 0 PID: 11507 Comm: kworker/u4:12 Not tainted 5.15.189-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Workqueue: l2tp l2tp_tunnel_del_work
Call Trace:
 <TASK>
 dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
 print_address_description+0x60/0x2d0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0xdf/0x130 mm/kasan/report.c:451
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x27b/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+0x20/0x510 net/l2tp/l2tp_core.c:1563
 l2tp_tunnel_closeall net/l2tp/l2tp_core.c:1218 [inline]
 l2tp_tunnel_del_work+0x1d4/0x390 net/l2tp/l2tp_core.c:1258
 process_one_work+0x863/0x1000 kernel/workqueue.c:2310
 worker_thread+0xaa8/0x12a0 kernel/workqueue.c:2457
 kthread+0x436/0x520 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

Allocated by task 13655:
 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 mm/kasan/common.c:513 [inline]
 __kasan_kmalloc+0xb5/0xf0 mm/kasan/common.c:522
 kmalloc include/linux/slab.h:609 [inline]
 kzalloc include/linux/slab.h:735 [inline]
 l2tp_session_create+0x37/0xb00 net/l2tp/l2tp_core.c:1599
 pppol2tp_connect+0xb46/0x1590 net/l2tp/l2tp_ppp.c:782
 __sys_connect_file net/socket.c:1923 [inline]
 __sys_connect+0x389/0x410 net/socket.c:1940
 __do_sys_connect net/socket.c:1950 [inline]
 __se_sys_connect net/socket.c:1947 [inline]
 __x64_sys_connect+0x76/0x80 net/socket.c:1947
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 4181:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd5/0x110 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+0xea/0x170 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kfree+0xef/0x2a0 mm/slub.c:4559
 __sk_destruct+0x50/0x820 net/core/sock.c:1956
 rcu_do_batch kernel/rcu/tree.c:2523 [inline]
 rcu_core+0x962/0x15d0 kernel/rcu/tree.c:2763
 handle_softirqs+0x328/0x820 kernel/softirq.c:576
 __do_softirq kernel/softirq.c:610 [inline]
 invoke_softirq kernel/softirq.c:450 [inline]
 __irq_exit_rcu+0x12f/0x220 kernel/softirq.c:659
 irq_exit_rcu+0x5/0x20 kernel/softirq.c:671
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline]
 sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1108
 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:676

Last potentially related work creation:
 kasan_save_stack+0x35/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xb8/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3011 [inline]
 call_rcu+0x182/0x930 kernel/rcu/tree.c:3091
 pppol2tp_release+0x23c/0x330 net/l2tp/l2tp_ppp.c:458
 __sock_release net/socket.c:649 [inline]
 sock_close+0xd5/0x240 net/socket.c:1336
 __fput+0x234/0x930 fs/file_table.c:311
 task_work_run+0x125/0x1a0 kernel/task_work.c:188
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0x10f/0x130 kernel/entry/common.c:181
 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214
 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
 syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:307
 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff888074f56800
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 8 bytes inside of
 1024-byte region [ffff888074f56800, ffff888074f56c00)
The buggy address belongs to the page:
page:ffffea0001d3d400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x74f50
head:ffffea0001d3d400 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001728c00 0000000500000005 ffff888016841dc0
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 0x1d2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 14, ts 260993964262, free_ts 260788939918
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x1b77/0x1c60 mm/page_alloc.c:4192
 __alloc_pages+0x1e1/0x470 mm/page_alloc.c:5474
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xc0/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x81e/0xdf0 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 __kmalloc_node_track_caller+0x1fc/0x3a0 mm/slub.c:4958
 kmalloc_reserve net/core/skbuff.c:356 [inline]
 __alloc_skb+0x22c/0x750 net/core/skbuff.c:427
 alloc_skb include/linux/skbuff.h:1162 [inline]
 synproxy_send_client_synack_ipv6+0x15b/0xc50 net/netfilter/nf_synproxy_core.c:895
 nft_synproxy_eval_v6+0x36b/0x560 net/netfilter/nft_synproxy.c:90
 nft_synproxy_do_eval+0x3d3/0x570 net/netfilter/nft_synproxy.c:145
 expr_call_ops_eval net/netfilter/nf_tables_core.c:198 [inline]
 nft_do_chain+0x3fc/0x1420 net/netfilter/nf_tables_core.c:238
 nft_do_chain_inet+0x22b/0x300 net/netfilter/nft_chain_filter.c:161
 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline]
 nf_hook_slow+0xb9/0x200 net/netfilter/core.c:584
 nf_hook include/linux/netfilter.h:257 [inline]
 NF_HOOK+0x1cb/0x360 include/linux/netfilter.h:300
 NF_HOOK+0x2d6/0x360 include/linux/netfilter.h:302
 __netif_receive_skb_one_core net/core/dev.c:5525 [inline]
 __netif_receive_skb+0xcc/0x290 net/core/dev.c:5639
 process_backlog+0x364/0x780 net/core/dev.c:6516
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+0x637/0x6c0 mm/page_alloc.c:3317
 free_unref_page+0x94/0x280 mm/page_alloc.c:3396
 free_slab mm/slub.c:2015 [inline]
 discard_slab mm/slub.c:2021 [inline]
 __unfreeze_partials+0x1a5/0x200 mm/slub.c:2507
 put_cpu_partial+0x12d/0x190 mm/slub.c:2587
 qlist_free_all+0x35/0x90 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x150/0x160 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xd0 mm/kasan/common.c:444
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x4c/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 slab_alloc mm/slub.c:3228 [inline]
 __kmalloc+0x127/0x330 mm/slub.c:4403
 kmalloc include/linux/slab.h:609 [inline]
 inotify_handle_inode_event+0x17c/0x4e0 fs/notify/inotify/inotify_fsnotify.c:96
 inotify_ignored_and_remove_idr+0x25/0x70 fs/notify/inotify/inotify_user.c:519
 __do_sys_inotify_rm_watch fs/notify/inotify/inotify_user.c:809 [inline]
 __se_sys_inotify_rm_watch+0x14d/0x200 fs/notify/inotify/inotify_user.c:786
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Memory state around the buggy address:
 ffff888074f56700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888074f56780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888074f56800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff888074f56880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888074f56900: 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
2025/07/25 00:16 linux-5.15.y c79648372d02 fb8f743d .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.