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
[Documentation on labels]
Reported-by: syzbot+e62c9db591c30e174662@syzkaller.appspotmail.com
First crash: 9d01h, last: 4d10h
Bug presence (1)
Date Name Commit Repro Result
2025/07/20 upstream (ToT) f4a40a4282f4 C [report] WARNING: ODEBUG bug in __sk_destruct
Similar bugs (7)
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 612d 612d 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 391d 405d 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 150 4d22h 439d 0/29 upstream: reported C repro on 2024/05/13 12:58
linux-5.15 KASAN: use-after-free Read in __lock_sock 19 16 229d 294d 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 1628d 2443d 20/29 fixed on 2022/03/08 16:11
linux-5.15 KASAN: use-after-free Read in __lock_sock (2) 19 1 111d 111d 0/3 auto-obsoleted due to no activity on 2025/07/15 20:45
linux-5.15 KASAN: use-after-free Read in __lock_sock (3) origin:upstream 19 C 5 2d15h 3d12h 0/3 upstream: reported C repro on 2025/07/23 10:25

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in __lock_acquire+0xff/0x7c80 kernel/locking/lockdep.c:5005
Read of size 8 at addr ffff888077a01670 by task kworker/u4:5/68

CPU: 1 PID: 68 Comm: kworker/u4:5 Not tainted 6.6.99-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Workqueue: kkcmd kcm_tx_work
Call Trace:
 <TASK>
 dump_stack_lvl+0x16c/0x230 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xac/0x200 mm/kasan/report.c:466
 kasan_report+0x117/0x150 mm/kasan/report.c:579
 __lock_acquire+0xff/0x7c80 kernel/locking/lockdep.c:5005
 lock_acquire+0x197/0x410 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+0x156/0x2a0 net/core/sock.c:2965
 lock_sock_nested+0x9f/0x100 net/core/sock.c:3515
 lock_sock include/net/sock.h:1731 [inline]
 kcm_tx_work+0x31/0x180 net/kcm/kcmsock.c:716
 process_one_work kernel/workqueue.c:2634 [inline]
 process_scheduled_works+0xa45/0x15b0 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 6109:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4e/0x70 mm/kasan/common.c:52
 __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:328
 kasan_slab_alloc include/linux/kasan.h:188 [inline]
 slab_post_alloc_hook+0x6e/0x4d0 mm/slab.h:767
 slab_alloc_node mm/slub.c:3485 [inline]
 slab_alloc mm/slub.c:3493 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3500 [inline]
 kmem_cache_alloc+0x11e/0x2e0 mm/slub.c:3509
 sk_prot_alloc+0x57/0x210 net/core/sock.c:2088
 sk_alloc+0x3a/0x360 net/core/sock.c:2147
 kcm_clone net/kcm/kcmsock.c:1518 [inline]
 kcm_ioctl+0x215/0xff0 net/kcm/kcmsock.c:1563
 sock_do_ioctl+0xd7/0x2f0 net/socket.c:1222
 sock_ioctl+0x623/0x7a0 net/socket.c:1341
 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:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 6110:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4e/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2e/0x50 mm/kasan/generic.c:522
 ____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:164 [inline]
 slab_free_hook mm/slub.c:1806 [inline]
 slab_free_freelist_hook+0x130/0x1b0 mm/slub.c:1832
 slab_free mm/slub.c:3816 [inline]
 kmem_cache_free+0xf8/0x280 mm/slub.c:3838
 sk_prot_free net/core/sock.c:2128 [inline]
 __sk_destruct+0x485/0x620 net/core/sock.c:2222
 kcm_release+0x524/0x5b0 net/kcm/kcmsock.c:1738
 __sock_release net/socket.c:659 [inline]
 sock_close+0xbd/0x230 net/socket.c:1421
 __fput+0x234/0x970 fs/file_table.c:384
 __do_sys_close fs/open.c:1571 [inline]
 __se_sys_close+0x15f/0x220 fs/open.c:1556
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Last potentially related work creation:
 kasan_save_stack+0x3e/0x60 mm/kasan/common.c:45
 __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+0x121/0x1e0 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+0x791/0xff0 net/kcm/kcmsock.c:1551
 sock_do_ioctl+0xd7/0x2f0 net/socket.c:1222
 sock_ioctl+0x623/0x7a0 net/socket.c:1341
 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:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Second to last potentially related work creation:
 kasan_save_stack+0x3e/0x60 mm/kasan/common.c:45
 __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+0x121/0x1e0 kernel/workqueue.c:1835
 kcm_attach net/kcm/kcmsock.c:1307 [inline]
 kcm_attach_ioctl net/kcm/kcmsock.c:1335 [inline]
 kcm_ioctl+0xe4f/0xff0 net/kcm/kcmsock.c:1541
 sock_do_ioctl+0xd7/0x2f0 net/socket.c:1222
 sock_ioctl+0x623/0x7a0 net/socket.c:1341
 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:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

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

The buggy address belongs to the physical page:
page:ffffea0001de8000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x77a00
head:ffffea0001de8000 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff88802440ab01
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff88802c0063c0 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080110011 00000001ffffffff ffff88802440ab01
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 6100, tgid 6099 (syz.0.39), ts 112368068780, free_ts 112350455151
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1cd/0x210 mm/page_alloc.c:1554
 prep_new_page mm/page_alloc.c:1561 [inline]
 get_page_from_freelist+0x195c/0x19f0 mm/page_alloc.c:3191
 __alloc_pages+0x1e3/0x460 mm/page_alloc.c:4457
 alloc_slab_page+0x5d/0x170 mm/slub.c:1876
 allocate_slab mm/slub.c:2023 [inline]
 new_slab+0x87/0x2e0 mm/slub.c:2076
 ___slab_alloc+0xc6d/0x12f0 mm/slub.c:3230
 __slab_alloc mm/slub.c:3329 [inline]
 __slab_alloc_node mm/slub.c:3382 [inline]
 slab_alloc_node mm/slub.c:3475 [inline]
 slab_alloc mm/slub.c:3493 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3500 [inline]
 kmem_cache_alloc+0x1b7/0x2e0 mm/slub.c:3509
 sk_prot_alloc+0x57/0x210 net/core/sock.c:2088
 sk_alloc+0x3a/0x360 net/core/sock.c:2147
 kcm_create+0x100/0x570 net/kcm/kcmsock.c:1808
 __sock_create+0x4a6/0x940 net/socket.c:1571
 sock_create net/socket.c:1627 [inline]
 __sys_socket_create net/socket.c:1664 [inline]
 __sys_socket+0xd7/0x1a0 net/socket.c:1715
 __do_sys_socket net/socket.c:1729 [inline]
 __se_sys_socket net/socket.c:1727 [inline]
 __x64_sys_socket+0x7a/0x90 net/socket.c:1727
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:81
 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:1154 [inline]
 free_unref_page_prepare+0x7ce/0x8e0 mm/page_alloc.c:2336
 free_unref_page+0x32/0x2e0 mm/page_alloc.c:2429
 discard_slab mm/slub.c:2122 [inline]
 __unfreeze_partials+0x1cf/0x210 mm/slub.c:2662
 put_cpu_partial+0x17c/0x250 mm/slub.c:2738
 __slab_free+0x31d/0x410 mm/slub.c:3686
 qlink_free mm/kasan/quarantine.c:166 [inline]
 qlist_free_all+0x75/0xe0 mm/kasan/quarantine.c:185
 kasan_quarantine_reduce+0x143/0x160 mm/kasan/quarantine.c:292
 __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:188 [inline]
 slab_post_alloc_hook+0x6e/0x4d0 mm/slab.h:767
 slab_alloc_node mm/slub.c:3485 [inline]
 __kmem_cache_alloc_node+0x13e/0x260 mm/slub.c:3524
 __do_kmalloc_node mm/slab_common.c:1006 [inline]
 __kmalloc_node+0xa4/0x230 mm/slab_common.c:1014
 kmalloc_node include/linux/slab.h:620 [inline]
 __vmalloc_area_node mm/vmalloc.c:3144 [inline]
 __vmalloc_node_range+0x59a/0x1320 mm/vmalloc.c:3339
 __vmalloc_node mm/vmalloc.c:3404 [inline]
 vzalloc+0x79/0x90 mm/vmalloc.c:3477
 __do_replace+0xa8/0x980 net/ipv4/netfilter/ip_tables.c:1046
 do_replace net/ipv4/netfilter/ip_tables.c:1141 [inline]
 do_ipt_set_ctl+0xa06/0xcc0 net/ipv4/netfilter/ip_tables.c:1635
 nf_setsockopt+0x263/0x280 net/netfilter/nf_sockopt.c:101

Memory state around the buggy address:
 ffff888077a01500: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
 ffff888077a01580: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
>ffff888077a01600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff888077a01680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888077a01700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (6):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
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.