[v6.6] KASAN: slab-use-after-free Read in release_sock

8 views
Skip to first unread message

syzbot

unread,
Jul 18, 2025, 5:37:39 AM7/18/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d96eb99e2f0e Linux 6.6.99
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16d05d8c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=bfd82343ac39d3b
dashboard link: https://syzkaller.appspot.com/bug?extid=be6b1fdfeae512726b4e
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=108eb382580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=120d7d8c580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/7ed8b69e685f/disk-d96eb99e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/bb6aa73497a7/vmlinux-d96eb99e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/f864bab34183/bzImage-d96eb99e.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+be6b1f...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-use-after-free in __lock_acquire+0xff/0x7c80 kernel/locking/lockdep.c:5005
Read of size 8 at addr ffff88807d0e9db0 by task kworker/u4:3/48

CPU: 1 PID: 48 Comm: kworker/u4:3 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]
release_sock+0x2f/0x1c0 net/core/sock.c:3523
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 6383:
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 6384:
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 ffff88807d0e9d00
which belongs to the cache KCM of size 1720
The buggy address is located 176 bytes inside of
freed 1720-byte region [ffff88807d0e9d00, ffff88807d0ea3b8)

The buggy address belongs to the physical page:
page:ffffea0001f43a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7d0e8
head:ffffea0001f43a00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff888024196201
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff88802c39d280 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080110011 00000001ffffffff ffff888024196201
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 6370, tgid 6369 (syz.0.119), ts 172058472506, free_ts 172056728285
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]
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
ptlock_alloc mm/memory.c:6155 [inline]
ptlock_init include/linux/mm.h:2898 [inline]
pmd_ptlock_init include/linux/mm.h:2998 [inline]
pagetable_pmd_ctor include/linux/mm.h:3036 [inline]
pmd_alloc_one include/asm-generic/pgalloc.h:137 [inline]
__pmd_alloc+0x116/0x880 mm/memory.c:5577
pmd_alloc include/linux/mm.h:2797 [inline]
__handle_mm_fault mm/memory.c:5127 [inline]
handle_mm_fault+0xb3d/0x4920 mm/memory.c:5331
do_user_addr_fault+0xad0/0x12e0 arch/x86/mm/fault.c:1324
handle_page_fault arch/x86/mm/fault.c:1465 [inline]
exc_page_fault+0x67/0x110 arch/x86/mm/fault.c:1521
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:608

Memory state around the buggy address:
ffff88807d0e9c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88807d0e9d00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807d0e9d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807d0e9e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807d0e9e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages