syzbot


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

Status: closed as invalid on 2025/08/19 11:22
Subsystems: net
[Documentation on labels]
First crash: 34d, last: 34d
Cause bisection: failed (error log, bisect log)
  
Similar bugs (4)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in sock_def_write_space (3) intel-wired-lan 19 21 1557d 1793d 0/29 auto-closed as invalid on 2021/08/18 10:16
linux-5.15 KASAN: use-after-free Read in sock_def_write_space (2) 19 1 627d 627d 0/3 auto-obsoleted due to no activity on 2024/03/15 00:45
upstream KASAN: use-after-free Read in sock_def_write_space (4) net virt 19 7 1205d 1373d 0/29 auto-closed as invalid on 2022/08/04 16:53
linux-5.15 KASAN: use-after-free Read in sock_def_write_space 19 1 760d 760d 0/3 auto-obsoleted due to no activity on 2023/11/03 11:19
Last patch testing requests (1)
Created Duration User Patch Repo Result
2025/08/04 17:15 27m retest repro bpf report log

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read include/linux/instrumented.h:68 [inline]
BUG: KASAN: slab-use-after-free in atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline]
BUG: KASAN: slab-use-after-free in refcount_read include/linux/refcount.h:170 [inline]
BUG: KASAN: slab-use-after-free in sock_writeable include/net/sock.h:2578 [inline]
BUG: KASAN: slab-use-after-free in sock_def_write_space+0xdb/0x430 net/core/sock.c:3598
Read of size 4 at addr ffff88801ff3641c by task kworker/u8:4/59

CPU: 0 UID: 0 PID: 59 Comm: kworker/u8:4 Not tainted 6.16.0-rc6-syzkaller-g7abc678e3084 #0 PREEMPT(full) 
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+0x189/0x250 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0xca/0x230 mm/kasan/report.c:480
 kasan_report+0x118/0x150 mm/kasan/report.c:593
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x2b0/0x2c0 mm/kasan/generic.c:189
 instrument_atomic_read include/linux/instrumented.h:68 [inline]
 atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline]
 refcount_read include/linux/refcount.h:170 [inline]
 sock_writeable include/net/sock.h:2578 [inline]
 sock_def_write_space+0xdb/0x430 net/core/sock.c:3598
 kcm_write_msgs+0x1436/0x1570 net/kcm/kcmsock.c:706
 kcm_tx_work+0x39/0x180 net/kcm/kcmsock.c:722
 process_one_work kernel/workqueue.c:3238 [inline]
 process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321
 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402
 kthread+0x70e/0x8a0 kernel/kthread.c:464
 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
 </TASK>

Allocated by task 6882:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
 unpoison_slab_object mm/kasan/common.c:319 [inline]
 __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:345
 kasan_slab_alloc include/linux/kasan.h:250 [inline]
 slab_post_alloc_hook mm/slub.c:4148 [inline]
 slab_alloc_node mm/slub.c:4197 [inline]
 kmem_cache_alloc_noprof+0x1c1/0x3c0 mm/slub.c:4204
 sk_prot_alloc+0x57/0x220 net/core/sock.c:2241
 sk_alloc+0x3a/0x370 net/core/sock.c:2303
 kcm_clone net/kcm/kcmsock.c:1519 [inline]
 kcm_ioctl+0x214/0xff0 net/kcm/kcmsock.c:1564
 sock_do_ioctl+0xd9/0x300 net/socket.c:1190
 sock_ioctl+0x576/0x790 net/socket.c:1311
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:907 [inline]
 __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 6883:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:576
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x62/0x70 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:233 [inline]
 slab_free_hook mm/slub.c:2381 [inline]
 slab_free mm/slub.c:4643 [inline]
 kmem_cache_free+0x18f/0x400 mm/slub.c:4745
 sk_prot_free net/core/sock.c:2284 [inline]
 __sk_destruct+0x4d2/0x660 net/core/sock.c:2381
 kcm_release+0x528/0x5c0 net/kcm/kcmsock.c:1731
 __sock_release net/socket.c:647 [inline]
 sock_close+0xc0/0x240 net/socket.c:1391
 __fput+0x44c/0xa70 fs/file_table.c:465
 fput_close_sync+0x119/0x200 fs/file_table.c:570
 __do_sys_close fs/open.c:1589 [inline]
 __se_sys_close fs/open.c:1574 [inline]
 __x64_sys_close+0x7f/0x110 fs/open.c:1574
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Last potentially related work creation:
 kasan_save_stack+0x3e/0x60 mm/kasan/common.c:47
 kasan_record_aux_stack+0xbd/0xd0 mm/kasan/generic.c:548
 insert_work+0x3d/0x330 kernel/workqueue.c:2183
 __queue_work+0xcfc/0xfe0 kernel/workqueue.c:2341
 queue_work_on+0x181/0x270 kernel/workqueue.c:2392
 queue_work include/linux/workqueue.h:662 [inline]
 kcm_unattach+0x863/0xe90 net/kcm/kcmsock.c:1428
 kcm_unattach_ioctl net/kcm/kcmsock.c:1485 [inline]
 kcm_ioctl+0x794/0xff0 net/kcm/kcmsock.c:1552
 sock_do_ioctl+0xd9/0x300 net/socket.c:1190
 sock_ioctl+0x576/0x790 net/socket.c:1311
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:907 [inline]
 __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Second to last potentially related work creation:
 kasan_save_stack+0x3e/0x60 mm/kasan/common.c:47
 kasan_record_aux_stack+0xbd/0xd0 mm/kasan/generic.c:548
 insert_work+0x3d/0x330 kernel/workqueue.c:2183
 __queue_work+0xcfc/0xfe0 kernel/workqueue.c:2341
 queue_work_on+0x181/0x270 kernel/workqueue.c:2392
 kcm_attach net/kcm/kcmsock.c:1308 [inline]
 kcm_attach_ioctl net/kcm/kcmsock.c:1336 [inline]
 kcm_ioctl+0xe52/0xff0 net/kcm/kcmsock.c:1542
 sock_do_ioctl+0xd9/0x300 net/socket.c:1190
 sock_ioctl+0x576/0x790 net/socket.c:1311
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:907 [inline]
 __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88801ff36180
 which belongs to the cache KCM of size 1792
The buggy address is located 668 bytes inside of
 freed 1792-byte region [ffff88801ff36180, ffff88801ff36880)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88801ff34b00 pfn:0x1ff30
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff8880282f0001
anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88814bf99780 0000000000000000 0000000000000001
raw: ffff88801ff34b00 0000000080110010 00000000f5000000 ffff8880282f0001
head: 00fff00000000040 ffff88814bf99780 0000000000000000 0000000000000001
head: ffff88801ff34b00 0000000080110010 00000000f5000000 ffff8880282f0001
head: 00fff00000000003 ffffea00007fcc01 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 6137, tgid 6133 (syz.0.16), ts 132672540719, free_ts 132628153134
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1704
 prep_new_page mm/page_alloc.c:1712 [inline]
 get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3669
 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4959
 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2419
 alloc_slab_page mm/slub.c:2451 [inline]
 allocate_slab+0x8a/0x3b0 mm/slub.c:2619
 new_slab mm/slub.c:2673 [inline]
 ___slab_alloc+0xbfc/0x1480 mm/slub.c:3859
 __slab_alloc mm/slub.c:3949 [inline]
 __slab_alloc_node mm/slub.c:4024 [inline]
 slab_alloc_node mm/slub.c:4185 [inline]
 kmem_cache_alloc_noprof+0x283/0x3c0 mm/slub.c:4204
 sk_prot_alloc+0x57/0x220 net/core/sock.c:2241
 sk_alloc+0x3a/0x370 net/core/sock.c:2303
 kcm_clone net/kcm/kcmsock.c:1519 [inline]
 kcm_ioctl+0x214/0xff0 net/kcm/kcmsock.c:1564
 sock_do_ioctl+0xd9/0x300 net/socket.c:1190
 sock_ioctl+0x576/0x790 net/socket.c:1311
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:907 [inline]
 __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
page last free pid 6132 tgid 6132 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1248 [inline]
 __free_frozen_pages+0xc71/0xe70 mm/page_alloc.c:2706
 __slab_free+0x326/0x400 mm/slub.c:4554
 qlink_free mm/kasan/quarantine.c:163 [inline]
 qlist_free_all+0x97/0x140 mm/kasan/quarantine.c:179
 kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286
 __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:329
 kasan_slab_alloc include/linux/kasan.h:250 [inline]
 slab_post_alloc_hook mm/slub.c:4148 [inline]
 slab_alloc_node mm/slub.c:4197 [inline]
 __do_kmalloc_node mm/slub.c:4327 [inline]
 __kmalloc_node_noprof+0x21b/0x4e0 mm/slub.c:4334
 kmalloc_array_node_noprof include/linux/slab.h:1020 [inline]
 alloc_slab_obj_exts mm/slub.c:1992 [inline]
 account_slab mm/slub.c:2578 [inline]
 allocate_slab+0x17c/0x3b0 mm/slub.c:2638
 new_slab mm/slub.c:2673 [inline]
 ___slab_alloc+0xbfc/0x1480 mm/slub.c:3859
 __slab_alloc mm/slub.c:3949 [inline]
 __slab_alloc_node mm/slub.c:4024 [inline]
 slab_alloc_node mm/slub.c:4185 [inline]
 kmem_cache_alloc_noprof+0x283/0x3c0 mm/slub.c:4204
 anon_vma_chain_alloc mm/rmap.c:142 [inline]
 __anon_vma_prepare+0xcb/0x4a0 mm/rmap.c:195
 __vmf_anon_prepare mm/memory.c:3523 [inline]
 vmf_anon_prepare mm/internal.h:410 [inline]
 do_anonymous_page mm/memory.c:5067 [inline]
 do_pte_missing mm/memory.c:4249 [inline]
 handle_pte_fault mm/memory.c:6069 [inline]
 __handle_mm_fault+0x4d02/0x5620 mm/memory.c:6212
 handle_mm_fault+0x40a/0x8e0 mm/memory.c:6381
 do_user_addr_fault+0xa81/0x1390 arch/x86/mm/fault.c:1336
 handle_page_fault arch/x86/mm/fault.c:1476 [inline]
 exc_page_fault+0x76/0xf0 arch/x86/mm/fault.c:1532
 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623

Memory state around the buggy address:
 ffff88801ff36300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801ff36380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88801ff36400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff88801ff36480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88801ff36500: 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/21 11:00 bpf 7abc678e3084 7117feec .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci-upstream-bpf-kasan-gce KASAN: slab-use-after-free Read in sock_def_write_space
* Struck through repros no longer work on HEAD.