* [syzbot] [net?] WARNING: ODEBUG bug in __sk_destruct (3)
@ 2025-08-08 11:24 syzbot
2025-08-08 13:56 ` Hillf Danton
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: syzbot @ 2025-08-08 11:24 UTC (permalink / raw)
To: davem, edumazet, horms, kuba, linux-kernel, netdev, pabeni,
syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 7abc678e3084 Merge tag 'pmdomain-v6.16-rc2' of git://git.k..
git tree: bpf
console output: https://syzkaller.appspot.com/x/log.txt?x=11b0a4f0580000
kernel config: https://syzkaller.appspot.com/x/.config?x=12b5044868deb866
dashboard link: https://syzkaller.appspot.com/bug?extid=d199b52665b6c3069b94
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=14a20f22580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12af2f22580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/8a9fc2a6bfdf/disk-7abc678e.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/29375cef95f6/vmlinux-7abc678e.xz
kernel image: https://storage.googleapis.com/syzbot-assets/8148ffc5b47b/bzImage-7abc678e.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+d199b52665b6c3069b94@syzkaller.appspotmail.com
------------[ cut here ]------------
ODEBUG: free active (active state 0) object: ffff88807dcf7668 object type: work_struct hint: kcm_tx_work+0x0/0x180 net/kcm/kcmsock.c:-1
WARNING: CPU: 0 PID: 6293 at lib/debugobjects.c:615 debug_print_object+0x16b/0x1e0 lib/debugobjects.c:612
Modules linked in:
CPU: 0 UID: 0 PID: 6293 Comm: syz.0.87 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
RIP: 0010:debug_print_object+0x16b/0x1e0 lib/debugobjects.c:612
Code: 4c 89 ff e8 e7 b7 5b fd 4d 8b 0f 48 c7 c7 a0 95 e2 8b 48 8b 34 24 4c 89 ea 89 e9 4d 89 f0 41 54 e8 da 93 bd fc 48 83 c4 08 90 <0f> 0b 90 90 ff 05 c7 85 db 0a 48 83 c4 08 5b 41 5c 41 5d 41 5e 41
RSP: 0018:ffffc900021efb30 EFLAGS: 00010296
RAX: f0e2d1323eb60c00 RBX: dffffc0000000000 RCX: ffff88802699da00
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000002
RBP: 0000000000000000 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffffbfff1bfaa6c R12: ffffffff8a9e4d50
R13: ffffffff8be29720 R14: ffff88807dcf7668 R15: ffffffff8b89dd60
FS: 00007f6914e486c0(0000) GS:ffff888125c23000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f6914e47f98 CR3: 00000000288b8000 CR4: 00000000003526f0
Call Trace:
<TASK>
__debug_check_no_obj_freed lib/debugobjects.c:1099 [inline]
debug_check_no_obj_freed+0x3a2/0x470 lib/debugobjects.c:1129
slab_free_hook mm/slub.c:2312 [inline]
slab_free mm/slub.c:4643 [inline]
kmem_cache_free+0x113/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
RIP: 0033:0x7f6913f8e9a9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f6914e48038 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: ffffffffffffffda RBX: 00007f69141b6160 RCX: 00007f6913f8e9a9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000006
RBP: 00007f6914010d69 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007f69141b6160 R15: 00007ffe8d790a18
</TASK>
---
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 syzkaller@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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [syzbot] [net?] WARNING: ODEBUG bug in __sk_destruct (3)
2025-08-08 11:24 [syzbot] [net?] WARNING: ODEBUG bug in __sk_destruct (3) syzbot
@ 2025-08-08 13:56 ` Hillf Danton
2025-08-08 14:32 ` syzbot
2025-08-09 2:53 ` Hillf Danton
2025-08-09 4:36 ` Hillf Danton
2 siblings, 1 reply; 13+ messages in thread
From: Hillf Danton @ 2025-08-08 13:56 UTC (permalink / raw)
To: syzbot; +Cc: linux-kernel, syzkaller-bugs
> Date: Fri, 08 Aug 2025 04:24:30 -0700 [thread overview]
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 7abc678e3084 Merge tag 'pmdomain-v6.16-rc2' of git://git.k..
> git tree: bpf
> console output: https://syzkaller.appspot.com/x/log.txt?x=11b0a4f0580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=12b5044868deb866
> dashboard link: https://syzkaller.appspot.com/bug?extid=d199b52665b6c3069b94
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14a20f22580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12af2f22580000
#syz test upstream master
--- x/net/kcm/kcmsock.c
+++ y/net/kcm/kcmsock.c
@@ -1714,7 +1714,7 @@ static int kcm_release(struct socket *so
/* Cancel work. After this point there should be no outside references
* to the kcm socket.
*/
- cancel_work_sync(&kcm->tx_work);
+ flush_work(&kcm->tx_work);
lock_sock(sk);
psock = kcm->tx_psock;
--
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [syzbot] [net?] WARNING: ODEBUG bug in __sk_destruct (3)
2025-08-08 13:56 ` Hillf Danton
@ 2025-08-08 14:32 ` syzbot
0 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2025-08-08 14:32 UTC (permalink / raw)
To: hdanton, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: slab-use-after-free Read in __lock_sock
==================================================================
BUG: KASAN: slab-use-after-free in __raw_spin_lock_bh include/linux/spinlock_api_smp.h:126 [inline]
BUG: KASAN: slab-use-after-free in _raw_spin_lock_bh+0x36/0x50 kernel/locking/spinlock.c:178
Read of size 1 at addr ffff888031e00958 by task kworker/u8:4/59
CPU: 1 UID: 0 PID: 59 Comm: kworker/u8:4 Not tainted 6.16.0-syzkaller-12063-g37816488247d-dirty #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/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/0x240 mm/kasan/report.c:482
kasan_report+0x118/0x150 mm/kasan/report.c:595
__kasan_check_byte+0x2a/0x40 mm/kasan/common.c:568
kasan_check_byte include/linux/kasan.h:399 [inline]
lock_acquire+0x8d/0x360 kernel/locking/lockdep.c:5842
__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/0x2b0 net/core/sock.c:3171
lock_sock_nested+0x9f/0x100 net/core/sock.c:3738
lock_sock include/net/sock.h:1667 [inline]
kcm_tx_work+0x31/0x180 net/kcm/kcmsock.c:718
process_one_work kernel/workqueue.c:3236 [inline]
process_scheduled_works+0xade/0x17b0 kernel/workqueue.c:3319
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3400
kthread+0x70e/0x8a0 kernel/kthread.c:463
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 6724:
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:330 [inline]
__kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:356
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4180 [inline]
slab_alloc_node mm/slub.c:4229 [inline]
kmem_cache_alloc_noprof+0x1c1/0x3c0 mm/slub.c:4236
sk_prot_alloc+0x57/0x220 net/core/sock.c:2233
sk_alloc+0x3a/0x370 net/core/sock.c:2295
kcm_clone net/kcm/kcmsock.c:1524 [inline]
kcm_ioctl+0x214/0xff0 net/kcm/kcmsock.c:1569
sock_do_ioctl+0xd9/0x300 net/socket.c:1238
sock_ioctl+0x576/0x790 net/socket.c:1359
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:598 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
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 6725:
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:243 [inline]
__kasan_slab_free+0x5b/0x80 mm/kasan/common.c:275
kasan_slab_free include/linux/kasan.h:233 [inline]
slab_free_hook mm/slub.c:2417 [inline]
slab_free mm/slub.c:4680 [inline]
kmem_cache_free+0x18f/0x400 mm/slub.c:4782
sk_prot_free net/core/sock.c:2276 [inline]
__sk_destruct+0x4d2/0x660 net/core/sock.c:2373
kcm_release+0x528/0x5c0 net/kcm/kcmsock.c:1736
__sock_release net/socket.c:649 [inline]
sock_close+0xc0/0x240 net/socket.c:1439
__fput+0x44c/0xa70 fs/file_table.c:468
fput_close_sync+0x119/0x200 fs/file_table.c:573
__do_sys_close fs/open.c:1587 [inline]
__se_sys_close fs/open.c:1572 [inline]
__x64_sys_close+0x7f/0x110 fs/open.c:1572
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:2184
__queue_work+0xcd2/0xfb0 kernel/workqueue.c:2339
queue_work_on+0x181/0x270 kernel/workqueue.c:2390
queue_work include/linux/workqueue.h:669 [inline]
kcm_unattach+0x863/0xe90 net/kcm/kcmsock.c:1433
kcm_unattach_ioctl net/kcm/kcmsock.c:1490 [inline]
kcm_ioctl+0x794/0xff0 net/kcm/kcmsock.c:1557
sock_do_ioctl+0xd9/0x300 net/socket.c:1238
sock_ioctl+0x576/0x790 net/socket.c:1359
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:598 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
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:2184
__queue_work+0xcd2/0xfb0 kernel/workqueue.c:2339
queue_work_on+0x181/0x270 kernel/workqueue.c:2390
kcm_attach net/kcm/kcmsock.c:1313 [inline]
kcm_attach_ioctl net/kcm/kcmsock.c:1341 [inline]
kcm_ioctl+0xe52/0xff0 net/kcm/kcmsock.c:1547
sock_do_ioctl+0xd9/0x300 net/socket.c:1238
sock_ioctl+0x576/0x790 net/socket.c:1359
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:598 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
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 ffff888031e00780
which belongs to the cache KCM of size 1792
The buggy address is located 472 bytes inside of
freed 1792-byte region [ffff888031e00780, ffff888031e00e80)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x31e00
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
memcg:ffff8880291be401
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88814c5fa780 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080110011 00000000f5000000 ffff8880291be401
head: 00fff00000000040 ffff88814c5fa780 dead000000000122 0000000000000000
head: 0000000000000000 0000000080110011 00000000f5000000 ffff8880291be401
head: 00fff00000000003 ffffea0000c78001 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 6692, tgid 6688 (syz.0.17), ts 157441443200, free_ts 157382453488
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1851
prep_new_page mm/page_alloc.c:1859 [inline]
get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3858
__alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5148
alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2416
alloc_slab_page mm/slub.c:2487 [inline]
allocate_slab+0x8a/0x370 mm/slub.c:2655
new_slab mm/slub.c:2709 [inline]
___slab_alloc+0xbeb/0x1410 mm/slub.c:3891
__slab_alloc mm/slub.c:3981 [inline]
__slab_alloc_node mm/slub.c:4056 [inline]
slab_alloc_node mm/slub.c:4217 [inline]
kmem_cache_alloc_noprof+0x283/0x3c0 mm/slub.c:4236
sk_prot_alloc+0x57/0x220 net/core/sock.c:2233
sk_alloc+0x3a/0x370 net/core/sock.c:2295
kcm_clone net/kcm/kcmsock.c:1524 [inline]
kcm_ioctl+0x214/0xff0 net/kcm/kcmsock.c:1569
sock_do_ioctl+0xd9/0x300 net/socket.c:1238
sock_ioctl+0x576/0x790 net/socket.c:1359
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:598 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:584
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 5235 tgid 5235 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1395 [inline]
__free_frozen_pages+0xbc4/0xd30 mm/page_alloc.c:2895
discard_slab mm/slub.c:2753 [inline]
__put_partials+0x156/0x1a0 mm/slub.c:3218
put_cpu_partial+0x17c/0x250 mm/slub.c:3293
__slab_free+0x2d5/0x3c0 mm/slub.c:4550
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:340
kasan_slab_alloc include/linux/kasan.h:250 [inline]
slab_post_alloc_hook mm/slub.c:4180 [inline]
slab_alloc_node mm/slub.c:4229 [inline]
kmem_cache_alloc_noprof+0x1c1/0x3c0 mm/slub.c:4236
getname_flags+0xb8/0x540 fs/namei.c:146
getname include/linux/fs.h:2918 [inline]
getname_maybe_null include/linux/fs.h:2925 [inline]
vfs_fstatat+0x43/0x170 fs/stat.c:370
__do_sys_newfstatat fs/stat.c:542 [inline]
__se_sys_newfstatat fs/stat.c:536 [inline]
__x64_sys_newfstatat+0x116/0x190 fs/stat.c:536
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
Memory state around the buggy address:
ffff888031e00800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888031e00880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888031e00900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888031e00980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888031e00a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
Tested on:
commit: 37816488 Merge tag 'net-6.17-rc1' of git://git.kernel...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=164c41a2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=2ae1da3a7f4a6ba4
dashboard link: https://syzkaller.appspot.com/bug?extid=d199b52665b6c3069b94
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
patch: https://syzkaller.appspot.com/x/patch.diff?x=112661a2580000
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [syzbot] [net?] WARNING: ODEBUG bug in __sk_destruct (3)
2025-08-08 11:24 [syzbot] [net?] WARNING: ODEBUG bug in __sk_destruct (3) syzbot
2025-08-08 13:56 ` Hillf Danton
@ 2025-08-09 2:53 ` Hillf Danton
2025-08-09 3:18 ` syzbot
2025-08-09 4:36 ` Hillf Danton
2 siblings, 1 reply; 13+ messages in thread
From: Hillf Danton @ 2025-08-09 2:53 UTC (permalink / raw)
To: syzbot; +Cc: linux-kernel, syzkaller-bugs
> Date: Fri, 08 Aug 2025 04:24:30 -0700 [thread overview]
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 7abc678e3084 Merge tag 'pmdomain-v6.16-rc2' of git://git.k..
> git tree: bpf
> console output: https://syzkaller.appspot.com/x/log.txt?x=11b0a4f0580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=12b5044868deb866
> dashboard link: https://syzkaller.appspot.com/bug?extid=d199b52665b6c3069b94
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14a20f22580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12af2f22580000
#syz test upstream master
--- x/net/kcm/kcmsock.c
+++ y/net/kcm/kcmsock.c
@@ -717,6 +717,8 @@ static void kcm_tx_work(struct work_stru
lock_sock(sk);
+ if (kcm->tx_stopped)
+ goto out;
/* Primarily for SOCK_DGRAM sockets, also handle asynchronous tx
* aborts
*/
--
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [syzbot] [net?] WARNING: ODEBUG bug in __sk_destruct (3)
2025-08-09 2:53 ` Hillf Danton
@ 2025-08-09 3:18 ` syzbot
0 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2025-08-09 3:18 UTC (permalink / raw)
To: hdanton, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
WARNING: ODEBUG bug in __sk_destruct
------------[ cut here ]------------
ODEBUG: free active (active state 0) object: ffff8880777a8d68 object type: work_struct hint: kcm_tx_work+0x0/0x1e0 net/kcm/kcmsock.c:-1
WARNING: CPU: 0 PID: 7359 at lib/debugobjects.c:615 debug_print_object+0x16b/0x1e0 lib/debugobjects.c:612
Modules linked in:
CPU: 0 UID: 0 PID: 7359 Comm: syz.0.134 Not tainted 6.16.0-syzkaller-12063-g37816488247d-dirty #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
RIP: 0010:debug_print_object+0x16b/0x1e0 lib/debugobjects.c:612
Code: 4c 89 ff e8 e7 9b 53 fd 4d 8b 0f 48 c7 c7 20 30 e3 8b 48 8b 34 24 4c 89 ea 89 e9 4d 89 f0 41 54 e8 aa cf b3 fc 48 83 c4 08 90 <0f> 0b 90 90 ff 05 e7 fd d3 0a 48 83 c4 08 5b 41 5c 41 5d 41 5e 41
RSP: 0018:ffffc900035d7b30 EFLAGS: 00010296
RAX: 3388542328802800 RBX: dffffc0000000000 RCX: ffff888026a89e00
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000002
RBP: 0000000000000000 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffffbfff1bfa1ec R12: ffffffff8aa80950
R13: ffffffff8be331a0 R14: ffff8880777a8d68 R15: ffffffff8b89d380
FS: 00007f2fe43246c0(0000) GS:ffff888125c21000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f2fe4323f98 CR3: 0000000033878000 CR4: 00000000003526f0
Call Trace:
<TASK>
__debug_check_no_obj_freed lib/debugobjects.c:1099 [inline]
debug_check_no_obj_freed+0x3a2/0x470 lib/debugobjects.c:1129
slab_free_hook mm/slub.c:2348 [inline]
slab_free mm/slub.c:4680 [inline]
kmem_cache_free+0x113/0x400 mm/slub.c:4782
sk_prot_free net/core/sock.c:2276 [inline]
__sk_destruct+0x4d2/0x660 net/core/sock.c:2373
kcm_release+0x528/0x5c0 net/kcm/kcmsock.c:1738
__sock_release net/socket.c:649 [inline]
sock_close+0xc0/0x240 net/socket.c:1439
__fput+0x44c/0xa70 fs/file_table.c:468
fput_close_sync+0x119/0x200 fs/file_table.c:573
__do_sys_close fs/open.c:1587 [inline]
__se_sys_close fs/open.c:1572 [inline]
__x64_sys_close+0x7f/0x110 fs/open.c:1572
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
RIP: 0033:0x7f2fe358e9a9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f2fe4324038 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: ffffffffffffffda RBX: 00007f2fe37b6160 RCX: 00007f2fe358e9a9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000006
RBP: 00007f2fe3610d69 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007f2fe37b6160 R15: 00007ffd637a7ad8
</TASK>
Tested on:
commit: 37816488 Merge tag 'net-6.17-rc1' of git://git.kernel...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11ddd5bc580000
kernel config: https://syzkaller.appspot.com/x/.config?x=2ae1da3a7f4a6ba4
dashboard link: https://syzkaller.appspot.com/bug?extid=d199b52665b6c3069b94
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
patch: https://syzkaller.appspot.com/x/patch.diff?x=1652b2f0580000
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [syzbot] [net?] WARNING: ODEBUG bug in __sk_destruct (3)
2025-08-08 11:24 [syzbot] [net?] WARNING: ODEBUG bug in __sk_destruct (3) syzbot
2025-08-08 13:56 ` Hillf Danton
2025-08-09 2:53 ` Hillf Danton
@ 2025-08-09 4:36 ` Hillf Danton
2025-08-09 5:11 ` syzbot
2 siblings, 1 reply; 13+ messages in thread
From: Hillf Danton @ 2025-08-09 4:36 UTC (permalink / raw)
To: syzbot; +Cc: linux-kernel, syzkaller-bugs
> Date: Fri, 08 Aug 2025 04:24:30 -0700 [thread overview]
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 7abc678e3084 Merge tag 'pmdomain-v6.16-rc2' of git://git.k..
> git tree: bpf
> console output: https://syzkaller.appspot.com/x/log.txt?x=11b0a4f0580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=12b5044868deb866
> dashboard link: https://syzkaller.appspot.com/bug?extid=d199b52665b6c3069b94
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14a20f22580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12af2f22580000
#syz test upstream master
--- x/net/kcm/kcmsock.c
+++ y/net/kcm/kcmsock.c
@@ -717,6 +717,8 @@ static void kcm_tx_work(struct work_stru
lock_sock(sk);
+ if (kcm->tx_stopped)
+ goto out;
/* Primarily for SOCK_DGRAM sockets, also handle asynchronous tx
* aborts
*/
@@ -1733,6 +1735,7 @@ static int kcm_release(struct socket *so
sock->sk = NULL;
+ flush_work(&kcm->tx_work);
kcm_done(kcm);
return 0;
--
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [syzbot] [net?] WARNING: ODEBUG bug in __sk_destruct (3)
2025-08-09 4:36 ` Hillf Danton
@ 2025-08-09 5:11 ` syzbot
0 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2025-08-09 5:11 UTC (permalink / raw)
To: hdanton, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+d199b52665b6c3069b94@syzkaller.appspotmail.com
Tested-by: syzbot+d199b52665b6c3069b94@syzkaller.appspotmail.com
Tested on:
commit: 37816488 Merge tag 'net-6.17-rc1' of git://git.kernel...
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1303e1a2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=2ae1da3a7f4a6ba4
dashboard link: https://syzkaller.appspot.com/bug?extid=d199b52665b6c3069b94
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
patch: https://syzkaller.appspot.com/x/patch.diff?x=142de1a2580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH net-next] net: kcm: Fix race condition in kcm_unattach()
@ 2025-08-09 6:36 Sven Stegemann
2025-08-09 7:25 ` Sven Stegemann
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Sven Stegemann @ 2025-08-09 6:36 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman
Cc: netdev, linux-kernel, Sven Stegemann, syzbot+e62c9db591c30e174662,
syzbot+d199b52665b6c3069b94
syzbot found a race condition when kcm_unattach(psock)
and kcm_release(kcm) are executed at the same time.
kcm_unattach is missing a check of the flag
kcm->tx_stopped before calling queue_work().
If the kcm has a reserved psock, kcm_unattach() might get executed
between cancel_work_sync() and unreserve_psock() in kcm_release(),
requeuing kcm->tx_work right before kcm gets freed in kcm_done().
Remove kcm->tx_stopped and replace it by the less
error-prone disable_work().
Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module")
Reported-by: syzbot+e62c9db591c30e174662@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=e62c9db591c30e174662
Reported-by: syzbot+d199b52665b6c3069b94@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=d199b52665b6c3069b94
Signed-off-by: Sven Stegemann <sven@stegemann.de>
---
include/net/kcm.h | 1 -
net/kcm/kcmsock.c | 9 ++-------
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/include/net/kcm.h b/include/net/kcm.h
index 441e993be634..d9c35e71ecea 100644
--- a/include/net/kcm.h
+++ b/include/net/kcm.h
@@ -71,7 +71,6 @@ struct kcm_sock {
struct list_head wait_psock_list;
struct sk_buff *seq_skb;
struct mutex tx_mutex;
- u32 tx_stopped : 1;
/* Don't use bit fields here, these are set under different locks */
bool tx_wait;
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index a4971e6fa943..2f66b5279f2a 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -430,7 +430,7 @@ static void psock_write_space(struct sock *sk)
/* Check if the socket is reserved so someone is waiting for sending. */
kcm = psock->tx_kcm;
- if (kcm && !unlikely(kcm->tx_stopped))
+ if (kcm)
queue_work(kcm_wq, &kcm->tx_work);
spin_unlock_bh(&mux->lock);
@@ -1693,12 +1693,6 @@ static int kcm_release(struct socket *sock)
*/
__skb_queue_purge(&sk->sk_write_queue);
- /* Set tx_stopped. This is checked when psock is bound to a kcm and we
- * get a writespace callback. This prevents further work being queued
- * from the callback (unbinding the psock occurs after canceling work.
- */
- kcm->tx_stopped = 1;
-
release_sock(sk);
spin_lock_bh(&mux->lock);
@@ -1714,6 +1708,7 @@ static int kcm_release(struct socket *sock)
/* Cancel work. After this point there should be no outside references
* to the kcm socket.
*/
+ disable_work(&kcm->tx_work);
cancel_work_sync(&kcm->tx_work);
lock_sock(sk);
--
2.50.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH net-next] net: kcm: Fix race condition in kcm_unattach()
2025-08-09 6:36 [PATCH net-next] net: kcm: Fix race condition in kcm_unattach() Sven Stegemann
@ 2025-08-09 7:25 ` Sven Stegemann
2025-08-09 7:56 ` Hillf Danton
2025-08-12 12:54 ` [PATCH net-next] net: kcm: Fix race condition in kcm_unattach() Paolo Abeni
2 siblings, 0 replies; 13+ messages in thread
From: Sven Stegemann @ 2025-08-09 7:25 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman
Cc: netdev, linux-kernel, syzbot+e62c9db591c30e174662,
syzbot+d199b52665b6c3069b94
On 8/9/2025 8:36 AM, Sven Stegemann wrote:
> syzbot found a race condition when kcm_unattach(psock)
> and kcm_release(kcm) are executed at the same time.
>
> kcm_unattach is missing a check of the flag
> kcm->tx_stopped before calling queue_work().
>
> If the kcm has a reserved psock, kcm_unattach() might get executed
> between cancel_work_sync() and unreserve_psock() in kcm_release(),
> requeuing kcm->tx_work right before kcm gets freed in kcm_done().
>
> Remove kcm->tx_stopped and replace it by the less
> error-prone disable_work().
I made a mistake in the subject line. It is supposed to say "[PATCH net]"
instead of "[PATCH net-next".
Also some information about the testing I have done:
I patched msleep() calls into the race windows and wrote a reproducer in C
that reliably triggers a KASAN use-after-free read at the beginning of kcm_tx_work
if run against that kernel build.
With the proposed patch the reproducer does not trigger any crashes or warnings.
The syscalls also return non-negative values.
These are the files I used for debugging:
- Kernel patch:
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index a4971e6fa943..df61f4715747 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -446,6 +446,8 @@ static struct kcm_psock *reserve_psock(struct kcm_sock *kcm)
struct kcm_mux *mux = kcm->mux;
struct kcm_psock *psock;
+ printk("reserve_psock: call function");
+
psock = kcm->tx_psock;
smp_rmb(); /* Must read tx_psock before tx_wait */
@@ -527,6 +529,8 @@ static void unreserve_psock(struct kcm_sock *kcm)
struct kcm_psock *psock;
struct kcm_mux *mux = kcm->mux;
+ printk("unreserve_psock: call function");
+
spin_lock_bh(&mux->lock);
psock = kcm->tx_psock;
@@ -715,6 +719,10 @@ static void kcm_tx_work(struct work_struct *w)
struct sock *sk = &kcm->sk;
int err;
+ printk("kcm_tx_work: entered function");
+
+ msleep(200);
+
lock_sock(sk);
/* Primarily for SOCK_DGRAM sockets, also handle asynchronous tx
@@ -737,6 +745,9 @@ static void kcm_tx_work(struct work_struct *w)
out:
release_sock(sk);
+
+ printk("kcm_tx_work: exiting function");
+
}
static void kcm_push(struct kcm_sock *kcm)
@@ -1357,6 +1368,8 @@ static void kcm_unattach(struct kcm_psock *psock)
struct sock *csk = psock->sk;
struct kcm_mux *mux = psock->mux;
+ printk("kcm_unattach: entered function");
+
lock_sock(csk);
/* Stop getting callbacks from TCP socket. After this there should
@@ -1419,6 +1432,9 @@ static void kcm_unattach(struct kcm_psock *psock)
*/
kcm_abort_tx_psock(psock, EPIPE, false);
+ printk("kcm_unattach: sleeping before queue_work");
+ msleep(100);
+
spin_lock_bh(&mux->lock);
if (!psock->tx_kcm) {
/* psock now unreserved in window mux was unlocked */
@@ -1429,6 +1445,8 @@ static void kcm_unattach(struct kcm_psock *psock)
/* Commit done before queuing work to process it */
smp_mb();
+ printk("kcm_unattach: queueing tx_work");
+
/* Queue tx work to make sure psock->done is handled */
queue_work(kcm_wq, &psock->tx_kcm->tx_work);
spin_unlock_bh(&mux->lock);
@@ -1446,6 +1464,8 @@ static void kcm_unattach(struct kcm_psock *psock)
}
release_sock(csk);
+
+ printk("kcm_unattach: exiting function");
}
static int kcm_unattach_ioctl(struct socket *sock, struct kcm_unattach *info)
@@ -1677,6 +1697,8 @@ static int kcm_release(struct socket *sock)
struct kcm_mux *mux;
struct kcm_psock *psock;
+ printk("kcm_release: entered function");
+
if (!sk)
return 0;
@@ -1716,6 +1738,9 @@ static int kcm_release(struct socket *sock)
*/
cancel_work_sync(&kcm->tx_work);
+ printk("kcm_release: sleeping after cancel_work_sync");
+ msleep(150);
+
lock_sock(sk);
psock = kcm->tx_psock;
if (psock) {
@@ -1733,8 +1758,12 @@ static int kcm_release(struct socket *sock)
sock->sk = NULL;
+ printk("kcm_release: freeing kcm");
+
kcm_done(kcm);
+ printk("kcm_release: exiting function");
+
return 0;
}
--
- Reproducer:
#include <arpa/inet.h>
#include <linux/bpf.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/kcm.h>
#include <linux/bpf_common.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <sys/wait.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int check_error(int ret, const char *err_message)
{
if(ret < 0) {
perror(err_message);
exit(ret);
}
return ret;
}
int main()
{
// system("busybox ip l set lo up");
union bpf_attr prog = {
.prog_type = BPF_PROG_TYPE_SOCKET_FILTER,
.insn_cnt = 2,
.insns = (uint64_t)(struct bpf_insn[]){
{.code=BPF_ALU64|BPF_MOV|BPF_K, .dst_reg=BPF_REG_0, .imm=0},
{.code=BPF_JMP|BPF_EXIT},
},
.license = (__u64) "",
};
int tcp_fd, listen_fd, accept_fd, bpf_fd, kcm_fd, mux_fd;
struct sockaddr_in addr = {
.sin_family = AF_INET,
.sin_port = htons(3270),
.sin_addr.s_addr = inet_addr("127.0.0.1")
};
check_error( listen_fd = socket(AF_INET, SOCK_STREAM, 0), "socket(tcp)" );
check_error( bind(listen_fd, (void *)&addr, sizeof(addr)), "bind" );
check_error( listen(listen_fd, 1), "listen" );
check_error( tcp_fd = socket(AF_INET, SOCK_STREAM, 0), "socket(tcp)" );
check_error( connect(tcp_fd, (void *)&addr, sizeof(addr)), "connect" );
check_error( bpf_fd = syscall(__NR_bpf, BPF_PROG_LOAD, &prog, 48), "bpf" );
check_error( mux_fd = socket(AF_KCM, SOCK_SEQPACKET, 0), "socket(mux)" );
check_error( ioctl(mux_fd, SIOCKCMCLONE, &kcm_fd), "clone" );
struct kcm_attach attach = {tcp_fd, bpf_fd};
check_error( ioctl(mux_fd, SIOCKCMATTACH, &attach), "attach" );
size_t msg_len = (1<<24);
struct iovec iov = {
.iov_base = mmap(NULL, msg_len, PROT_READ, MAP_SHARED | MAP_ANONYMOUS, -1, 0),
.iov_len = msg_len,
};
struct msghdr msg = {
.msg_name = "R",
.msg_namelen = 1,
.msg_iov = &iov,
.msg_iovlen = 1,
0
};
check_error( sendmsg(kcm_fd, &msg, MSG_EOR), "sendmsg" );
printf("Wait 30s for worker threads to finish\n");
sleep(30);
if (fork() == 0) {
sleep(1);
printf("Calling close from child\n");
check_error( close(kcm_fd), "close(kcm) (child)" );
printf("Child done\n");
} else {
check_error( close(kcm_fd), "close(kcm) (parent)" );
sleep(1);
printf("Calling unattach from parent\n");
struct kcm_unattach unattach = {tcp_fd};
check_error( ioctl(mux_fd, SIOCKCMUNATTACH, &unattach), "unattach" );
printf("Parent done\n");
int wstatus;
wait(&wstatus);
}
}
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH net-next] net: kcm: Fix race condition in kcm_unattach()
2025-08-09 6:36 [PATCH net-next] net: kcm: Fix race condition in kcm_unattach() Sven Stegemann
2025-08-09 7:25 ` Sven Stegemann
@ 2025-08-09 7:56 ` Hillf Danton
2025-08-09 11:08 ` [syzbot] [net?] WARNING: ODEBUG bug in __sk_destruct (3) syzbot
2025-08-12 12:54 ` [PATCH net-next] net: kcm: Fix race condition in kcm_unattach() Paolo Abeni
2 siblings, 1 reply; 13+ messages in thread
From: Hillf Danton @ 2025-08-09 7:56 UTC (permalink / raw)
To: Sven Stegemann
Cc: Eric Dumazet, Simon Horman, netdev, linux-kernel, syzbot,
syzkaller-bugs, syzbot+e62c9db591c30e174662
#syz test upstream master
syzbot found a race condition when kcm_unattach(psock)
and kcm_release(kcm) are executed at the same time.
kcm_unattach is missing a check of the flag
kcm->tx_stopped before calling queue_work().
If the kcm has a reserved psock, kcm_unattach() might get executed
between cancel_work_sync() and unreserve_psock() in kcm_release(),
requeuing kcm->tx_work right before kcm gets freed in kcm_done().
Remove kcm->tx_stopped and replace it by the less
error-prone disable_work().
Fixes: ab7ac4eb9832 ("kcm: Kernel Connection Multiplexor module")
Reported-by: syzbot+e62c9db591c30e174662@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=e62c9db591c30e174662
Reported-by: syzbot+d199b52665b6c3069b94@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=d199b52665b6c3069b94
Signed-off-by: Sven Stegemann <sven@stegemann.de>
---
include/net/kcm.h | 1 -
net/kcm/kcmsock.c | 9 ++-------
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/include/net/kcm.h b/include/net/kcm.h
index 441e993be634..d9c35e71ecea 100644
--- a/include/net/kcm.h
+++ b/include/net/kcm.h
@@ -71,7 +71,6 @@ struct kcm_sock {
struct list_head wait_psock_list;
struct sk_buff *seq_skb;
struct mutex tx_mutex;
- u32 tx_stopped : 1;
/* Don't use bit fields here, these are set under different locks */
bool tx_wait;
diff --git a/net/kcm/kcmsock.c b/net/kcm/kcmsock.c
index a4971e6fa943..2f66b5279f2a 100644
--- a/net/kcm/kcmsock.c
+++ b/net/kcm/kcmsock.c
@@ -430,7 +430,7 @@ static void psock_write_space(struct sock *sk)
/* Check if the socket is reserved so someone is waiting for sending. */
kcm = psock->tx_kcm;
- if (kcm && !unlikely(kcm->tx_stopped))
+ if (kcm)
queue_work(kcm_wq, &kcm->tx_work);
spin_unlock_bh(&mux->lock);
@@ -1693,12 +1693,6 @@ static int kcm_release(struct socket *sock)
*/
__skb_queue_purge(&sk->sk_write_queue);
- /* Set tx_stopped. This is checked when psock is bound to a kcm and we
- * get a writespace callback. This prevents further work being queued
- * from the callback (unbinding the psock occurs after canceling work.
- */
- kcm->tx_stopped = 1;
-
release_sock(sk);
spin_lock_bh(&mux->lock);
@@ -1714,6 +1708,7 @@ static int kcm_release(struct socket *sock)
/* Cancel work. After this point there should be no outside references
* to the kcm socket.
*/
+ disable_work(&kcm->tx_work);
cancel_work_sync(&kcm->tx_work);
lock_sock(sk);
--
2.50.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [syzbot] [net?] WARNING: ODEBUG bug in __sk_destruct (3)
2025-08-09 7:56 ` Hillf Danton
@ 2025-08-09 11:08 ` syzbot
0 siblings, 0 replies; 13+ messages in thread
From: syzbot @ 2025-08-09 11:08 UTC (permalink / raw)
To: edumazet, hdanton, horms, linux-kernel, netdev, sven,
syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+d199b52665b6c3069b94@syzkaller.appspotmail.com
Tested-by: syzbot+d199b52665b6c3069b94@syzkaller.appspotmail.com
Tested on:
commit: c30a1353 Merge tag 'bpf-fixes' of git://git.kernel.org..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10927ea2580000
kernel config: https://syzkaller.appspot.com/x/.config?x=2ae1da3a7f4a6ba4
dashboard link: https://syzkaller.appspot.com/bug?extid=d199b52665b6c3069b94
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
patch: https://syzkaller.appspot.com/x/patch.diff?x=134a5434580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net-next] net: kcm: Fix race condition in kcm_unattach()
2025-08-09 6:36 [PATCH net-next] net: kcm: Fix race condition in kcm_unattach() Sven Stegemann
2025-08-09 7:25 ` Sven Stegemann
2025-08-09 7:56 ` Hillf Danton
@ 2025-08-12 12:54 ` Paolo Abeni
2025-08-12 19:27 ` Sven Stegemann
2 siblings, 1 reply; 13+ messages in thread
From: Paolo Abeni @ 2025-08-12 12:54 UTC (permalink / raw)
To: Sven Stegemann, David S. Miller, Eric Dumazet, Jakub Kicinski,
Simon Horman
Cc: netdev, linux-kernel, syzbot+e62c9db591c30e174662,
syzbot+d199b52665b6c3069b94
On 8/9/25 8:36 AM, Sven Stegemann wrote:
> @@ -1714,6 +1708,7 @@ static int kcm_release(struct socket *sock)
> /* Cancel work. After this point there should be no outside references
> * to the kcm socket.
> */
> + disable_work(&kcm->tx_work);
> cancel_work_sync(&kcm->tx_work);
The patch looks functionally correct, but I guess it would be cleaner
simply replacing:
cancel_work_sync(&kcm->tx_work);
with:
disable_work_sync(&kcm->tx_work);
Thanks,
Paolo
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH net-next] net: kcm: Fix race condition in kcm_unattach()
2025-08-12 12:54 ` [PATCH net-next] net: kcm: Fix race condition in kcm_unattach() Paolo Abeni
@ 2025-08-12 19:27 ` Sven Stegemann
0 siblings, 0 replies; 13+ messages in thread
From: Sven Stegemann @ 2025-08-12 19:27 UTC (permalink / raw)
To: Paolo Abeni
Cc: netdev, linux-kernel, syzbot+e62c9db591c30e174662,
syzbot+d199b52665b6c3069b94, David S. Miller, Eric Dumazet,
Jakub Kicinski, Simon Horman
On 8/12/2025 2:54 PM, Paolo Abeni wrote:
> On 8/9/25 8:36 AM, Sven Stegemann wrote:
>> @@ -1714,6 +1708,7 @@ static int kcm_release(struct socket *sock)
>> /* Cancel work. After this point there should be no outside references
>> * to the kcm socket.
>> */
>> + disable_work(&kcm->tx_work);
>> cancel_work_sync(&kcm->tx_work);
>
> The patch looks functionally correct, but I guess it would be cleaner
> simply replacing:
>
> cancel_work_sync(&kcm->tx_work);
>
> with:
>
> disable_work_sync(&kcm->tx_work);
Thank you, that's a good point.
I just submitted a cleaned up version of the patch.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2025-08-12 19:27 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-09 6:36 [PATCH net-next] net: kcm: Fix race condition in kcm_unattach() Sven Stegemann
2025-08-09 7:25 ` Sven Stegemann
2025-08-09 7:56 ` Hillf Danton
2025-08-09 11:08 ` [syzbot] [net?] WARNING: ODEBUG bug in __sk_destruct (3) syzbot
2025-08-12 12:54 ` [PATCH net-next] net: kcm: Fix race condition in kcm_unattach() Paolo Abeni
2025-08-12 19:27 ` Sven Stegemann
-- strict thread matches above, loose matches on Subject: below --
2025-08-08 11:24 [syzbot] [net?] WARNING: ODEBUG bug in __sk_destruct (3) syzbot
2025-08-08 13:56 ` Hillf Danton
2025-08-08 14:32 ` syzbot
2025-08-09 2:53 ` Hillf Danton
2025-08-09 3:18 ` syzbot
2025-08-09 4:36 ` Hillf Danton
2025-08-09 5:11 ` syzbot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.