==================================================================
BUG: KASAN: out-of-bounds in __cpa_addr arch/x86/mm/pat/set_memory.c:309 [inline]
BUG: KASAN: out-of-bounds in __cpa_flush_tlb+0x15c/0x270 arch/x86/mm/pat/set_memory.c:408
Read of size 8 at addr ffffc90003b3fc40 by task syz.3.124/6571
CPU: 0 UID: 0 PID: 6571 Comm: syz.3.124 Not tainted 6.16.0-rc4-next-20250630-syzkaller #0 PREEMPT(full)
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:408 [inline]
print_report+0xd2/0x2b0 mm/kasan/report.c:521
kasan_report+0x118/0x150 mm/kasan/report.c:634
__cpa_addr arch/x86/mm/pat/set_memory.c:309 [inline]
__cpa_flush_tlb+0x15c/0x270 arch/x86/mm/pat/set_memory.c:408
csd_do_func kernel/smp.c:134 [inline]
__flush_smp_call_function_queue+0x370/0xaa0 kernel/smp.c:540
__sysvec_call_function_single+0xa8/0x3d0 arch/x86/kernel/smp.c:271
instr_sysvec_call_function_single arch/x86/kernel/smp.c:266 [inline]
sysvec_call_function_single+0x9e/0xc0 arch/x86/kernel/smp.c:266
asm_sysvec_call_function_single+0x1a/0x20 arch/x86/include/asm/idtentry.h:709
RIP: 0010:__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:152 [inline]
RIP: 0010:_raw_spin_unlock_irqrestore+0xa8/0x110 kernel/locking/spinlock.c:194
Code: 74 05 e8 2b 32 55 f6 48 c7 44 24 20 00 00 00 00 9c 8f 44 24 20 f6 44 24 21 02 75 4f f7 c3 00 02 00 00 74 01 fb bf 01 00 00 00 d3 0b 1e f6 65 8b 05 0c 04 2e 07 85 c0 74 40 48 c7 04 24 0e 36
RSP: 0018:ffffc9000217f5e0 EFLAGS: 00000206
RAX: 91bb3d079bf7c200 RBX: 0000000000000a02 RCX: 91bb3d079bf7c200
RDX: 0000000000000006 RSI: ffffffff8d992cd0 RDI: 0000000000000001
RBP: ffffc9000217f670 R08: ffffffff8fa17437 R09: 1ffffffff1f42e86
R10: dffffc0000000000 R11: fffffbfff1f42e87 R12: dffffc0000000000
R13: ffff8880793bb080 R14: ffff8880793bb040 R15: 1ffff9200042febc
spin_unlock_irqrestore include/linux/spinlock.h:406 [inline]
__wake_up_common_lock+0x190/0x1f0 kernel/sched/wait.c:127
__unix_dgram_recvmsg+0x49f/0xde0 net/unix/af_unix.c:2536
sock_recvmsg_nosec+0x183/0x1c0 net/socket.c:1065
____sys_recvmsg+0x3aa/0x460 net/socket.c:2832
___sys_recvmsg+0x1b5/0x510 net/socket.c:2876
do_recvmmsg+0x307/0x770 net/socket.c:2971
__sys_recvmmsg net/socket.c:3045 [inline]
__do_sys_recvmmsg net/socket.c:3068 [inline]
__se_sys_recvmmsg net/socket.c:3061 [inline]
__x64_sys_recvmmsg+0x190/0x240 net/socket.c:3061
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:0x7f23d998e929
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:00007f23da885038 EFLAGS: 00000246 ORIG_RAX: 000000000000012b
RAX: ffffffffffffffda RBX: 00007f23d9bb6080 RCX: 00007f23d998e929
RDX: 0000000000010106 RSI: 00002000000000c0 RDI: 0000000000000005
RBP: 00007f23d9a10b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000002 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f23d9bb6080 R15: 00007ffd0eef6c58
The buggy address belongs to the virtual mapping at
[ffffc90003b38000, ffffc90003b41000) created by:
copy_process+0x54b/0x3c00 kernel/fork.c:1998
The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x51fb8
memcg:ffff888024e79002
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff ffff888024e79002
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2dc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_ZERO|__GFP_NOWARN), pid 2, tgid 2 (kthreadd), ts 129207785365, free_ts 128867902288
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1848
prep_new_page mm/page_alloc.c:1856 [inline]
get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3855
__alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5145
alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2419
alloc_frozen_pages_noprof mm/mempolicy.c:2490 [inline]
alloc_pages_noprof+0xa9/0x190 mm/mempolicy.c:2510
vm_area_alloc_pages mm/vmalloc.c:3642 [inline]
__vmalloc_area_node mm/vmalloc.c:3720 [inline]
__vmalloc_node_range_noprof+0x97d/0x12f0 mm/vmalloc.c:3893
__vmalloc_node_noprof+0xc2/0x110 mm/vmalloc.c:3956
alloc_thread_stack_node kernel/fork.c:310 [inline]
dup_task_struct+0x3e7/0x860 kernel/fork.c:876
copy_process+0x54b/0x3c00 kernel/fork.c:1998
kernel_clone+0x21e/0x870 kernel/fork.c:2598
kernel_thread+0x10c/0x160 kernel/fork.c:2660
create_kthread kernel/kthread.c:486 [inline]
kthreadd+0x575/0x770 kernel/kthread.c:846
ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
page last free pid 5834 tgid 5834 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1392 [inline]
__free_frozen_pages+0xb80/0xd80 mm/page_alloc.c:2892
vfree+0x25a/0x400 mm/vmalloc.c:3434
bch2_fs_btree_write_buffer_exit+0x179/0x1e0 fs/bcachefs/btree_write_buffer.c:870
__bch2_fs_free fs/bcachefs/super.c:615 [inline]
bch2_fs_release+0x297/0x830 fs/bcachefs/super.c:667
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x22b/0x480 lib/kobject.c:737
deactivate_locked_super+0xbc/0x130 fs/super.c:474
cleanup_mnt+0x425/0x4c0 fs/namespace.c:1417
task_work_run+0x1d1/0x260 kernel/task_work.c:227
resume_user_mode_work include/linux/resume_user_mode.h:50 [inline]
exit_to_user_mode_loop+0xec/0x110 kernel/entry/common.c:114
exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline]
syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline]
syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline]
do_syscall_64+0x2bd/0x3b0 arch/x86/entry/syscall_64.c:100
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffffc90003b3fb00: 00 00 00 00 00 f3 f3 f3 f3 f3 f3 f3 f3 f3 f3 f3
ffffc90003b3fb80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffffc90003b3fc00: f1 f1 f1 f1 00 00 00 00 00 00 00 00 00 f3 f3 f3
^
ffffc90003b3fc80: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
ffffc90003b3fd00: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 04 f3 f3 f3
==================================================================
----------------
Code disassembly (best guess):
0: 74 05 je 0x7
2: e8 2b 32 55 f6 call 0xf6553232
7: 48 c7 44 24 20 00 00 movq $0x0,0x20(%rsp)
e: 00 00
10: 9c pushf
11: 8f 44 24 20 pop 0x20(%rsp)
15: f6 44 24 21 02 testb $0x2,0x21(%rsp)
1a: 75 4f jne 0x6b
1c: f7 c3 00 02 00 00 test $0x200,%ebx
22: 74 01 je 0x25
24: fb sti
25: bf 01 00 00 00 mov $0x1,%edi
* 2a: e8 d3 0b 1e f6 call 0xf61e0c02 <-- trapping instruction
2f: 65 8b 05 0c 04 2e 07 mov %gs:0x72e040c(%rip),%eax # 0x72e0442
36: 85 c0 test %eax,%eax
38: 74 40 je 0x7a
3a: 48 rex.W
3b: c7 .byte 0xc7
3c: 04 24 add $0x24,%al
3e: 0e (bad)
3f: 36 ss