================================================================== 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+0x6d8/0x750 mm/filemap.c:163 Read of size 4 at addr ffff888106dff470 by task syz-executor.1/2067 CPU: 0 PID: 2067 Comm: syz-executor.1 Not tainted 5.15.148-syzkaller-00718-g993bed180178 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description+0x87/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:427 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:444 __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+0x6d8/0x750 mm/filemap.c:163 __delete_from_page_cache+0xc6/0x5b0 mm/filemap.c:231 __remove_mapping+0x566/0x690 mm/vmscan.c:1201 shrink_page_list+0x2723/0x5c50 mm/vmscan.c:1798 shrink_inactive_list mm/vmscan.c:2305 [inline] shrink_list mm/vmscan.c:2550 [inline] shrink_lruvec+0x17ec/0x4580 mm/vmscan.c:5753 shrink_node_memcgs mm/vmscan.c:5945 [inline] shrink_node+0x1077/0x24e0 mm/vmscan.c:5975 shrink_zones mm/vmscan.c:6178 [inline] do_try_to_free_pages+0x5ca/0x1570 mm/vmscan.c:6236 try_to_free_mem_cgroup_pages+0x36c/0x850 mm/vmscan.c:6550 try_charge_memcg+0x48f/0x1550 mm/memcontrol.c:2686 try_charge mm/memcontrol.c:2811 [inline] charge_memcg+0x6b/0x1a0 mm/memcontrol.c:6814 __mem_cgroup_charge+0x37/0x130 mm/memcontrol.c:6850 mem_cgroup_charge include/linux/memcontrol.h:715 [inline] __add_to_page_cache_locked+0x2d1/0xa20 mm/filemap.c:892 add_to_page_cache_lru+0x11b/0x2c0 mm/filemap.c:984 pagecache_get_page+0xbe1/0xeb0 mm/filemap.c:1951 grab_cache_page_write_begin+0x5d/0xa0 mm/filemap.c:3797 ext4_da_write_begin+0x5ae/0xc30 fs/ext4/inode.c:3003 generic_perform_write+0x2bc/0x5a0 mm/filemap.c:3843 ext4_buffered_write_iter+0x48a/0x610 fs/ext4/file.c:270 ext4_file_write_iter+0x443/0x1c80 __kernel_write+0x5ab/0xa60 fs/read_write.c:539 __dump_emit+0x261/0x3a0 fs/coredump.c:875 dump_emit+0x381/0x3f0 fs/coredump.c:912 dump_user_range+0x86/0x1c0 fs/coredump.c:949 elf_core_dump+0x3663/0x3e80 fs/binfmt_elf.c:2285 do_coredump+0x1834/0x3050 fs/coredump.c:826 get_signal+0x4c8/0x1630 kernel/signal.c:2882 arch_do_signal_or_restart+0xbd/0x1680 arch/x86/kernel/signal.c:867 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop+0xa0/0xe0 kernel/entry/common.c:172 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:208 irqentry_exit_to_user_mode+0x9/0x20 kernel/entry/common.c:314 irqentry_exit+0x12/0x40 kernel/entry/common.c:405 exc_general_protection+0x327/0x4b0 arch/x86/kernel/traps.c:562 asm_exc_general_protection+0x27/0x30 arch/x86/include/asm/idtentry.h:562 RIP: 0033:0x7ff0c40a2db1 Code: c4 28 c3 e8 e1 20 00 00 90 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 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f RSP: 002b:0000000020000500 EFLAGS: 00010217 RAX: 0000000000000000 RBX: 00007ff0c41d1050 RCX: 00007ff0c40a2da9 RDX: 0000000020000400 RSI: 0000000020000500 RDI: 0000000000800000 RBP: 00007ff0c40ef47a R08: 0000000020000640 R09: 0000000020000640 R10: 0000000020000540 R11: 0000000000000206 R12: 0000000000000000 R13: 000000000000000b R14: 00007ff0c41d1050 R15: 00007fff5b988718 The buggy address belongs to the page: page:ffffea00041b7fc0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106dff flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea00043af888 ffffea0005c14988 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Unmovable, gfp_mask 0x101c40(GFP_NOFS|__GFP_HARDWALL|__GFP_WRITE), pid 1916, ts 1280678140647, free_ts 1280770851271 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2604 prep_new_page+0x1b/0x110 mm/page_alloc.c:2610 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4484 __alloc_pages+0x27e/0x8f0 mm/page_alloc.c:5776 __alloc_pages_node include/linux/gfp.h:591 [inline] alloc_pages_node include/linux/gfp.h:605 [inline] alloc_pages include/linux/gfp.h:618 [inline] __page_cache_alloc include/linux/pagemap.h:305 [inline] pagecache_get_page+0xb18/0xeb0 mm/filemap.c:1940 f2fs_pagecache_get_page fs/f2fs/f2fs.h:2732 [inline] f2fs_write_begin+0x31e/0x2a50 fs/f2fs/data.c:3532 generic_perform_write+0x2bc/0x5a0 mm/filemap.c:3843 f2fs_buffered_write_iter fs/f2fs/file.c:4450 [inline] f2fs_file_write_iter+0xdb9/0x2920 fs/f2fs/file.c:4675 do_iter_readv_writev+0x58e/0x790 do_iter_write+0x1f5/0x760 fs/read_write.c:855 vfs_iter_write+0x7c/0xa0 fs/read_write.c:896 iter_file_splice_write+0x7f8/0xf90 fs/splice.c:689 do_splice_from fs/splice.c:767 [inline] direct_splice_actor+0xff/0x130 fs/splice.c:936 splice_direct_to_actor+0x4f1/0xbe0 fs/splice.c:891 do_splice_direct+0x27f/0x3c0 fs/splice.c:979 do_sendfile+0x616/0xfe0 fs/read_write.c:1249 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1471 [inline] free_pcp_prepare mm/page_alloc.c:1543 [inline] free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3533 free_unref_page_list+0x14b/0xa60 mm/page_alloc.c:3670 release_pages+0x1310/0x1370 mm/swap.c:1009 __pagevec_release+0x84/0x100 mm/swap.c:1029 pagevec_release include/linux/pagevec.h:81 [inline] truncate_inode_pages_range+0x482/0x1160 mm/truncate.c:329 truncate_inode_pages mm/truncate.c:425 [inline] truncate_pagecache mm/truncate.c:735 [inline] truncate_setsize+0xd9/0x100 mm/truncate.c:760 f2fs_setattr+0x9c6/0x1130 fs/f2fs/file.c:966 notify_change+0xc7a/0xf30 fs/attr.c:505 do_truncate+0x21c/0x300 fs/open.c:66 handle_truncate fs/namei.c:3271 [inline] do_open fs/namei.c:3618 [inline] path_openat+0x28ed/0x2f40 fs/namei.c:3748 do_filp_open+0x21c/0x460 fs/namei.c:3775 do_sys_openat2+0x13f/0x830 fs/open.c:1234 do_sys_open fs/open.c:1250 [inline] __do_sys_open fs/open.c:1258 [inline] __se_sys_open fs/open.c:1254 [inline] __x64_sys_open+0x221/0x270 fs/open.c:1254 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb Memory state around the buggy address: ffff888106dff300: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888106dff380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888106dff400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888106dff480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888106dff500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== syz-executor.1 (2067) used greatest stack depth: 17152 bytes left