* [syzbot] [net?] KASAN: slab-use-after-free Write in __xfrm_state_delete
@ 2025-07-29 7:08 syzbot
2025-08-24 19:21 ` syzbot
2025-08-28 7:25 ` syzbot
0 siblings, 2 replies; 4+ messages in thread
From: syzbot @ 2025-07-29 7:08 UTC (permalink / raw)
To: davem, edumazet, herbert, horms, kuba, linux-kernel, netdev,
pabeni, steffen.klassert, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: fa582ca7e187 dpll: zl3073x: Fix build failure
git tree: net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=146f9034580000
kernel config: https://syzkaller.appspot.com/x/.config?x=eaf2a9cf21578aa9
dashboard link: https://syzkaller.appspot.com/bug?extid=a25ee9d20d31e483ba7b
compiler: Debian clang version 20.1.7 (++20250616065708+6146a88f6049-1~exp1~20250616065826.132), Debian LLD 20.1.7
Unfortunately, I don't have any reproducer for this issue yet.
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a704dcfc1b79/disk-fa582ca7.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b47b9b6cceb4/vmlinux-fa582ca7.xz
kernel image: https://storage.googleapis.com/syzbot-assets/adcc93889faf/bzImage-fa582ca7.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+a25ee9d20d31e483ba7b@syzkaller.appspotmail.com
==================================================================
BUG: KASAN: slab-use-after-free in __hlist_del include/linux/list.h:982 [inline]
BUG: KASAN: slab-use-after-free in hlist_del_rcu include/linux/rculist.h:560 [inline]
BUG: KASAN: slab-use-after-free in __xfrm_state_delete+0x696/0xca0 net/xfrm/xfrm_state.c:830
Write of size 8 at addr ffff888040300470 by task kworker/0:4/5933
CPU: 0 UID: 0 PID: 5933 Comm: kworker/0:4 Not tainted 6.16.0-rc7-syzkaller-02024-gfa582ca7e187 #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Workqueue: events xfrm_state_gc_task
Call Trace:
<IRQ>
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
__hlist_del include/linux/list.h:982 [inline]
hlist_del_rcu include/linux/rculist.h:560 [inline]
__xfrm_state_delete+0x696/0xca0 net/xfrm/xfrm_state.c:830
xfrm_timer_handler+0x18f/0xa00 net/xfrm/xfrm_state.c:716
__run_hrtimer kernel/time/hrtimer.c:1761 [inline]
__hrtimer_run_queues+0x52c/0xc60 kernel/time/hrtimer.c:1825
hrtimer_run_softirq+0x187/0x2b0 kernel/time/hrtimer.c:1842
handle_softirqs+0x286/0x870 kernel/softirq.c:579
do_softirq+0xec/0x180 kernel/softirq.c:480
</IRQ>
<TASK>
__local_bh_enable_ip+0x17d/0x1c0 kernel/softirq.c:407
spin_unlock_bh include/linux/spinlock.h:396 [inline]
xfrm_state_gc_task+0xd1/0x6a0 net/xfrm/xfrm_state.c:629
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 13089:
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
xfrm_state_alloc+0x24/0x2f0 net/xfrm/xfrm_state.c:733
pfkey_msg2xfrm_state net/key/af_key.c:1122 [inline]
pfkey_add+0x6e4/0x2e00 net/key/af_key.c:1504
pfkey_process net/key/af_key.c:2848 [inline]
pfkey_sendmsg+0xbfe/0x1090 net/key/af_key.c:3699
sock_sendmsg_nosec net/socket.c:714 [inline]
__sock_sendmsg+0x219/0x270 net/socket.c:729
____sys_sendmsg+0x505/0x830 net/socket.c:2614
___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668
__sys_sendmsg net/socket.c:2700 [inline]
__do_sys_sendmsg net/socket.c:2705 [inline]
__se_sys_sendmsg net/socket.c:2703 [inline]
__x64_sys_sendmsg+0x19b/0x260 net/socket.c:2703
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 5934:
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
xfrm_state_free net/xfrm/xfrm_state.c:591 [inline]
xfrm_state_gc_destroy net/xfrm/xfrm_state.c:618 [inline]
xfrm_state_gc_task+0x518/0x6a0 net/xfrm/xfrm_state.c:634
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
The buggy address belongs to the object at ffff888040300440
which belongs to the cache xfrm_state of size 928
The buggy address is located 48 bytes inside of
freed 928-byte region [ffff888040300440, ffff8880403007e0)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888040302a80 pfn:0x40300
head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801cae7dc0 dead000000000122 0000000000000000
raw: ffff888040302a80 00000000800f000b 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801cae7dc0 dead000000000122 0000000000000000
head: ffff888040302a80 00000000800f000b 00000000f5000000 0000000000000000
head: 00fff00000000002 ffffea000100c001 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 7981, tgid 7977 (syz.1.516), ts 145890504879, free_ts 145801949982
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
xfrm_state_alloc+0x24/0x2f0 net/xfrm/xfrm_state.c:733
xfrm_state_construct net/xfrm/xfrm_user.c:889 [inline]
xfrm_add_sa+0x17d1/0x4070 net/xfrm/xfrm_user.c:1019
xfrm_user_rcv_msg+0x7a3/0xab0 net/xfrm/xfrm_user.c:3501
netlink_rcv_skb+0x205/0x470 net/netlink/af_netlink.c:2552
xfrm_netlink_rcv+0x79/0x90 net/xfrm/xfrm_user.c:3523
netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
netlink_unicast+0x82f/0x9e0 net/netlink/af_netlink.c:1346
netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896
sock_sendmsg_nosec net/socket.c:714 [inline]
__sock_sendmsg+0x219/0x270 net/socket.c:729
____sys_sendmsg+0x505/0x830 net/socket.c:2614
page last free pid 7991 tgid 7989 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
discard_slab mm/slub.c:2717 [inline]
__put_partials+0x161/0x1c0 mm/slub.c:3186
put_cpu_partial+0x17c/0x250 mm/slub.c:3261
__slab_free+0x2f7/0x400 mm/slub.c:4513
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]
kmem_cache_alloc_lru_noprof+0x1c6/0x3d0 mm/slub.c:4216
shmem_alloc_inode+0x28/0x40 mm/shmem.c:5150
alloc_inode+0x67/0x1b0 fs/inode.c:346
new_inode+0x22/0x170 fs/inode.c:1145
__shmem_get_inode mm/shmem.c:3049 [inline]
shmem_get_inode+0x346/0xe90 mm/shmem.c:3123
shmem_mknod+0x18c/0x3e0 mm/shmem.c:3844
lookup_open fs/namei.c:3717 [inline]
open_last_lookups fs/namei.c:3816 [inline]
path_openat+0x14f4/0x3830 fs/namei.c:4052
do_filp_open+0x1fa/0x410 fs/namei.c:4082
do_sys_openat2+0x121/0x1c0 fs/open.c:1437
Memory state around the buggy address:
ffff888040300300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888040300380: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888040300400: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
^
ffff888040300480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888040300500: 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 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 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] 4+ messages in thread
* Re: [syzbot] [net?] KASAN: slab-use-after-free Write in __xfrm_state_delete
2025-07-29 7:08 [syzbot] [net?] KASAN: slab-use-after-free Write in __xfrm_state_delete syzbot
@ 2025-08-24 19:21 ` syzbot
2025-08-25 15:59 ` Sabrina Dubroca
2025-08-28 7:25 ` syzbot
1 sibling, 1 reply; 4+ messages in thread
From: syzbot @ 2025-08-24 19:21 UTC (permalink / raw)
To: davem, edumazet, herbert, horms, kuba, linux-kernel, netdev,
pabeni, steffen.klassert, syzkaller-bugs
syzbot has found a reproducer for the following issue on:
HEAD commit: b1c92cdf5af3 Merge branch 'net-wangxun-complete-ethtool-co..
git tree: net-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1411b062580000
kernel config: https://syzkaller.appspot.com/x/.config?x=67b99ceb67d33475
dashboard link: https://syzkaller.appspot.com/bug?extid=a25ee9d20d31e483ba7b
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=14221862580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=159fba34580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a4625f767959/disk-b1c92cdf.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/badbbc9af277/vmlinux-b1c92cdf.xz
kernel image: https://storage.googleapis.com/syzbot-assets/d4420eb2b894/bzImage-b1c92cdf.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+a25ee9d20d31e483ba7b@syzkaller.appspotmail.com
==================================================================
BUG: KASAN: slab-use-after-free in __hlist_del include/linux/list.h:980 [inline]
BUG: KASAN: slab-use-after-free in hlist_del_rcu include/linux/rculist.h:560 [inline]
BUG: KASAN: slab-use-after-free in __xfrm_state_delete+0x666/0xca0 net/xfrm/xfrm_state.c:830
Write of size 8 at addr ffff88802e995568 by task kworker/u8:1/13
CPU: 0 UID: 0 PID: 13 Comm: kworker/u8:1 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Workqueue: netns cleanup_net
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
__hlist_del include/linux/list.h:980 [inline]
hlist_del_rcu include/linux/rculist.h:560 [inline]
__xfrm_state_delete+0x666/0xca0 net/xfrm/xfrm_state.c:830
xfrm_state_delete net/xfrm/xfrm_state.c:856 [inline]
xfrm_state_flush+0x45f/0x770 net/xfrm/xfrm_state.c:939
xfrm6_tunnel_net_exit+0x3c/0x100 net/ipv6/xfrm6_tunnel.c:337
ops_exit_list net/core/net_namespace.c:198 [inline]
ops_undo_list+0x497/0x990 net/core/net_namespace.c:251
cleanup_net+0x4c5/0x800 net/core/net_namespace.c:682
process_one_work kernel/workqueue.c:3236 [inline]
process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3319
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3400
kthread+0x70e/0x8a0 kernel/kthread.c:463
ret_from_fork+0x3f9/0x770 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
Allocated by task 7220:
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
xfrm_state_alloc+0x24/0x2f0 net/xfrm/xfrm_state.c:733
__find_acq_core+0x8a7/0x1c00 net/xfrm/xfrm_state.c:1833
xfrm_find_acq+0x78/0xa0 net/xfrm/xfrm_state.c:2353
xfrm_alloc_userspi+0x6b3/0xc90 net/xfrm/xfrm_user.c:1863
xfrm_user_rcv_msg+0x7a0/0xab0 net/xfrm/xfrm_user.c:3501
netlink_rcv_skb+0x205/0x470 net/netlink/af_netlink.c:2552
xfrm_netlink_rcv+0x79/0x90 net/xfrm/xfrm_user.c:3523
netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
netlink_unicast+0x82c/0x9e0 net/netlink/af_netlink.c:1346
netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896
sock_sendmsg_nosec net/socket.c:714 [inline]
__sock_sendmsg+0x21c/0x270 net/socket.c:729
____sys_sendmsg+0x505/0x830 net/socket.c:2614
___sys_sendmsg+0x21f/0x2a0 net/socket.c:2668
__sys_sendmsg net/socket.c:2700 [inline]
__do_sys_sendmsg net/socket.c:2705 [inline]
__se_sys_sendmsg net/socket.c:2703 [inline]
__x64_sys_sendmsg+0x19b/0x260 net/socket.c:2703
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 121:
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
xfrm_state_free net/xfrm/xfrm_state.c:591 [inline]
xfrm_state_gc_destroy net/xfrm/xfrm_state.c:618 [inline]
xfrm_state_gc_task+0x52d/0x6b0 net/xfrm/xfrm_state.c:634
process_one_work kernel/workqueue.c:3236 [inline]
process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3319
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3400
kthread+0x70e/0x8a0 kernel/kthread.c:463
ret_from_fork+0x3f9/0x770 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
The buggy address belongs to the object at ffff88802e995540
which belongs to the cache xfrm_state of size 928
The buggy address is located 40 bytes inside of
freed 928-byte region [ffff88802e995540, ffff88802e9958e0)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2e994
head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801af8b500 ffffea0000c0bb00 0000000000000004
raw: 0000000000000000 00000000000f000f 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801af8b500 ffffea0000c0bb00 0000000000000004
head: 0000000000000000 00000000000f000f 00000000f5000000 0000000000000000
head: 00fff00000000002 ffffea0000ba6501 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 6643, tgid 6643 (syz.0.607), ts 322721257081, free_ts 315414996241
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
xfrm_state_alloc+0x24/0x2f0 net/xfrm/xfrm_state.c:733
__find_acq_core+0x8a7/0x1c00 net/xfrm/xfrm_state.c:1833
xfrm_find_acq+0x78/0xa0 net/xfrm/xfrm_state.c:2353
xfrm_alloc_userspi+0x6b3/0xc90 net/xfrm/xfrm_user.c:1863
xfrm_user_rcv_msg+0x7a0/0xab0 net/xfrm/xfrm_user.c:3501
netlink_rcv_skb+0x205/0x470 net/netlink/af_netlink.c:2552
xfrm_netlink_rcv+0x79/0x90 net/xfrm/xfrm_user.c:3523
netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
netlink_unicast+0x82c/0x9e0 net/netlink/af_netlink.c:1346
netlink_sendmsg+0x805/0xb30 net/netlink/af_netlink.c:1896
page last free pid 6006 tgid 6006 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
__slab_free+0x303/0x3c0 mm/slub.c:4591
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_lru_noprof+0x1c6/0x3d0 mm/slub.c:4248
sock_alloc_inode+0x28/0xc0 net/socket.c:309
alloc_inode+0x6a/0x1b0 fs/inode.c:346
new_inode_pseudo include/linux/fs.h:3391 [inline]
sock_alloc net/socket.c:624 [inline]
__sock_create+0x12d/0x9f0 net/socket.c:1553
sock_create net/socket.c:1647 [inline]
__sys_socket_create net/socket.c:1684 [inline]
__sys_socket+0xd7/0x1b0 net/socket.c:1731
__do_sys_socket net/socket.c:1745 [inline]
__se_sys_socket net/socket.c:1743 [inline]
__x64_sys_socket+0x7a/0x90 net/socket.c:1743
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:
ffff88802e995400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88802e995480: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88802e995500: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb
^
ffff88802e995580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88802e995600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
---
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [syzbot] [net?] KASAN: slab-use-after-free Write in __xfrm_state_delete
2025-08-24 19:21 ` syzbot
@ 2025-08-25 15:59 ` Sabrina Dubroca
0 siblings, 0 replies; 4+ messages in thread
From: Sabrina Dubroca @ 2025-08-25 15:59 UTC (permalink / raw)
To: syzbot, Aakash Kumar S, steffen.klassert, herbert
Cc: davem, edumazet, horms, kuba, linux-kernel, netdev, pabeni,
syzkaller-bugs
2025-08-24, 12:21:23 -0700, syzbot wrote:
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: b1c92cdf5af3 Merge branch 'net-wangxun-complete-ethtool-co..
> git tree: net-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=1411b062580000
> kernel config: https://syzkaller.appspot.com/x/.config?x=67b99ceb67d33475
> dashboard link: https://syzkaller.appspot.com/bug?extid=a25ee9d20d31e483ba7b
> 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=14221862580000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=159fba34580000
This splat seems to be caused by commit 94f39804d891 ("xfrm: Duplicate
SPI Handling"), which removed the "newspi != 0" check before inserting
the state on the byspi list. But __xfrm_state_delete will only remove
states (in this case, when they expire) from the byspi list if
x->id.spi != 0.
So maybe something like this?
-------- 8< --------
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 78fcbb89cf32..d213ca3653a8 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -2583,6 +2583,8 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high,
for (h = 0; h < range; h++) {
u32 spi = (low == high) ? low : get_random_u32_inclusive(low, high);
+ if (spi == 0)
+ goto next;
newspi = htonl(spi);
spin_lock_bh(&net->xfrm.xfrm_state_lock);
@@ -2598,6 +2600,7 @@ int xfrm_alloc_spi(struct xfrm_state *x, u32 low, u32 high,
xfrm_state_put(x0);
spin_unlock_bh(&net->xfrm.xfrm_state_lock);
+next:
if (signal_pending(current)) {
err = -ERESTARTSYS;
goto unlock;
--
Sabrina
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [syzbot] [net?] KASAN: slab-use-after-free Write in __xfrm_state_delete
2025-07-29 7:08 [syzbot] [net?] KASAN: slab-use-after-free Write in __xfrm_state_delete syzbot
2025-08-24 19:21 ` syzbot
@ 2025-08-28 7:25 ` syzbot
1 sibling, 0 replies; 4+ messages in thread
From: syzbot @ 2025-08-28 7:25 UTC (permalink / raw)
To: davem, eadavis, edumazet, hdanton, herbert, horms, kuba,
linux-kernel, netdev, pabeni, saakashkumar, sd, steffen.klassert,
syzkaller-bugs
syzbot has bisected this issue to:
commit 94f39804d891cffe4ce17737d295f3b195bc7299
Author: Aakash Kumar S <saakashkumar@marvell.com>
Date: Mon Jun 30 12:38:56 2025 +0000
xfrm: Duplicate SPI Handling
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=17d07c42580000
start commit: b1c92cdf5af3 Merge branch 'net-wangxun-complete-ethtool-co..
git tree: net-next
final oops: https://syzkaller.appspot.com/x/report.txt?x=14307c42580000
console output: https://syzkaller.appspot.com/x/log.txt?x=10307c42580000
kernel config: https://syzkaller.appspot.com/x/.config?x=67b99ceb67d33475
dashboard link: https://syzkaller.appspot.com/bug?extid=a25ee9d20d31e483ba7b
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14221862580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=159fba34580000
Reported-by: syzbot+a25ee9d20d31e483ba7b@syzkaller.appspotmail.com
Fixes: 94f39804d891 ("xfrm: Duplicate SPI Handling")
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-28 7:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-29 7:08 [syzbot] [net?] KASAN: slab-use-after-free Write in __xfrm_state_delete syzbot
2025-08-24 19:21 ` syzbot
2025-08-25 15:59 ` Sabrina Dubroca
2025-08-28 7:25 ` syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).