syzbot


KASAN: slab-use-after-free Read in __lock_sock

Status: upstream: reported C repro on 2025/07/17 21:41
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+e62c9db591c30e174662@syzkaller.appspotmail.com
First crash: 208d, last: 2d19h
Fix bisection: failed (error log, bisect log)
  
Discussions (2)
Title Replies (including bot) Last reply
[PATCH net v2] net: kcm: Fix race condition in kcm_unattach() 2 (2) 2025/08/14 01:30
[PATCH net-next] net: kcm: Fix race condition in kcm_unattach() 5 (6) 2025/08/12 19:27
Bug presence (3)
Date Name Commit Repro Result
2025/09/03 linux-6.6.y (ToT) cc1a1c5b404a C [report] KASAN: slab-use-after-free Read in release_sock
2025/07/20 upstream (ToT) f4a40a4282f4 C [report] WARNING: ODEBUG bug in __sk_destruct
2025/09/03 upstream (ToT) e6b9dce0aeeb C Didn't crash
Similar bugs (8)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in __lock_sock bluetooth 19 C 1 811d 811d 0/29 auto-obsoleted due to no activity on 2024/03/01 14:18
upstream KASAN: slab-use-after-free Read in __lock_sock (2) bluetooth 19 C 5 590d 605d 0/29 auto-obsoleted due to no activity on 2024/10/08 16:07
upstream BUG: sleeping function called from invalid context in lock_sock_nested (3) bluetooth 19 C inconclusive error 153 160d 638d 0/29 auto-obsoleted due to no activity on 2025/11/12 14:25
linux-5.15 KASAN: use-after-free Read in __lock_sock 19 16 428d 494d 0/3 auto-obsoleted due to no activity on 2025/02/17 16:37
upstream KASAN: use-after-free Read in __lock_sock sctp 19 syz done error 26 1827d 2643d 20/29 fixed on 2022/03/08 16:11
linux-5.15 KASAN: use-after-free Read in __lock_sock (2) 19 1 310d 310d 0/3 auto-obsoleted due to no activity on 2025/07/15 20:45
linux-6.1 KASAN: use-after-free Read in __lock_sock origin:upstream missing-backport 19 C error 1 104d 192d 0/3 upstream: reported C repro on 2025/08/03 04:51
linux-5.15 KASAN: use-after-free Read in __lock_sock (3) origin:upstream 19 C error 10 30d 203d 0/3 upstream: reported C repro on 2025/07/23 10:25
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2025/11/10 06:28 2h29m fix candidate upstream OK (0) job log
2025/08/25 05:11 4h26m bisect fix linux-6.6.y error job log

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in __lock_acquire+0x10d/0x7d40 kernel/locking/lockdep.c:5005
Read of size 8 at addr ffff888026238f30 by task kworker/u4:1/12

CPU: 1 PID: 12 Comm: kworker/u4:1 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/24/2026
Workqueue: kkcmd kcm_tx_work
Call Trace:
 <TASK>
 dump_stack_lvl+0x18c/0x250 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xa8/0x210 mm/kasan/report.c:468
 kasan_report+0x117/0x150 mm/kasan/report.c:581
 __lock_acquire+0x10d/0x7d40 kernel/locking/lockdep.c:5005
 lock_acquire+0x19e/0x420 kernel/locking/lockdep.c:5754
 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
 _raw_spin_lock_bh+0x36/0x50 kernel/locking/spinlock.c:178
 spin_lock_bh include/linux/spinlock.h:356 [inline]
 __lock_sock+0x16a/0x2c0 net/core/sock.c:2987
 lock_sock_nested+0x9f/0x100 net/core/sock.c:3540
 lock_sock include/net/sock.h:1780 [inline]
 kcm_tx_work+0x31/0x180 net/kcm/kcmsock.c:716
 process_one_work kernel/workqueue.c:2634 [inline]
 process_scheduled_works+0xa5d/0x15d0 kernel/workqueue.c:2711
 worker_thread+0xa55/0xfc0 kernel/workqueue.c:2792
 kthread+0x2fa/0x390 kernel/kthread.c:388
 ret_from_fork+0x48/0x80 arch/x86/kernel/process.c:152
 ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:293
 </TASK>

Allocated by task 5933:
 kasan_save_stack mm/kasan/common.c:46 [inline]
 kasan_set_track+0x4e/0x70 mm/kasan/common.c:53
 __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:329
 kasan_slab_alloc include/linux/kasan.h:188 [inline]
 slab_post_alloc_hook+0x6e/0x4b0 mm/slab.h:767
 slab_alloc_node mm/slub.c:3495 [inline]
 slab_alloc mm/slub.c:3503 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3510 [inline]
 kmem_cache_alloc+0x11a/0x2d0 mm/slub.c:3519
 sk_prot_alloc+0x57/0x210 net/core/sock.c:2090
 sk_alloc+0x3a/0x360 net/core/sock.c:2152
 kcm_clone net/kcm/kcmsock.c:1518 [inline]
 kcm_ioctl+0x213/0x1090 net/kcm/kcmsock.c:1563
 sock_do_ioctl+0xfc/0x310 net/socket.c:1219
 sock_ioctl+0x5ba/0x7e0 net/socket.c:1340
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:871 [inline]
 __se_sys_ioctl+0xfd/0x170 fs/ioctl.c:857
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xa0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 5934:
 kasan_save_stack mm/kasan/common.c:46 [inline]
 kasan_set_track+0x4e/0x70 mm/kasan/common.c:53
 kasan_save_free_info+0x2e/0x50 mm/kasan/generic.c:522
 ____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:237
 kasan_slab_free include/linux/kasan.h:164 [inline]
 slab_free_hook mm/slub.c:1811 [inline]
 slab_free_freelist_hook+0x130/0x1a0 mm/slub.c:1837
 slab_free mm/slub.c:3830 [inline]
 kmem_cache_free+0xf8/0x270 mm/slub.c:3852
 sk_prot_free net/core/sock.c:2133 [inline]
 __sk_destruct+0x4d1/0x660 net/core/sock.c:2230
 kcm_release+0x524/0x5b0 net/kcm/kcmsock.c:1738
 __sock_release net/socket.c:659 [inline]
 sock_close+0xbd/0x230 net/socket.c:1420
 __fput+0x234/0x970 fs/file_table.c:384
 __do_sys_close fs/open.c:1573 [inline]
 __se_sys_close+0x15f/0x220 fs/open.c:1558
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xa0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Last potentially related work creation:
 kasan_save_stack+0x3e/0x60 mm/kasan/common.c:46
 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:492
 insert_work+0x3d/0x310 kernel/workqueue.c:1651
 __queue_work+0xc39/0x1020 kernel/workqueue.c:1800
 queue_work_on+0x128/0x1f0 kernel/workqueue.c:1835
 queue_work include/linux/workqueue.h:562 [inline]
 kcm_unattach+0x861/0xe80 net/kcm/kcmsock.c:1427
 kcm_unattach_ioctl net/kcm/kcmsock.c:1484 [inline]
 kcm_ioctl+0x7c4/0x1090 net/kcm/kcmsock.c:1551
 sock_do_ioctl+0xfc/0x310 net/socket.c:1219
 sock_ioctl+0x5ba/0x7e0 net/socket.c:1340
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:871 [inline]
 __se_sys_ioctl+0xfd/0x170 fs/ioctl.c:857
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xa0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Second to last potentially related work creation:
 kasan_save_stack+0x3e/0x60 mm/kasan/common.c:46
 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:492
 insert_work+0x3d/0x310 kernel/workqueue.c:1651
 __queue_work+0xc39/0x1020 kernel/workqueue.c:1800
 queue_work_on+0x128/0x1f0 kernel/workqueue.c:1835
 kcm_attach net/kcm/kcmsock.c:1307 [inline]
 kcm_attach_ioctl net/kcm/kcmsock.c:1335 [inline]
 kcm_ioctl+0xee4/0x1090 net/kcm/kcmsock.c:1541
 sock_do_ioctl+0xfc/0x310 net/socket.c:1219
 sock_ioctl+0x5ba/0x7e0 net/socket.c:1340
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:871 [inline]
 __se_sys_ioctl+0xfd/0x170 fs/ioctl.c:857
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xa0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff888026238e80
 which belongs to the cache KCM of size 1728
The buggy address is located 176 bytes inside of
 freed 1728-byte region [ffff888026238e80, ffff888026239540)

The buggy address belongs to the physical page:
page:ffffea0000988e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x26238
head:ffffea0000988e00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff888077874301
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff88814c008a00 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080110011 00000001ffffffff ffff888077874301
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5929, tgid 5927 (syz.0.17), ts 90801553628, free_ts 89305430821
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1c1/0x200 mm/page_alloc.c:1581
 prep_new_page mm/page_alloc.c:1588 [inline]
 get_page_from_freelist+0x1951/0x19e0 mm/page_alloc.c:3220
 __alloc_pages+0x1f0/0x460 mm/page_alloc.c:4486
 alloc_slab_page+0x5d/0x160 mm/slub.c:1881
 allocate_slab mm/slub.c:2028 [inline]
 new_slab+0x87/0x2d0 mm/slub.c:2081
 ___slab_alloc+0xc5d/0x12f0 mm/slub.c:3253
 __slab_alloc mm/slub.c:3339 [inline]
 __slab_alloc_node mm/slub.c:3392 [inline]
 slab_alloc_node mm/slub.c:3485 [inline]
 slab_alloc mm/slub.c:3503 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3510 [inline]
 kmem_cache_alloc+0x1b3/0x2d0 mm/slub.c:3519
 sk_prot_alloc+0x57/0x210 net/core/sock.c:2090
 sk_alloc+0x3a/0x360 net/core/sock.c:2152
 kcm_clone net/kcm/kcmsock.c:1518 [inline]
 kcm_ioctl+0x213/0x1090 net/kcm/kcmsock.c:1563
 sock_do_ioctl+0xfc/0x310 net/socket.c:1219
 sock_ioctl+0x5ba/0x7e0 net/socket.c:1340
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:871 [inline]
 __se_sys_ioctl+0xfd/0x170 fs/ioctl.c:857
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xa0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1181 [inline]
 free_unref_page_prepare+0x7b2/0x8c0 mm/page_alloc.c:2365
 free_unref_page+0x32/0x2e0 mm/page_alloc.c:2458
 discard_slab mm/slub.c:2127 [inline]
 __unfreeze_partials+0x1cf/0x210 mm/slub.c:2667
 put_cpu_partial+0x17c/0x250 mm/slub.c:2743
 __slab_free+0x319/0x400 mm/slub.c:3700
 qlink_free mm/kasan/quarantine.c:166 [inline]
 qlist_free_all+0x75/0xd0 mm/kasan/quarantine.c:185
 kasan_quarantine_reduce+0x143/0x160 mm/kasan/quarantine.c:292
 __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:306
 kasan_slab_alloc include/linux/kasan.h:188 [inline]
 slab_post_alloc_hook+0x6e/0x4b0 mm/slab.h:767
 slab_alloc_node mm/slub.c:3495 [inline]
 __kmem_cache_alloc_node+0x13a/0x250 mm/slub.c:3534
 kmalloc_trace+0x2a/0xe0 mm/slab_common.c:1098
 kmalloc include/linux/slab.h:600 [inline]
 netdevice_queue_work drivers/infiniband/core/roce_gid_mgmt.c:642 [inline]
 netdevice_event+0x3cc/0x8e0 drivers/infiniband/core/roce_gid_mgmt.c:801
 notifier_call_chain+0x197/0x380 kernel/notifier.c:93
 call_netdevice_notifiers_extack net/core/dev.c:2077 [inline]
 call_netdevice_notifiers net/core/dev.c:2091 [inline]
 unregister_netdevice_many_notify+0x100d/0x1900 net/core/dev.c:11099
 unregister_netdevice_many net/core/dev.c:11155 [inline]
 default_device_exit_batch+0x9ee/0xa80 net/core/dev.c:11633
 ops_exit_list net/core/net_namespace.c:178 [inline]
 cleanup_net+0x795/0xbb0 net/core/net_namespace.c:652

Memory state around the buggy address:
 ffff888026238e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888026238e80: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888026238f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                     ^
 ffff888026238f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888026239000: 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
2026/02/08 16:32 linux-6.6.y c56aaf1a85ae 4c131dc4 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in __lock_sock
2025/07/22 12:40 linux-6.6.y d96eb99e2f0e 1555463b .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan-perf KASAN: slab-use-after-free Read in __lock_sock
2025/07/21 03:36 linux-6.6.y d96eb99e2f0e 7117feec .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan-perf KASAN: slab-use-after-free Read in __lock_sock
2025/07/20 08:18 linux-6.6.y d96eb99e2f0e 7117feec .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan-perf KASAN: slab-use-after-free Read in __lock_sock
2025/07/18 18:42 linux-6.6.y d96eb99e2f0e 88248e14 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan-perf KASAN: slab-use-after-free Read in __lock_sock
2025/07/17 21:41 linux-6.6.y 9247f4e6573a 0d1223f1 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan-perf KASAN: slab-use-after-free Read in __lock_sock
2025/07/20 15:04 linux-6.6.y d96eb99e2f0e 7117feec .config console log report syz / log [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan-perf KASAN: slab-use-after-free Read in __lock_sock
* Struck through repros no longer work on HEAD.