[v6.6] KASAN: slab-use-after-free Write in __xfrm_state_delete

10 views
Skip to first unread message

syzbot

unread,
Aug 29, 2025, 5:56:25 AM8/29/25
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: cc1a1c5b404a Linux 6.6.103
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=167d9634580000
kernel config: https://syzkaller.appspot.com/x/.config?x=412020841cf033b0
dashboard link: https://syzkaller.appspot.com/bug?extid=988ee6f15e7c8eec4e9e
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/46c06862a545/disk-cc1a1c5b.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/38ddabb6fc8b/vmlinux-cc1a1c5b.xz
kernel image: https://storage.googleapis.com/syzbot-assets/b130b7d031b5/bzImage-cc1a1c5b.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+988ee6...@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:513 [inline]
BUG: KASAN: slab-use-after-free in __xfrm_state_delete+0x47c/0x800 net/xfrm/xfrm_state.c:753
Write of size 8 at addr ffff88805ea58430 by task syz.2.888/8726

CPU: 1 PID: 8726 Comm: syz.2.888 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
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/0x220 mm/kasan/report.c:468
kasan_report+0x117/0x150 mm/kasan/report.c:581
__hlist_del include/linux/list.h:982 [inline]
hlist_del_rcu include/linux/rculist.h:513 [inline]
__xfrm_state_delete+0x47c/0x800 net/xfrm/xfrm_state.c:753
xfrm_timer_handler+0x1c3/0x9e0 net/xfrm/xfrm_state.c:644
__run_hrtimer kernel/time/hrtimer.c:1755 [inline]
__hrtimer_run_queues+0x51e/0xc40 kernel/time/hrtimer.c:1819
hrtimer_run_softirq+0x187/0x2b0 kernel/time/hrtimer.c:1836
handle_softirqs+0x280/0x820 kernel/softirq.c:578
__do_softirq kernel/softirq.c:612 [inline]
invoke_softirq kernel/softirq.c:452 [inline]
__irq_exit_rcu+0xc7/0x190 kernel/softirq.c:661
irq_exit_rcu+0x9/0x20 kernel/softirq.c:673
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1088 [inline]
sysvec_apic_timer_interrupt+0x56/0xc0 arch/x86/kernel/apic/apic.c:1088
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:687
RIP: 0033:0x7f3914a4d9d0
Code: 41 5e c3 0f 1f 80 00 00 00 00 c3 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 c3 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 <41> 89 fb 44 8d 56 04 4c 8d 0d 22 46 35 00 89 f0 4c 8d 05 19 26 35
RSP: 002b:00007ffeacd7ea48 EFLAGS: 00000246
RAX: 000000000001a1ef RBX: 00007f39158e5720 RCX: 000000000000504c
RDX: ffffffff81e372df RSI: ffffffff81e373db RDI: 0000000000000000
RBP: ffffffff81e373db R08: 00007f3914db6038 R09: 00007f3914da2000
R10: 00007f39145ff008 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: ffffffff81e372df R15: 000000000000504c
</TASK>

Allocated by task 6514:
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
kmem_cache_zalloc include/linux/slab.h:711 [inline]
xfrm_state_alloc+0x22/0x2a0 net/xfrm/xfrm_state.c:661
__find_acq_core+0x7d8/0x19d0 net/xfrm/xfrm_state.c:1598
xfrm_find_acq+0x6a/0x90 net/xfrm/xfrm_state.c:2070
xfrm_alloc_userspi+0x57a/0xa90 net/xfrm/xfrm_user.c:1613
xfrm_user_rcv_msg+0x596/0x870 net/xfrm/xfrm_user.c:3169
netlink_rcv_skb+0x216/0x480 net/netlink/af_netlink.c:2545
xfrm_netlink_rcv+0x79/0x90 net/xfrm/xfrm_user.c:3191
netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
netlink_unicast+0x751/0x8d0 net/netlink/af_netlink.c:1346
netlink_sendmsg+0x8c1/0xbe0 net/netlink/af_netlink.c:1894
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
____sys_sendmsg+0x5bf/0x950 net/socket.c:2595
___sys_sendmsg+0x220/0x290 net/socket.c:2649
__sys_sendmsg net/socket.c:2678 [inline]
__do_sys_sendmsg net/socket.c:2687 [inline]
__se_sys_sendmsg+0x1a5/0x270 net/socket.c:2685
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 ffff88805ea58400
which belongs to the cache xfrm_state of size 848
The buggy address is located 48 bytes inside of
freed 848-byte region [ffff88805ea58400, ffff88805ea58750)

The buggy address belongs to the physical page:
page:ffffea00017a9600 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88805ea58800 pfn:0x5ea58
head:ffffea00017a9600 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff88814565a500 dead000000000122 0000000000000000
raw: ffff88805ea58800 000000008010000d 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x152820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 6438, tgid 6437 (syz.1.226), ts 93617920484, free_ts 93542282256
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
kmem_cache_zalloc include/linux/slab.h:711 [inline]
xfrm_state_alloc+0x22/0x2a0 net/xfrm/xfrm_state.c:661
xfrm_state_construct net/xfrm/xfrm_user.c:689 [inline]
xfrm_add_sa+0xfe5/0x30a0 net/xfrm/xfrm_user.c:799
xfrm_user_rcv_msg+0x596/0x870 net/xfrm/xfrm_user.c:3169
netlink_rcv_skb+0x216/0x480 net/netlink/af_netlink.c:2545
xfrm_netlink_rcv+0x79/0x90 net/xfrm/xfrm_user.c:3191
netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
netlink_unicast+0x751/0x8d0 net/netlink/af_netlink.c:1346
netlink_sendmsg+0x8c1/0xbe0 net/netlink/af_netlink.c:1894
sock_sendmsg_nosec net/socket.c:730 [inline]
__sock_sendmsg net/socket.c:745 [inline]
____sys_sendmsg+0x5bf/0x950 net/socket.c:2595
___sys_sendmsg+0x220/0x290 net/socket.c:2649
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
free_large_kmalloc+0x101/0x1a0 mm/slab_common.c:984
bpf_check+0x62c6/0xe970 kernel/bpf/verifier.c:20555
bpf_prog_load+0x11cb/0x16d0 kernel/bpf/syscall.c:2744
__sys_bpf+0x55a/0x800 kernel/bpf/syscall.c:5467
__do_sys_bpf kernel/bpf/syscall.c:5571 [inline]
__se_sys_bpf kernel/bpf/syscall.c:5569 [inline]
__x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5569
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

Memory state around the buggy address:
ffff88805ea58300: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc
ffff88805ea58380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88805ea58400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88805ea58480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88805ea58500: 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 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

syzbot

unread,
Sep 8, 2025, 1:29:27 PM9/8/25
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 355bd0b51d2f Linux 6.6.104
git tree: linux-6.6.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1652a562580000
kernel config: https://syzkaller.appspot.com/x/.config?x=dac93b93d3de2741
dashboard link: https://syzkaller.appspot.com/bug?extid=988ee6f15e7c8eec4e9e
compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11a60562580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ef00d28b2c5b/disk-355bd0b5.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/7627cd51eb0a/vmlinux-355bd0b5.xz
kernel image: https://storage.googleapis.com/syzbot-assets/3fdd0a51dd65/bzImage-355bd0b5.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+988ee6...@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:513 [inline]
BUG: KASAN: slab-use-after-free in __xfrm_state_delete+0x454/0x800 net/xfrm/xfrm_state.c:753
Write of size 8 at addr ffff88807893d828 by task kworker/u4:9/2951

CPU: 0 PID: 2951 Comm: kworker/u4:9 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025
Workqueue: netns cleanup_net

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/0x220 mm/kasan/report.c:468
kasan_report+0x117/0x150 mm/kasan/report.c:581
__hlist_del include/linux/list.h:980 [inline]
hlist_del_rcu include/linux/rculist.h:513 [inline]
__xfrm_state_delete+0x454/0x800 net/xfrm/xfrm_state.c:753
xfrm_state_delete net/xfrm/xfrm_state.c:776 [inline]
xfrm_state_flush+0x454/0x830 net/xfrm/xfrm_state.c:859
xfrm6_tunnel_net_exit+0x46/0x100 net/ipv6/xfrm6_tunnel.c:338
ops_exit_list net/core/net_namespace.c:173 [inline]
cleanup_net+0x6f4/0xb90 net/core/net_namespace.c:652
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 14634:
Freed by task 2951:
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
__xfrm_state_destroy net/xfrm/xfrm_state.c:729 [inline]
xfrm_state_put_sync include/net/xfrm.h:828 [inline]
xfrm_state_flush+0x50e/0x830 net/xfrm/xfrm_state.c:863
xfrm6_tunnel_net_exit+0x46/0x100 net/ipv6/xfrm6_tunnel.c:338
ops_exit_list net/core/net_namespace.c:173 [inline]
cleanup_net+0x6f4/0xb90 net/core/net_namespace.c:652
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

The buggy address belongs to the object at ffff88807893d800
which belongs to the cache xfrm_state of size 848
The buggy address is located 40 bytes inside of
freed 848-byte region [ffff88807893d800, ffff88807893db50)

The buggy address belongs to the physical page:
page:ffffea0001e24f00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7893c
head:ffffea0001e24f00 order:2 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888017ef2dc0 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x152820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 12323, tgid 12322 (syz.0.3062), ts 336327632154, free_ts 328668073386
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
kmem_cache_zalloc include/linux/slab.h:711 [inline]
xfrm_state_alloc+0x22/0x2a0 net/xfrm/xfrm_state.c:661
__find_acq_core+0x7d8/0x19d0 net/xfrm/xfrm_state.c:1598
xfrm_find_acq+0x6a/0x90 net/xfrm/xfrm_state.c:2070
xfrm_alloc_userspi+0x57a/0xa90 net/xfrm/xfrm_user.c:1613
xfrm_user_rcv_msg+0x596/0x870 net/xfrm/xfrm_user.c:3169
netlink_rcv_skb+0x216/0x480 net/netlink/af_netlink.c:2545
xfrm_netlink_rcv+0x79/0x90 net/xfrm/xfrm_user.c:3191
netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
netlink_unicast+0x751/0x8d0 net/netlink/af_netlink.c:1346
netlink_sendmsg+0x8c1/0xbe0 net/netlink/af_netlink.c:1894
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
getname_flags+0xbb/0x500 fs/namei.c:140
vfs_fstatat+0x111/0x1b0 fs/stat.c:298
__do_sys_newfstatat fs/stat.c:463 [inline]
__se_sys_newfstatat fs/stat.c:457 [inline]
__x64_sys_newfstatat+0x117/0x190 fs/stat.c:457
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

Memory state around the buggy address:
ffff88807893d700: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc
ffff88807893d780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88807893d800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88807893d880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88807893d900: 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.
Reply all
Reply to author
Forward
0 new messages