================================================================== BUG: KASAN: use-after-free in cleancache_fs_enabled_mapping include/linux/cleancache.h:56 [inline] BUG: KASAN: use-after-free in cleancache_invalidate_page include/linux/cleancache.h:110 [inline] BUG: KASAN: use-after-free in unaccount_page_cache_page+0x99f/0xa80 mm/filemap.c:175 Read of size 4 at addr ffff888114fd9470 by task syz.0.4039/15180 CPU: 1 PID: 15180 Comm: syz.0.4039 Not tainted 5.10.232-syzkaller-00746-g49e8ba0a684f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:452 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 cleancache_fs_enabled_mapping include/linux/cleancache.h:56 [inline] cleancache_invalidate_page include/linux/cleancache.h:110 [inline] unaccount_page_cache_page+0x99f/0xa80 mm/filemap.c:175 __delete_from_page_cache+0xd0/0x5d0 mm/filemap.c:243 __remove_mapping+0x567/0x690 mm/vmscan.c:978 shrink_page_list+0x1f38/0x4c60 mm/vmscan.c:1491 shrink_inactive_list+0x591/0x1150 mm/vmscan.c:2068 shrink_list mm/vmscan.c:2287 [inline] shrink_lruvec+0xced/0x3860 mm/vmscan.c:5466 shrink_node_memcgs mm/vmscan.c:5653 [inline] shrink_node+0xded/0x2000 mm/vmscan.c:5683 shrink_zones mm/vmscan.c:5889 [inline] do_try_to_free_pages+0x652/0x1630 mm/vmscan.c:5947 try_to_free_mem_cgroup_pages+0x369/0x830 mm/vmscan.c:6265 try_charge+0x4b8/0x15f0 mm/memcontrol.c:2742 __mem_cgroup_charge+0x147/0x6e0 mm/memcontrol.c:6868 mem_cgroup_charge include/linux/memcontrol.h:458 [inline] shmem_add_to_page_cache+0x6a9/0x10c0 mm/shmem.c:699 shmem_getpage_gfp+0xa65/0x2480 mm/shmem.c:1952 shmem_getpage mm/shmem.c:161 [inline] shmem_write_begin+0xca/0x1b0 mm/shmem.c:2497 generic_perform_write+0x2cd/0x570 mm/filemap.c:3509 __generic_file_write_iter+0x23c/0x560 mm/filemap.c:3638 generic_file_write_iter+0xaf/0x1c0 mm/filemap.c:3670 __kernel_write+0x5ab/0x9d0 fs/read_write.c:550 dump_emit+0x261/0x3a0 fs/coredump.c:849 dump_user_range+0x71/0x1a0 fs/coredump.c:902 elf_core_dump+0x33bd/0x3c10 fs/binfmt_elf.c:2290 do_coredump+0x1eb8/0x2d60 fs/coredump.c:811 get_signal+0x102c/0x1410 kernel/signal.c:2779 arch_do_signal_or_restart+0xbd/0x17c0 arch/x86/kernel/signal.c:805 handle_signal_work kernel/entry/common.c:145 [inline] exit_to_user_mode_loop+0x9b/0xd0 kernel/entry/common.c:169 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline] irqentry_exit_to_user_mode+0x4e/0x80 kernel/entry/common.c:287 irqentry_exit+0x12/0x60 kernel/entry/common.c:375 exc_page_fault+0x33d/0x5b0 arch/x86/mm/fault.c:1487 asm_exc_page_fault+0x1e/0x30 arch/x86/include/asm/idtentry.h:571 RIP: 0033:0x20000242 Code: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 50 <4c> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 RSP: 002b:00000000200000d0 EFLAGS: 00010217 RAX: 0000000000000000 RBX: 00007fe13a57e080 RCX: 00007fe13a38dd29 RDX: 0000000020000100 RSI: 00000000200000d0 RDI: 0000000000000080 RBP: 00007fe13a409b08 R08: 0000000020000980 R09: 0000000020000980 R10: 0000000020000180 R11: 0000000000000202 R12: 0000000000000000 R13: 0000000000000001 R14: 00007fe13a57e080 R15: 00007ffd8a96cac8 Allocated by task 0: (stack is not available) The buggy address belongs to the object at ffff888114fd9400 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 112 bytes inside of 512-byte region [ffff888114fd9400, ffff888114fd9600) The buggy address belongs to the page: page:ffffea000453f600 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888114fdbc00 pfn:0x114fd8 head:ffffea000453f600 order:2 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head) raw: 4000000000010200 ffffea0004950208 ffffea000453f708 ffff888100043080 raw: ffff888114fdbc00 0000000000100004 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 14061, ts 484653644366, free_ts 484369851565 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2456 [inline] prep_new_page+0x166/0x180 mm/page_alloc.c:2462 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348 allocate_slab mm/slub.c:1808 [inline] new_slab+0x80/0x400 mm/slub.c:1869 new_slab_objects mm/slub.c:2627 [inline] ___slab_alloc+0x302/0x4b0 mm/slub.c:2791 __slab_alloc+0x63/0xa0 mm/slub.c:2831 slab_alloc_node mm/slub.c:2913 [inline] slab_alloc mm/slub.c:2955 [inline] __kmalloc_track_caller+0x1f8/0x320 mm/slub.c:4536 __kmalloc_reserve net/core/skbuff.c:144 [inline] __alloc_skb+0xbc/0x510 net/core/skbuff.c:212 alloc_skb include/linux/skbuff.h:1126 [inline] nlmsg_new include/net/netlink.h:953 [inline] netlink_ack+0x33c/0xb30 net/netlink/af_netlink.c:2420 netlink_rcv_skb+0x24c/0x410 net/netlink/af_netlink.c:2491 rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:5625 netlink_unicast_kernel net/netlink/af_netlink.c:1307 [inline] netlink_unicast+0x8df/0xac0 net/netlink/af_netlink.c:1333 netlink_sendmsg+0xa46/0xd00 net/netlink/af_netlink.c:1901 sock_sendmsg_nosec net/socket.c:652 [inline] __sock_sendmsg net/socket.c:664 [inline] __sys_sendto+0x545/0x700 net/socket.c:2006 __do_sys_sendto net/socket.c:2018 [inline] __se_sys_sendto net/socket.c:2014 [inline] __x64_sys_sendto+0xe5/0x100 net/socket.c:2014 do_syscall_64+0x34/0x70 page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1349 [inline] free_pcp_prepare mm/page_alloc.c:1421 [inline] free_unref_page_prepare+0x2ae/0x2d0 mm/page_alloc.c:3336 free_unref_page mm/page_alloc.c:3391 [inline] free_the_page+0x9e/0x370 mm/page_alloc.c:5407 __free_pages+0x67/0xc0 mm/page_alloc.c:5418 __vunmap+0x7bc/0x8f0 mm/vmalloc.c:2301 __vfree mm/vmalloc.c:2349 [inline] vfree+0x5c/0x80 mm/vmalloc.c:2380 kcov_put kernel/kcov.c:408 [inline] kcov_close+0x2b/0x50 kernel/kcov.c:510 __fput+0x33d/0x7b0 fs/file_table.c:281 ____fput+0x15/0x20 fs/file_table.c:314 task_work_run+0x129/0x190 kernel/task_work.c:189 exit_task_work include/linux/task_work.h:33 [inline] do_exit+0xc83/0x2a50 kernel/exit.c:863 do_group_exit+0x141/0x310 kernel/exit.c:985 get_signal+0x10a0/0x1410 kernel/signal.c:2793 arch_do_signal_or_restart+0xbd/0x17c0 arch/x86/kernel/signal.c:805 handle_signal_work kernel/entry/common.c:145 [inline] exit_to_user_mode_loop+0x9b/0xd0 kernel/entry/common.c:169 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline] syscall_exit_to_user_mode+0xa2/0x1a0 kernel/entry/common.c:274 do_syscall_64+0x40/0x70 arch/x86/entry/common.c:56 Memory state around the buggy address: ffff888114fd9300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888114fd9380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888114fd9400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888114fd9480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888114fd9500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== syz.0.4039 invoked oom-killer: gfp_mask=0xcc0(GFP_KERNEL), order=0, oom_score_adj=1000 CPU: 1 PID: 15180 Comm: syz.0.4039 Tainted: G B 5.10.232-syzkaller-00746-g49e8ba0a684f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 dump_stack+0x15/0x17 lib/dump_stack.c:135 dump_header+0xd8/0x6d0 mm/oom_kill.c:502 oom_kill_process+0xef/0x2d0 mm/oom_kill.c:1032 out_of_memory+0x9bd/0xe10 mm/oom_kill.c:1175 mem_cgroup_out_of_memory+0x2a8/0x380 mm/memcontrol.c:1733 mem_cgroup_oom mm/memcontrol.c:1968 [inline] try_charge+0xff2/0x15f0 mm/memcontrol.c:2793 __mem_cgroup_charge+0x147/0x6e0 mm/memcontrol.c:6868 mem_cgroup_charge include/linux/memcontrol.h:458 [inline] shmem_add_to_page_cache+0x6a9/0x10c0 mm/shmem.c:699 shmem_getpage_gfp+0xa65/0x2480 mm/shmem.c:1952 shmem_getpage mm/shmem.c:161 [inline] shmem_write_begin+0xca/0x1b0 mm/shmem.c:2497 generic_perform_write+0x2cd/0x570 mm/filemap.c:3509 __generic_file_write_iter+0x23c/0x560 mm/filemap.c:3638 generic_file_write_iter+0xaf/0x1c0 mm/filemap.c:3670 __kernel_write+0x5ab/0x9d0 fs/read_write.c:550 dump_emit+0x261/0x3a0 fs/coredump.c:849 dump_user_range+0x71/0x1a0 fs/coredump.c:902 elf_core_dump+0x33bd/0x3c10 fs/binfmt_elf.c:2290 do_coredump+0x1eb8/0x2d60 fs/coredump.c:811 get_signal+0x102c/0x1410 kernel/signal.c:2779 arch_do_signal_or_restart+0xbd/0x17c0 arch/x86/kernel/signal.c:805 handle_signal_work kernel/entry/common.c:145 [inline] exit_to_user_mode_loop+0x9b/0xd0 kernel/entry/common.c:169 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline] irqentry_exit_to_user_mode+0x4e/0x80 kernel/entry/common.c:287 irqentry_exit+0x12/0x60 kernel/entry/common.c:375 exc_page_fault+0x33d/0x5b0 arch/x86/mm/fault.c:1487 asm_exc_page_fault+0x1e/0x30 arch/x86/include/asm/idtentry.h:571 RIP: 0033:0x20000242 Code: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 47 50 <4c> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 RSP: 002b:00000000200000d0 EFLAGS: 00010217 RAX: 0000000000000000 RBX: 00007fe13a57e080 RCX: 00007fe13a38dd29 RDX: 0000000020000100 RSI: 00000000200000d0 RDI: 0000000000000080 RBP: 00007fe13a409b08 R08: 0000000020000980 R09: 0000000020000980 R10: 0000000020000180 R11: 0000000000000202 R12: 0000000000000000 R13: 0000000000000001 R14: 00007fe13a57e080 R15: 00007ffd8a96cac8 memory: usage 307200kB, limit 307200kB, failcnt 10687 memory+swap: usage 428796kB, limit 9007199254740988kB, failcnt 0 kmem: usage 0kB, limit 9007199254740988kB, failcnt 0 Memory cgroup stats for /syz0: anon 147456 file 310751232 kernel_stack 0 percpu 0 sock 0 shmem 310751232 file_mapped 135168 file_dirty 0 file_writeback 0 anon_thp 0 inactive_anon 313683968 active_anon 675840 inactive_file 0 active_file 167936 unevictable 0 slab_reclaimable 0 slab_unreclaimable 0 slab 0 workingset_refault_anon 33 workingset_refault_file 0 workingset_activate_anon 0 workingset_activate_file 0 workingset_restore_anon 0 workingset_restore_file 0 oom-kill:constraint=CONSTRAINT_MEMCG,nodemask=(null),cpuset=syz0,mems_allowed=0,oom_memcg=/syz0,task_memcg=/syz0,task=syz.0.4039,pid=15180,uid=0 Memory cgroup out of memory: Killed process 15180 (syz.0.4039) total-vm:89804kB, anon-rss:832kB, file-rss:53568kB, shmem-rss:0kB, UID:0 pgtables:180kB oom_score_adj:1000