Kernel bug: KASAN: slab-out-of-bounds Read in __cpa_addr
Subsystem: kernel
Status: fixed

Crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in __cpa_addr arch/x86/mm/pat/set_memory.c:309 [inline]
BUG: KASAN: slab-out-of-bounds in __cpa_addr+0x1d3/0x220 arch/x86/mm/pat/set_memory.c:306
Read of size 8 at addr ffff88807252c888 by task syz.0.17/6007

CPU: 1 UID: 0 PID: 6007 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0xcd/0x630 mm/kasan/report.c:482
 kasan_report+0xe0/0x110 mm/kasan/report.c:595
 __cpa_addr arch/x86/mm/pat/set_memory.c:309 [inline]
 __cpa_addr+0x1d3/0x220 arch/x86/mm/pat/set_memory.c:306
 cpa_flush+0x28b/0x8a0 arch/x86/mm/pat/set_memory.c:449
 change_page_attr_set_clr+0x34e/0x4a0 arch/x86/mm/pat/set_memory.c:2115
 cpa_set_pages_array arch/x86/mm/pat/set_memory.c:2137 [inline]
 _set_pages_array+0x1ab/0x2c0 arch/x86/mm/pat/set_memory.c:2521
 drm_gem_shmem_get_pages_locked+0x384/0x490 drivers/gpu/drm/drm_gem_shmem_helper.c:214
 drm_gem_shmem_mmap drivers/gpu/drm/drm_gem_shmem_helper.c:646 [inline]
 drm_gem_shmem_mmap+0xc9/0x550 drivers/gpu/drm/drm_gem_shmem_helper.c:620
 drm_gem_mmap_obj+0x1b5/0x560 drivers/gpu/drm/drm_gem.c:1167
 drm_gem_mmap+0x40b/0x620 drivers/gpu/drm/drm_gem.c:1245
 vfs_mmap include/linux/fs.h:2404 [inline]
 mmap_file mm/internal.h:167 [inline]
 __mmap_new_file_vma mm/vma.c:2413 [inline]
 __mmap_new_vma mm/vma.c:2476 [inline]
 __mmap_region+0x1306/0x27a0 mm/vma.c:2670
 mmap_region+0x32b/0x3f0 mm/vma.c:2740
 do_mmap+0xa3e/0x1210 mm/mmap.c:558
 vm_mmap_pgoff+0x29e/0x470 mm/util.c:580
 ksys_mmap_pgoff+0x32c/0x5c0 mm/mmap.c:604
 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:89 [inline]
 __se_sys_mmap arch/x86/kernel/sys_x86_64.c:82 [inline]
 __x64_sys_mmap+0x125/0x190 arch/x86/kernel/sys_x86_64.c:82
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fdbfd38eec9
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:00007fff17fc13d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000009
RAX: ffffffffffffffda RBX: 00007fdbfd5e5fa0 RCX: 00007fdbfd38eec9
RDX: 0000000000000004 RSI: 0000000000004000 RDI: 0000200000001000
RBP: 00007fdbfd411f91 R08: 0000000000000003 R09: 0000000100000000
R10: 0000000000000011 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fdbfd5e5fa0 R14: 00007fdbfd5e5fa0 R15: 0000000000000006
 </TASK>

Allocated by task 6007:
 kasan_save_stack+0x33/0x60 mm/kasan/common.c:56
 kasan_save_track+0x14/0x30 mm/kasan/common.c:77
 poison_kmalloc_redzone mm/kasan/common.c:400 [inline]
 __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:417
 kasan_kmalloc include/linux/kasan.h:262 [inline]
 __do_kmalloc_node mm/slub.c:5603 [inline]
 __kvmalloc_node_noprof+0x3a3/0x9c0 mm/slub.c:7036
 kvmalloc_array_node_noprof include/linux/slab.h:1122 [inline]
 drm_gem_get_pages+0x144/0xa10 drivers/gpu/drm/drm_gem.c:647
 drm_gem_shmem_get_pages_locked+0x1e6/0x490 drivers/gpu/drm/drm_gem_shmem_helper.c:200
 drm_gem_shmem_mmap drivers/gpu/drm/drm_gem_shmem_helper.c:646 [inline]
 drm_gem_shmem_mmap+0xc9/0x550 drivers/gpu/drm/drm_gem_shmem_helper.c:620
 drm_gem_mmap_obj+0x1b5/0x560 drivers/gpu/drm/drm_gem.c:1167
 drm_gem_mmap+0x40b/0x620 drivers/gpu/drm/drm_gem.c:1245
 vfs_mmap include/linux/fs.h:2404 [inline]
 mmap_file mm/internal.h:167 [inline]
 __mmap_new_file_vma mm/vma.c:2413 [inline]
 __mmap_new_vma mm/vma.c:2476 [inline]
 __mmap_region+0x1306/0x27a0 mm/vma.c:2670
 mmap_region+0x32b/0x3f0 mm/vma.c:2740
 do_mmap+0xa3e/0x1210 mm/mmap.c:558
 vm_mmap_pgoff+0x29e/0x470 mm/util.c:580
 ksys_mmap_pgoff+0x32c/0x5c0 mm/mmap.c:604
 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:89 [inline]
 __se_sys_mmap arch/x86/kernel/sys_x86_64.c:82 [inline]
 __x64_sys_mmap+0x125/0x190 arch/x86/kernel/sys_x86_64.c:82
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88807252c800
 which belongs to the cache kmalloc-192 of size 192
The buggy address is located 0 bytes to the right of
 allocated 136-byte region [ffff88807252c800, ffff88807252c888)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7252c
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000000 ffff88801b0263c0 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x252800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_THISNODE), pid 5934, tgid 5934 (syz-executor), ts 75996274955, free_ts 75996254683
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1c0/0x230 mm/page_alloc.c:1850
 prep_new_page mm/page_alloc.c:1858 [inline]
 get_page_from_freelist+0x10a3/0x3a30 mm/page_alloc.c:3884
 __alloc_frozen_pages_noprof+0x25f/0x2470 mm/page_alloc.c:5183
 alloc_slab_page mm/slub.c:3032 [inline]
 allocate_slab mm/slub.c:3203 [inline]
 new_slab+0xa5/0x360 mm/slub.c:3257
 ___slab_alloc+0xdc4/0x1ae0 mm/slub.c:4627
 __slab_alloc.constprop.0+0x63/0x110 mm/slub.c:4746
 __slab_alloc_node mm/slub.c:4822 [inline]
 slab_alloc_node mm/slub.c:5233 [inline]
 __do_kmalloc_node mm/slub.c:5602 [inline]
 __kmalloc_node_noprof+0x4dd/0x8a0 mm/slub.c:5609
 kmalloc_array_node_noprof include/linux/slab.h:1075 [inline]
 alloc_slab_obj_exts+0x3a/0xd0 mm/slub.c:2115
 account_slab mm/slub.c:3157 [inline]
 allocate_slab mm/slub.c:3222 [inline]
 new_slab+0x283/0x360 mm/slub.c:3257
 ___slab_alloc+0xdc4/0x1ae0 mm/slub.c:4627
 __slab_alloc.constprop.0+0x63/0x110 mm/slub.c:4746
 __slab_alloc_node mm/slub.c:4822 [inline]
 slab_alloc_node mm/slub.c:5233 [inline]
 kmem_cache_alloc_lru_noprof+0x443/0x6e0 mm/slub.c:5264
 __d_alloc+0x32/0xae0 fs/dcache.c:1690
 d_alloc_parallel+0x111/0x1480 fs/dcache.c:2549
 __lookup_slow+0x193/0x460 fs/namei.c:1801
 lookup_noperm+0xe1/0x110 fs/namei.c:3001
page last free pid 5934 tgid 5934 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1394 [inline]
 __free_frozen_pages+0x7df/0x1160 mm/page_alloc.c:2906
 selinux_genfs_get_sid security/selinux/hooks.c:1357 [inline]
 inode_doinit_with_dentry+0xacb/0x12e0 security/selinux/hooks.c:1555
 selinux_d_instantiate+0x26/0x30 security/selinux/hooks.c:6523
 security_d_instantiate+0x142/0x1a0 security/security.c:4148
 d_instantiate+0x5c/0x90 fs/dcache.c:1961
 __debugfs_create_file+0x286/0x6b0 fs/debugfs/inode.c:459
 debugfs_create_file_short+0x41/0x60 fs/debugfs/inode.c:480
 add_common_files net/mac80211/debugfs_netdev.c:832 [inline]
 add_files net/mac80211/debugfs_netdev.c:945 [inline]
 ieee80211_debugfs_add_netdev net/mac80211/debugfs_netdev.c:1009 [inline]
 ieee80211_debugfs_recreate_netdev+0x631/0x17e0 net/mac80211/debugfs_netdev.c:1033
 ieee80211_if_change_type+0x2ba/0x800 net/mac80211/iface.c:2008
 ieee80211_change_iface+0xa5/0x500 net/mac80211/cfg.c:254
 rdev_change_virtual_intf net/wireless/rdev-ops.h:74 [inline]
 cfg80211_change_iface+0x582/0xdc0 net/wireless/util.c:1238
 nl80211_set_interface+0x911/0xcb0 net/wireless/nl80211.c:4633
 genl_family_rcv_msg_doit+0x206/0x2f0 net/netlink/genetlink.c:1115
 genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
 genl_rcv_msg+0x55c/0x800 net/netlink/genetlink.c:1210
 netlink_rcv_skb+0x155/0x420 net/netlink/af_netlink.c:2552
 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219

Memory state around the buggy address:
 ffff88807252c780: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
 ffff88807252c800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88807252c880: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                      ^
 ffff88807252c900: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88807252c980: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc
==================================================================