syzbot


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

Status: premoderation: reported on 2025/01/30 03:12
Reported-by: syzbot+30bce2b97f6dbd70c939@syzkaller.appspotmail.com
First crash: 38d, last: 6d22h
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 138d 162d 0/2 auto-obsoleted due to no activity on 2025/01/19 22:14
linux-6.1 KASAN: use-after-free Write in l2tp_session_delete 2 170d 192d 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 255d 268d 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) 4 44d 114d 0/2 premoderation: reported on 2024/11/14 20:24
linux-5.15 KASAN: use-after-free Write in l2tp_session_delete 2 587d 676d 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 83d 170d 0/3 upstream: reported on 2024/09/19 22:43
android-6-1 KASAN: use-after-free Write in l2tp_session_delete syz 8 8d17h 152d 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 237d 257d 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 ffff888113173808 by task kworker/u4:3/317

CPU: 1 PID: 317 Comm: kworker/u4:3 Not tainted 5.10.234-syzkaller-00023-g3f5f2283d684 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: l2tp l2tp_tunnel_del_work
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:452
 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+0x6dc/0xbd0 kernel/workqueue.c:2301
 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447
 kthread+0x34b/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Allocated by task 8599:
 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:430 [inline]
 ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:509
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:518
 kasan_kmalloc include/linux/kasan.h:254 [inline]
 __kmalloc+0x1aa/0x330 mm/slub.c:4033
 kmalloc include/linux/slab.h:557 [inline]
 kzalloc include/linux/slab.h:664 [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:1866 [inline]
 __sys_connect+0x388/0x410 net/socket.c:1883
 __do_sys_connect net/socket.c:1893 [inline]
 __se_sys_connect net/socket.c:1890 [inline]
 __x64_sys_connect+0x7a/0x90 net/socket.c:1890
 do_syscall_64+0x34/0x70
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 8589:
 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+0x121/0x160 mm/kasan/common.c:362
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1595 [inline]
 slab_free_freelist_hook+0xc0/0x190 mm/slub.c:1621
 slab_free mm/slub.c:3203 [inline]
 kfree+0xc3/0x270 mm/slub.c:4191
 l2tp_session_free net/l2tp/l2tp_core.c:168 [inline]
 l2tp_session_dec_refcount+0xac/0x1b0 net/l2tp/l2tp_core.c:205
 pppol2tp_session_destruct+0xaf/0xf0 net/l2tp/l2tp_ppp.c:419
 __sk_destruct+0x59/0x620 net/core/sock.c:1813
 sk_destruct net/core/sock.c:1858 [inline]
 __sk_free+0x36c/0x470 net/core/sock.c:1869
 sk_free+0x51/0x80 net/core/sock.c:1880
 sock_put include/net/sock.h:1858 [inline]
 pppol2tp_put_sk+0x77/0xb0 net/l2tp/l2tp_ppp.c:402
 rcu_do_batch+0x597/0xc40 kernel/rcu/tree.c:2494
 rcu_core+0x5ad/0xe40 kernel/rcu/tree.c:2735
 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2748
 __do_softirq+0x268/0x5bb kernel/softirq.c:309

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0x100 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 __call_rcu kernel/rcu/tree.c:2976 [inline]
 call_rcu+0x135/0x11f0 kernel/rcu/tree.c:3050
 pppol2tp_release+0x20f/0x2d0 net/l2tp/l2tp_ppp.c:458
 __sock_release net/socket.c:597 [inline]
 sock_close+0xdf/0x270 net/socket.c:1286
 __fput+0x33d/0x7b0 fs/file_table.c:281
 ____fput+0x15/0x20 fs/file_table.c:314
 task_work_run+0x129/0x190 kernel/task_work.c:189
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop+0xbf/0xd0 kernel/entry/common.c:172
 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline]
 syscall_exit_to_user_mode+0xa2/0x1a0 kernel/entry/common.c:274
 do_syscall_64+0x40/0x70 arch/x86/entry/common.c:56
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Second to last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd3/0x100 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 kvfree_call_rcu+0x136/0x650 kernel/rcu/tree.c:3535
 drop_sysctl_table+0x311/0x450 fs/proc/proc_sysctl.c:1680
 drop_sysctl_table+0x323/0x450 fs/proc/proc_sysctl.c:1683
 unregister_sysctl_table+0x76/0x120 fs/proc/proc_sysctl.c:1718
 unregister_net_sysctl_table+0x15/0x20 net/sysctl_net.c:127
 __devinet_sysctl_unregister net/ipv4/devinet.c:2621 [inline]
 devinet_sysctl_unregister net/ipv4/devinet.c:2649 [inline]
 inetdev_destroy net/ipv4/devinet.c:326 [inline]
 inetdev_event+0x76f/0x1040 net/ipv4/devinet.c:1612
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0x8c/0xf0 kernel/notifier.c:410
 call_netdevice_notifiers_info net/core/dev.c:2054 [inline]
 call_netdevice_notifiers_extack net/core/dev.c:2066 [inline]
 call_netdevice_notifiers net/core/dev.c:2080 [inline]
 unregister_netdevice_many+0xde7/0x17d0 net/core/dev.c:10766
 default_device_exit_batch+0x38a/0x3f0 net/core/dev.c:11286
 ops_exit_list net/core/net_namespace.c:190 [inline]
 cleanup_net+0x6e9/0xcb0 net/core/net_namespace.c:609
 process_one_work+0x6dc/0xbd0 kernel/workqueue.c:2301
 worker_thread+0xaea/0x1510 kernel/workqueue.c:2447
 kthread+0x34b/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

The buggy address belongs to the object at ffff888113173800
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 8 bytes inside of
 512-byte region [ffff888113173800, ffff888113173a00)
The buggy address belongs to the page:
page:ffffea00044c5c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x113170
head:ffffea00044c5c00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 dead000000000100 dead000000000122 ffff888100043080
raw: 0000000000000000 0000000080100010 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 0x152a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 15, ts 231575909202, free_ts 231527074578
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x166/0x180 mm/page_alloc.c:2462
 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348
 allocate_slab mm/slub.c:1808 [inline]
 new_slab+0x80/0x400 mm/slub.c:1869
 new_slab_objects mm/slub.c:2627 [inline]
 ___slab_alloc+0x302/0x4b0 mm/slub.c:2791
 __slab_alloc+0x63/0xa0 mm/slub.c:2831
 slab_alloc_node mm/slub.c:2913 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 __kmalloc+0x204/0x330 mm/slub.c:4029
 kmalloc include/linux/slab.h:557 [inline]
 kzalloc include/linux/slab.h:664 [inline]
 neigh_alloc net/core/neighbour.c:439 [inline]
 ___neigh_create+0x6e1/0x1a10 net/core/neighbour.c:592
 __neigh_create+0x32/0x40 net/core/neighbour.c:680
 ip6_finish_output2+0x832/0x15d0 net/ipv6/ip6_output.c:127
 __ip6_finish_output+0x5ec/0x780 net/ipv6/ip6_output.c:201
 ip6_finish_output+0x34/0x1e0 net/ipv6/ip6_output.c:211
 NF_HOOK_COND include/linux/netfilter.h:288 [inline]
 ip6_output+0x1f7/0x4c0 net/ipv6/ip6_output.c:234
 dst_output include/net/dst.h:437 [inline]
 NF_HOOK include/linux/netfilter.h:299 [inline]
 mld_sendpack+0x5fc/0xb40 net/ipv6/mcast.c:1676
 mld_send_cr net/ipv6/mcast.c:1972 [inline]
 mld_ifc_timer_expire+0x816/0xbf0 net/ipv6/mcast.c:2471
 call_timer_fn+0x3b/0x2d0 kernel/time/timer.c:1450
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1349 [inline]
 __free_pages_ok+0x82c/0x850 mm/page_alloc.c:1629
 free_the_page+0x76/0x370 mm/page_alloc.c:5409
 __free_pages+0x67/0xc0 mm/page_alloc.c:5418
 __free_slab+0xcf/0x190 mm/slub.c:1894
 free_slab mm/slub.c:1909 [inline]
 discard_slab mm/slub.c:1915 [inline]
 unfreeze_partials+0x15e/0x190 mm/slub.c:2410
 put_cpu_partial+0xbf/0x180 mm/slub.c:2446
 __slab_free+0x2c8/0x3a0 mm/slub.c:3095
 do_slab_free mm/slub.c:3191 [inline]
 ___cache_free+0x111/0x130 mm/slub.c:3210
 qlink_free+0x50/0x90 mm/kasan/quarantine.c:157
 qlist_free_all+0x47/0xb0 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x15a/0x170 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:440
 kasan_slab_alloc include/linux/kasan.h:244 [inline]
 slab_post_alloc_hook+0x61/0x2f0 mm/slab.h:583
 slab_alloc_node mm/slub.c:2947 [inline]
 slab_alloc mm/slub.c:2955 [inline]
 kmem_cache_alloc_trace+0x163/0x2e0 mm/slub.c:2972
 kmalloc include/linux/slab.h:552 [inline]
 kzalloc include/linux/slab.h:664 [inline]
 ____ip_mc_inc_group+0x1fb/0x890 net/ipv4/igmp.c:1452
 __ip_mc_inc_group net/ipv4/igmp.c:1487 [inline]
 ip_mc_inc_group net/ipv4/igmp.c:1493 [inline]
 ip_mc_up+0x10f/0x1e0 net/ipv4/igmp.c:1792

Memory state around the buggy address:
 ffff888113173700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888113173780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888113173800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff888113173880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888113173900: 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
2025/03/02 17:14 android13-5.10-lts 3f5f2283d684 c3901742 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Write in l2tp_session_delete
2025/01/30 03:11 android13-5.10-lts fbe98d68b6b3 afe4eff5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Write in l2tp_session_delete
* Struck through repros no longer work on HEAD.