==================================================================
BUG: KASAN: use-after-free in tw_timer_handler+0x8f/0xf0 include/net/net_namespace.h:-1
Read of size 8 at addr ffff888122ea0198 by task syz.8.1451/5435
CPU: 0 PID: 5435 Comm: syz.8.1451 Tainted: G W 5.15.185-syzkaller-00339-ge678c93d43cc #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
<IRQ>
__dump_stack+0x21/0x30 lib/dump_stack.c:88
dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106
print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:427 [inline]
kasan_report+0xf1/0x140 mm/kasan/report.c:444
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report_generic.c:309
tw_timer_handler+0x8f/0xf0 include/net/net_namespace.h:-1
call_timer_fn+0x38/0x290 kernel/time/timer.c:1457
expire_timers kernel/time/timer.c:1502 [inline]
__run_timers+0x639/0x9a0 kernel/time/timer.c:1773
run_timer_softirq+0x6a/0xf0 kernel/time/timer.c:1786
handle_softirqs+0x250/0x560 kernel/softirq.c:583
__do_softirq kernel/softirq.c:621 [inline]
invoke_softirq kernel/softirq.c:443 [inline]
__irq_exit_rcu+0x52/0xf0 kernel/softirq.c:670
irq_exit_rcu+0x9/0x10 kernel/softirq.c:682
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline]
sysvec_apic_timer_interrupt+0xa9/0xc0 arch/x86/kernel/apic/apic.c:1108
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1b/0x20 arch/x86/include/asm/idtentry.h:676
RIP: 0010:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:169 [inline]
RIP: 0010:_raw_spin_unlock_irq+0x49/0x70 kernel/locking/spinlock.c:202
Code: 12 48 89 fb 48 c7 c7 b8 39 6d 86 e8 a1 73 01 fd 48 89 df 48 83 3d ee 94 c7 01 00 74 27 e8 c3 76 a9 fc 66 90 fb bf 01 00 00 00 <e8> c2 5e a1 fc 65 8b 05 a3 c8 5c 7b 85 c0 74 03 5b 5d c3 e8 c3 d1
RSP: 0018:ffffc90001dc73e8 EFLAGS: 00000246
RAX: 0000000000000001 RBX: ffffea0004acc740 RCX: dffffc0000000000
RDX: ffffc900021da000 RSI: ffffffff854b0180 RDI: 0000000000000001
RBP: ffffc90001dc73f0 R08: dffffc0000000000 R09: fffff940009598e9
R10: fffff940009598e9 R11: 1ffffd40009598e8 R12: 0000000000000001
R13: ffffc90001dc7480 R14: 0000000000000cc0 R15: 0000000000000001
spin_unlock_irq include/linux/spinlock.h:413 [inline]
shmem_add_to_page_cache+0x9fc/0xc30 mm/shmem.c:757
shmem_getpage_gfp+0x1164/0x2310 mm/shmem.c:1946
shmem_fault+0x19d/0x510 mm/shmem.c:2124
__do_fault+0x264/0x2f0 mm/memory.c:4191
do_read_fault mm/memory.c:4555 [inline]
do_fault mm/memory.c:4696 [inline]
handle_pte_fault+0x1a57/0x2680 mm/memory.c:4910
__handle_mm_fault mm/memory.c:-1 [inline]
do_handle_mm_fault+0x1a6d/0x1d50 mm/memory.c:5332
handle_mm_fault include/linux/mm.h:1836 [inline]
faultin_page mm/gup.c:976 [inline]
__get_user_pages+0x7ee/0x10a0 mm/gup.c:1197
populate_vma_page_range mm/gup.c:1529 [inline]
__mm_populate+0x319/0x460 mm/gup.c:1638
mm_populate include/linux/mm.h:2693 [inline]
vm_mmap_pgoff+0x247/0x410 mm/util.c:560
ksys_mmap_pgoff+0xf6/0x1d0 mm/mmap.c:1635
__do_sys_mmap arch/x86/kernel/sys_x86_64.c:93 [inline]
__se_sys_mmap arch/x86/kernel/sys_x86_64.c:86 [inline]
__x64_sys_mmap+0xfa/0x110 arch/x86/kernel/sys_x86_64.c:86
x64_sys_call+0x83/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:10
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7fd739c50929
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:00007fd7382b9038 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 00007fd739e77fa0 RCX: 00007fd739c50929
RDX: b635773f06ebbeee RSI: 0000000000b36000 RDI: 0000200000000000
RBP: 00007fd739cd2b39 R08: ffffffffffffffff R09: 0000000000000000
R10: 0000000000008031 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fd739e77fa0 R15: 00007fff0fa58348
</TASK>
Allocated by task 4811:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:45 [inline]
set_alloc_info mm/kasan/common.c:433 [inline]
__kasan_slab_alloc+0xbd/0xf0 mm/kasan/common.c:466
kasan_slab_alloc include/linux/kasan.h:217 [inline]
slab_post_alloc_hook+0x4f/0x2b0 mm/slab.h:550
slab_alloc_node mm/slub.c:3240 [inline]
slab_alloc mm/slub.c:3250 [inline]
kmem_cache_alloc+0xf7/0x260 mm/slub.c:3255
kmem_cache_zalloc include/linux/slab.h:737 [inline]
net_alloc net/core/net_namespace.c:408 [inline]
copy_net_ns+0x145/0x5c0 net/core/net_namespace.c:463
create_new_namespaces+0x3a2/0x660 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0x120/0x170 kernel/nsproxy.c:226
ksys_unshare+0x4ac/0x7b0 kernel/fork.c:3242
__do_sys_unshare kernel/fork.c:3316 [inline]
__se_sys_unshare kernel/fork.c:3314 [inline]
__x64_sys_unshare+0x38/0x40 kernel/fork.c:3314
x64_sys_call+0x442/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:273
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
Freed by task 8:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4a/0x70 mm/kasan/common.c:45
kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
____kasan_slab_free+0x125/0x160 mm/kasan/common.c:365
__kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
kasan_slab_free include/linux/kasan.h:193 [inline]
slab_free_hook mm/slub.c:1723 [inline]
slab_free_freelist_hook+0xc2/0x190 mm/slub.c:1749
slab_free mm/slub.c:3521 [inline]
kmem_cache_free+0x100/0x320 mm/slub.c:3539
net_free net/core/net_namespace.c:437 [inline]
cleanup_net+0xa2d/0xad0 net/core/net_namespace.c:620
process_one_work+0x6be/0xba0 kernel/workqueue.c:2325
worker_thread+0xa59/0x1200 kernel/workqueue.c:2472
kthread+0x411/0x500 kernel/kthread.c:337
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
Last potentially related work creation:
kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38
__kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348
kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
insert_work+0x51/0x310 kernel/workqueue.c:1373
__queue_work+0x8e5/0xc60 kernel/workqueue.c:1539
queue_work_on+0xd2/0x140 kernel/workqueue.c:1566
queue_work include/linux/workqueue.h:510 [inline]
schedule_work include/linux/workqueue.h:571 [inline]
xfrm_hash_grow_check+0xd7/0x140 net/xfrm/xfrm_state.c:1024
xfrm_state_find+0x26a0/0x2a70 net/xfrm/xfrm_state.c:1184
xfrm_tmpl_resolve_one net/xfrm/xfrm_policy.c:2396 [inline]
xfrm_tmpl_resolve net/xfrm/xfrm_policy.c:2441 [inline]
xfrm_resolve_and_create_bundle+0x626/0x28d0 net/xfrm/xfrm_policy.c:2734
xfrm_lookup_with_ifid+0xa3e/0x2120 net/xfrm/xfrm_policy.c:3068
xfrm_lookup net/xfrm/xfrm_policy.c:3197 [inline]
xfrm_lookup_route+0x3c/0x170 net/xfrm/xfrm_policy.c:3208
ip6_dst_lookup_flow+0x9b/0xc0 net/ipv6/ip6_output.c:1238
rawv6_sendmsg+0xc07/0x16d0 net/ipv6/raw.c:933
inet_sendmsg+0xa5/0xc0 net/ipv4/af_inet.c:830
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x5a2/0x8c0 net/socket.c:2436
___sys_sendmsg+0x1f0/0x260 net/socket.c:2490
__sys_sendmmsg+0x278/0x480 net/socket.c:2576
__do_sys_sendmmsg net/socket.c:2605 [inline]
__se_sys_sendmmsg net/socket.c:2602 [inline]
__x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2602
x64_sys_call+0x6c6/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:308
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
Second to last potentially related work creation:
kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38
__kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348
kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
insert_work+0x51/0x310 kernel/workqueue.c:1373
__queue_work+0x8e5/0xc60 kernel/workqueue.c:1539
queue_work_on+0xd2/0x140 kernel/workqueue.c:1566
queue_work include/linux/workqueue.h:510 [inline]
schedule_work include/linux/workqueue.h:571 [inline]
xfrm_hash_grow_check+0xd7/0x140 net/xfrm/xfrm_state.c:1024
xfrm_state_find+0x26a0/0x2a70 net/xfrm/xfrm_state.c:1184
xfrm_tmpl_resolve_one net/xfrm/xfrm_policy.c:2396 [inline]
xfrm_tmpl_resolve net/xfrm/xfrm_policy.c:2441 [inline]
xfrm_resolve_and_create_bundle+0x626/0x28d0 net/xfrm/xfrm_policy.c:2734
xfrm_lookup_with_ifid+0xa3e/0x2120 net/xfrm/xfrm_policy.c:3068
xfrm_lookup net/xfrm/xfrm_policy.c:3197 [inline]
xfrm_lookup_route+0x3c/0x170 net/xfrm/xfrm_policy.c:3208
ip6_dst_lookup_flow+0x9b/0xc0 net/ipv6/ip6_output.c:1238
rawv6_sendmsg+0xc07/0x16d0 net/ipv6/raw.c:933
inet_sendmsg+0xa5/0xc0 net/ipv4/af_inet.c:830
sock_sendmsg_nosec net/socket.c:704 [inline]
__sock_sendmsg net/socket.c:716 [inline]
____sys_sendmsg+0x5a2/0x8c0 net/socket.c:2436
___sys_sendmsg+0x1f0/0x260 net/socket.c:2490
__sys_sendmmsg+0x278/0x480 net/socket.c:2576
__do_sys_sendmmsg net/socket.c:2605 [inline]
__se_sys_sendmmsg net/socket.c:2602 [inline]
__x64_sys_sendmmsg+0xa0/0xb0 net/socket.c:2602
x64_sys_call+0x6c6/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:308
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
The buggy address belongs to the object at ffff888122ea0000
which belongs to the cache net_namespace of size 3968
The buggy address is located 408 bytes inside of
3968-byte region [ffff888122ea0000, ffff888122ea0f80)
The buggy address belongs to the page:
page:ffffea00048ba800 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888122ea2000 pfn:0x122ea0
head:ffffea00048ba800 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 0000000000000000 0000000100000001 ffff8881001c5200
raw: ffff888122ea2000 0000000080080004 00000001ffffffff 0000000000000000
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 281, ts 27522990014, free_ts 0
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0x192/0x1b0 mm/page_alloc.c:2605
prep_new_page+0x1c/0x110 mm/page_alloc.c:2611
get_page_from_freelist+0x2cc5/0x2d50 mm/page_alloc.c:4485
__alloc_pages+0x18f/0x440 mm/page_alloc.c:5789
alloc_slab_page mm/slub.c:-1 [inline]
allocate_slab mm/slub.c:1932 [inline]
new_slab+0xa1/0x4d0 mm/slub.c:1995
___slab_alloc+0x381/0x810 mm/slub.c:3028
__slab_alloc+0x49/0x90 mm/slub.c:3115
slab_alloc_node mm/slub.c:3206 [inline]
slab_alloc mm/slub.c:3250 [inline]
kmem_cache_alloc+0x138/0x260 mm/slub.c:3255
kmem_cache_zalloc include/linux/slab.h:737 [inline]
net_alloc net/core/net_namespace.c:408 [inline]
copy_net_ns+0x145/0x5c0 net/core/net_namespace.c:463
create_new_namespaces+0x3a2/0x660 kernel/nsproxy.c:110
unshare_nsproxy_namespaces+0x120/0x170 kernel/nsproxy.c:226
ksys_unshare+0x4ac/0x7b0 kernel/fork.c:3242
__do_sys_unshare kernel/fork.c:3316 [inline]
__se_sys_unshare kernel/fork.c:3314 [inline]
__x64_sys_unshare+0x38/0x40 kernel/fork.c:3314
x64_sys_call+0x442/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:273
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
page_owner free stack trace missing
Memory state around the buggy address:
ffff888122ea0080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888122ea0100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888122ea0180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888122ea0200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888122ea0280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: 12 48 89 adc -0x77(%rax),%cl
3: fb sti
4: 48 c7 c7 b8 39 6d 86 mov $0xffffffff866d39b8,%rdi
b: e8 a1 73 01 fd call 0xfd0173b1
10: 48 89 df mov %rbx,%rdi
13: 48 83 3d ee 94 c7 01 cmpq $0x0,0x1c794ee(%rip) # 0x1c79509
1a: 00
1b: 74 27 je 0x44
1d: e8 c3 76 a9 fc call 0xfca976e5
22: 66 90 xchg %ax,%ax
24: fb sti
25: bf 01 00 00 00 mov $0x1,%edi
* 2a: e8 c2 5e a1 fc call 0xfca15ef1 <-- trapping instruction
2f: 65 8b 05 a3 c8 5c 7b mov %gs:0x7b5cc8a3(%rip),%eax # 0x7b5cc8d9
36: 85 c0 test %eax,%eax
38: 74 03 je 0x3d
3a: 5b pop %rbx
3b: 5d pop %rbp
3c: c3 ret
3d: e8 .byte 0xe8
3e: c3 ret
3f: d1 .byte 0xd1