==================================================================
BUG: KASAN: use-after-free in tw_timer_handler+0x8f/0xf0 include/net/net_namespace.h:-1
Read of size 8 at addr ffff888122fba198 by task syz.9.266/1369
CPU: 0 PID: 1369 Comm: syz.9.266 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:memset+0xf/0x40 mm/kasan/shadow.c:43
Code: f6 48 8b 4d 08 ba 01 00 00 00 e8 9c ed ff ff 5d c3 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 57 41 56 53 48 89 d3 41 89 f6 <49> 89 ff 48 8b 4d 08 48 89 d6 ba 01 00 00 00 e8 6d ed ff ff 84 c0
RSP: 0018:ffffc90000bf7980 EFLAGS: 00000246
RAX: 0000000000000000 RBX: 000000000000000d RCX: ffff8881339ee2c0
RDX: 000000000000000d RSI: 0000000000000000 RDI: ffffc90000bf7d33
RBP: ffffc90000bf7998 R08: 0000000000000000 R09: ffffc90000bf7d30
R10: fffff5200017ef63 R11: 1ffff9200017ef5c R12: 0000000000000000
R13: dffffc0000000000 R14: 0000000000000000 R15: ffffc90000bf7b40
iov_iter_init lib/iov_iter.c:515 [inline]
__import_iovec+0x2e7/0x400 lib/iov_iter.c:1976
import_iovec+0x7c/0xb0 lib/iov_iter.c:2010
copy_msghdr_from_user net/socket.c:2374 [inline]
recvmsg_copy_msghdr net/socket.c:2621 [inline]
___sys_recvmsg+0x420/0x4f0 net/socket.c:2693
do_recvmmsg+0x344/0x780 net/socket.c:2791
__sys_recvmmsg net/socket.c:2870 [inline]
__do_sys_recvmmsg net/socket.c:2893 [inline]
__se_sys_recvmmsg net/socket.c:2886 [inline]
__x64_sys_recvmmsg+0x18d/0x240 net/socket.c:2886
x64_sys_call+0x297/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:300
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:0x7f27b9c90929
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:00007f27b82d8038 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 00007f27b9eb8080 RCX: 00007f27b9c90929
RDX: 03fffffffffffeda RSI: 00002000000000c0 RDI: 0000000000000005
RBP: 00007f27b9d12b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000001 R14: 00007f27b9eb8080 R15: 00007fff0d388d58
</TASK>
Allocated by task 282:
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 45:
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
The buggy address belongs to the object at ffff888122fba000
which belongs to the cache net_namespace of size 3968
The buggy address is located 408 bytes inside of
3968-byte region [ffff888122fba000, ffff888122fbaf80)
The buggy address belongs to the page:
page:ffffea00048bee00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x122fb8
head:ffffea00048bee00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 0000000000000000 0000000100000001 ffff8881001c5380
raw: 0000000000000000 0000000080080008 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 282, ts 26625663123, 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:
ffff888122fba080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888122fba100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888122fba180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888122fba200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888122fba280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
----------------
Code disassembly (best guess):
0: f6 48 8b 4d testb $0x4d,-0x75(%rax)
4: 08 ba 01 00 00 00 or %bh,0x1(%rdx)
a: e8 9c ed ff ff call 0xffffedab
f: 5d pop %rbp
10: c3 ret
11: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1)
18: 00 00 00
1b: 55 push %rbp
1c: 48 89 e5 mov %rsp,%rbp
1f: 41 57 push %r15
21: 41 56 push %r14
23: 53 push %rbx
24: 48 89 d3 mov %rdx,%rbx
27: 41 89 f6 mov %esi,%r14d
* 2a: 49 89 ff mov %rdi,%r15 <-- trapping instruction
2d: 48 8b 4d 08 mov 0x8(%rbp),%rcx
31: 48 89 d6 mov %rdx,%rsi
34: ba 01 00 00 00 mov $0x1,%edx
39: e8 6d ed ff ff call 0xffffedab
3e: 84 c0 test %al,%al