syzbot


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

Status: upstream: reported C repro on 2025/03/13 02:24
Bug presence: origin:downstream
[Documentation on labels]
Reported-by: syzbot+24be2e83007366ad36f9@syzkaller.appspotmail.com
First crash: 140d, last: 2d00h
Bug presence (3)
Date Name Commit Repro Result
2025/03/14 android13-5.15-lts (ToT) 7d1f9b5c2ff5 C [report] KASAN: use-after-free Write in l2tp_session_delete
2025/03/14 lts (merge base) c16c81c81336 C Didn't crash
2025/03/14 upstream (ToT) e3a854b577cb C Didn't crash
Similar bugs (8)
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 164d 188d 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) 2 33d 64d 0/2 premoderation: reported on 2025/01/30 03:12
linux-6.1 KASAN: use-after-free Write in l2tp_session_delete 2 196d 218d 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 2 281d 295d 0/2 auto-obsoleted due to no activity on 2024/09/25 05:09
linux-5.15 KASAN: use-after-free Write in l2tp_session_delete 2 613d 702d 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) 2 109d 196d 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 syz 8 34d 178d 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 263d 283d 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+0x24/0x4e0 net/l2tp/l2tp_core.c:1563
Write of size 8 at addr ffff8881166a7408 by task kworker/u4:3/353

CPU: 1 PID: 353 Comm: kworker/u4:3 Not tainted 5.15.178-syzkaller-00013-g7d1f9b5c2ff5 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: l2tp l2tp_tunnel_del_work
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1c0 lib/dump_stack.c:106
 print_address_description+0x87/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:444
 kasan_check_range+0x293/0x2a0 mm/kasan/generic.c:189
 __kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37
 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+0x24/0x4e0 net/l2tp/l2tp_core.c:1563
 l2tp_tunnel_closeall net/l2tp/l2tp_core.c:1218 [inline]
 l2tp_tunnel_del_work+0x19d/0x380 net/l2tp/l2tp_core.c:1258
 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325
 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472
 kthread+0x421/0x510 kernel/kthread.c:337
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

Allocated by task 649:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:433 [inline]
 ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:512
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:521
 kasan_kmalloc include/linux/kasan.h:227 [inline]
 __kmalloc+0x13f/0x2c0 mm/slub.c:4431
 kmalloc include/linux/slab.h:608 [inline]
 kzalloc include/linux/slab.h:733 [inline]
 l2tp_session_create+0x38/0xb60 net/l2tp/l2tp_core.c:1599
 pppol2tp_connect+0xc5d/0x1690 net/l2tp/l2tp_ppp.c:782
 __sys_connect_file net/socket.c:1923 [inline]
 __sys_connect+0x38b/0x410 net/socket.c:1940
 __do_sys_connect net/socket.c:1950 [inline]
 __se_sys_connect net/socket.c:1947 [inline]
 __x64_sys_connect+0x7a/0x90 net/socket.c:1947
 x64_sys_call+0x14e/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:43
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 333:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:193 [inline]
 slab_free_hook mm/slub.c:1723 [inline]
 slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1749
 slab_free mm/slub.c:3521 [inline]
 kfree+0xcc/0x270 mm/slub.c:4583
 l2tp_session_free net/l2tp/l2tp_core.c:168 [inline]
 l2tp_session_dec_refcount+0xa9/0x1b0 net/l2tp/l2tp_core.c:205
 pppol2tp_session_destruct+0xaf/0xf0 net/l2tp/l2tp_ppp.c:419
 __sk_destruct+0x56/0x5b0 net/core/sock.c:1964
 sk_destruct net/core/sock.c:2009 [inline]
 __sk_free+0x36c/0x470 net/core/sock.c:2020
 sk_free+0x51/0x80 net/core/sock.c:2031
 sock_put include/net/sock.h:1929 [inline]
 pppol2tp_put_sk+0x77/0xb0 net/l2tp/l2tp_ppp.c:402
 rcu_do_batch+0x57a/0xc10 kernel/rcu/tree.c:2523
 rcu_core+0x517/0x1020 kernel/rcu/tree.c:2763
 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2776
 handle_softirqs+0x25e/0x5c0 kernel/softirq.c:565
 __do_softirq+0xb/0xd kernel/softirq.c:603

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 __call_rcu_common kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x123/0x10b0 kernel/rcu/tree.c:3125
 pppol2tp_release+0x20f/0x2d0 net/l2tp/l2tp_ppp.c:458
 __sock_release net/socket.c:649 [inline]
 sock_close+0xdf/0x270 net/socket.c:1336
 __fput+0x228/0x8c0 fs/file_table.c:280
 ____fput+0x15/0x20 fs/file_table.c:308
 task_work_run+0x129/0x190 kernel/task_work.c:188
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0xc4/0xe0 kernel/entry/common.c:181
 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:214
 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
 syscall_exit_to_user_mode+0x26/0x160 kernel/entry/common.c:307
 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Second to last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0xf0 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 __call_rcu_common kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x123/0x10b0 kernel/rcu/tree.c:3125
 pppol2tp_release+0x20f/0x2d0 net/l2tp/l2tp_ppp.c:458
 __sock_release net/socket.c:649 [inline]
 sock_close+0xdf/0x270 net/socket.c:1336
 __fput+0x228/0x8c0 fs/file_table.c:280
 ____fput+0x15/0x20 fs/file_table.c:308
 task_work_run+0x129/0x190 kernel/task_work.c:188
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0xc4/0xe0 kernel/entry/common.c:181
 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:214
 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
 syscall_exit_to_user_mode+0x26/0x160 kernel/entry/common.c:307
 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff8881166a7400
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 8 bytes inside of
 512-byte region [ffff8881166a7400, ffff8881166a7600)
The buggy address belongs to the page:
page:ffffea000459a900 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1166a4
head:ffffea000459a900 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 ffffea000459c500 0000000400000004 ffff888100042f00
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 114, ts 7683269238, free_ts 0
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2605
 prep_new_page+0x1b/0x110 mm/page_alloc.c:2611
 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4485
 __alloc_pages+0x27e/0x8f0 mm/page_alloc.c:5780
 allocate_slab mm/slub.c:1932 [inline]
 new_slab+0x9a/0x4e0 mm/slub.c:1995
 ___slab_alloc+0x39e/0x830 mm/slub.c:3028
 __slab_alloc+0x4a/0x90 mm/slub.c:3115
 slab_alloc_node mm/slub.c:3206 [inline]
 slab_alloc mm/slub.c:3250 [inline]
 __kmalloc_track_caller+0x171/0x2c0 mm/slub.c:4949
 kmalloc_reserve net/core/skbuff.c:357 [inline]
 __alloc_skb+0x10c/0x550 net/core/skbuff.c:428
 alloc_skb include/linux/skbuff.h:1183 [inline]
 alloc_skb_with_frags+0xa6/0x680 net/core/skbuff.c:6194
 sock_alloc_send_pskb+0x915/0xa50 net/core/sock.c:2539
 unix_dgram_sendmsg+0x6fd/0x2090 net/unix/af_unix.c:1805
 sock_sendmsg_nosec net/socket.c:704 [inline]
 __sock_sendmsg net/socket.c:716 [inline]
 sock_write_iter+0x39b/0x530 net/socket.c:1079
 call_write_iter include/linux/fs.h:2206 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0xd5d/0x1110 fs/read_write.c:594
 ksys_write+0x199/0x2c0 fs/read_write.c:647
 __do_sys_write fs/read_write.c:659 [inline]
 __se_sys_write fs/read_write.c:656 [inline]
 __x64_sys_write+0x7b/0x90 fs/read_write.c:656
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8881166a7300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881166a7380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8881166a7400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff8881166a7480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881166a7500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/03/13 02:14 android13-5.15-lts 7d1f9b5c2ff5 1a5d9317 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in l2tp_session_delete
2025/04/02 19:40 android13-5.15-lts 5e1b899f19c3 c799dfdd .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in l2tp_session_delete
2025/03/12 19:52 android13-5.15-lts 7d1f9b5c2ff5 1a5d9317 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in l2tp_session_delete
2025/01/23 17:36 android13-5.15-lts 829d9f138569 a44b0418 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in l2tp_session_delete
2024/12/25 05:00 android13-5.15-lts b4bd207b0380 444551c4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in l2tp_session_delete
2024/11/20 05:41 android13-5.15-lts 2e66050fb753 7d02db5a .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in l2tp_session_delete
2024/11/14 20:23 android13-5.15-lts 3bfe08931bff a8c99394 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in l2tp_session_delete
* Struck through repros no longer work on HEAD.