================================================================== 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 ffff888119622470 by task syz-executor.5/22785 CPU: 1 PID: 22785 Comm: syz-executor.5 Not tainted 5.10.194-syzkaller-00508-ga27512601c2d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023 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:2048 shrink_list mm/vmscan.c:2267 [inline] shrink_lruvec+0xced/0x3860 mm/vmscan.c:5434 shrink_node_memcgs mm/vmscan.c:5621 [inline] shrink_node+0xdf3/0x1fb0 mm/vmscan.c:5651 shrink_zones mm/vmscan.c:5854 [inline] do_try_to_free_pages+0x67e/0x15e0 mm/vmscan.c:5912 try_to_free_mem_cgroup_pages+0x369/0x830 mm/vmscan.c:6230 try_charge+0x4b8/0x15f0 mm/memcontrol.c:2742 __mem_cgroup_charge+0x147/0x6e0 mm/memcontrol.c:6847 mem_cgroup_charge include/linux/memcontrol.h:458 [inline] __add_to_page_cache_locked+0x29d/0xba0 mm/filemap.c:854 add_to_page_cache_lru+0x117/0x2c0 mm/filemap.c:948 pagecache_get_page+0x71e/0x950 mm/filemap.c:1859 grab_cache_page_write_begin+0x5d/0xa0 mm/filemap.c:3456 ext4_da_write_begin+0x587/0xf60 fs/ext4/inode.c:3055 generic_perform_write+0x2cd/0x570 mm/filemap.c:3506 ext4_buffered_write_iter+0x482/0x610 fs/ext4/file.c:271 ext4_file_write_iter+0x193/0x1c80 fs/ext4/file.c:685 __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:2287 do_coredump+0x1eb8/0x2d60 fs/coredump.c:811 get_signal+0x102c/0x1410 kernel/signal.c:2768 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+0x5a/0x80 kernel/entry/common.c:287 irqentry_exit+0x12/0x60 kernel/entry/common.c:375 exc_general_protection+0x415/0x490 arch/x86/kernel/traps.c:557 asm_exc_general_protection+0x1e/0x30 arch/x86/include/asm/idtentry.h:565 RIP: 0033:0x7fe3242dbaf1 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:00000000200003e0 EFLAGS: 00010217 RAX: 0000000000000000 RBX: 00007fe3243fb2c0 RCX: 00007fe3242dbae9 RDX: 0000000020000180 RSI: 00000000200003e0 RDI: 0000000020000000 RBP: 00007fe32432747a R08: 0000000020000400 R09: 0000000020000400 R10: 00000000200001c0 R11: 0000000000000206 R12: 0000000000000000 R13: 000000000000006e R14: 00007fe3243fb2c0 R15: 00007ffd8ef2d3c8 Allocated by task 3461: 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:430 [inline] __kasan_slab_alloc+0xb1/0xe0 mm/kasan/common.c:463 kasan_slab_alloc include/linux/kasan.h:244 [inline] slab_post_alloc_hook+0x61/0x2f0 mm/slab.h:583 slab_alloc_node mm/slub.c:2947 [inline] slab_alloc mm/slub.c:2955 [inline] kmem_cache_alloc+0x168/0x2e0 mm/slub.c:2960 getname_flags+0xba/0x520 fs/namei.c:141 user_path_at_empty+0x2d/0x50 fs/namei.c:2740 user_path_at include/linux/namei.h:60 [inline] vfs_statx+0x106/0x3b0 fs/stat.c:193 vfs_fstatat fs/stat.c:215 [inline] __do_sys_newfstatat fs/stat.c:383 [inline] __se_sys_newfstatat+0xc8/0x760 fs/stat.c:377 __x64_sys_newfstatat+0x9b/0xb0 fs/stat.c:377 do_syscall_64+0x34/0x70 entry_SYSCALL_64_after_hwframe+0x61/0xc6 Freed by task 3461: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:362 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370 kasan_slab_free include/linux/kasan.h:220 [inline] slab_free_hook mm/slub.c:1595 [inline] slab_free_freelist_hook+0xc0/0x190 mm/slub.c:1621 slab_free mm/slub.c:3203 [inline] kmem_cache_free+0xa9/0x1e0 mm/slub.c:3219 putname fs/namei.c:262 [inline] filename_lookup+0x515/0x6f0 fs/namei.c:2470 user_path_at_empty+0x40/0x50 fs/namei.c:2740 user_path_at include/linux/namei.h:60 [inline] vfs_statx+0x106/0x3b0 fs/stat.c:193 vfs_fstatat fs/stat.c:215 [inline] __do_sys_newfstatat fs/stat.c:383 [inline] __se_sys_newfstatat+0xc8/0x760 fs/stat.c:377 __x64_sys_newfstatat+0x9b/0xb0 fs/stat.c:377 do_syscall_64+0x34/0x70 entry_SYSCALL_64_after_hwframe+0x61/0xc6 The buggy address belongs to the object at ffff888119622200 which belongs to the cache names_cache of size 4096 The buggy address is located 624 bytes inside of 4096-byte region [ffff888119622200, ffff888119623200) The buggy address belongs to the page: page:ffffea0004658800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x119620 head:ffffea0004658800 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head) raw: 4000000000010200 dead000000000100 dead000000000122 ffff888100192c00 raw: 0000000000000000 0000000000070007 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 3461, ts 2952816548892, free_ts 2952797903152 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:5346 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] kmem_cache_alloc+0x1b9/0x2e0 mm/slub.c:2960 getname_flags+0xba/0x520 fs/namei.c:141 getname+0x19/0x20 fs/namei.c:212 do_sys_openat2+0xd7/0x6f0 fs/open.c:1211 do_sys_open fs/open.c:1233 [inline] __do_sys_openat fs/open.c:1249 [inline] __se_sys_openat fs/open.c:1244 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1244 do_syscall_64+0x34/0x70 entry_SYSCALL_64_after_hwframe+0x61/0xc6 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_pages_ok+0x82c/0x850 mm/page_alloc.c:1629 free_the_page+0x76/0x370 mm/page_alloc.c:5407 __free_pages+0x67/0xc0 mm/page_alloc.c:5416 __free_slab+0xcf/0x190 mm/slub.c:1894 free_slab mm/slub.c:1909 [inline] discard_slab mm/slub.c:1915 [inline] unfreeze_partials+0x15e/0x190 mm/slub.c:2410 put_cpu_partial+0xbf/0x180 mm/slub.c:2446 __slab_free+0x2c8/0x3a0 mm/slub.c:3095 do_slab_free mm/slub.c:3191 [inline] ___cache_free+0x111/0x130 mm/slub.c:3210 qlink_free+0x50/0x90 mm/kasan/quarantine.c:157 qlist_free_all+0x47/0xb0 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x15a/0x170 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:440 kasan_slab_alloc include/linux/kasan.h:244 [inline] slab_post_alloc_hook+0x61/0x2f0 mm/slab.h:583 slab_alloc_node mm/slub.c:2947 [inline] slab_alloc mm/slub.c:2955 [inline] kmem_cache_alloc+0x168/0x2e0 mm/slub.c:2960 getname_flags+0xba/0x520 fs/namei.c:141 getname+0x19/0x20 fs/namei.c:212 Memory state around the buggy address: ffff888119622300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888119622380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888119622400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888119622480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888119622500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== general protection fault, probably for non-canonical address 0xdffffc00000000e5: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000728-0x000000000000072f] CPU: 1 PID: 22785 Comm: syz-executor.5 Tainted: G B 5.10.194-syzkaller-00508-ga27512601c2d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/06/2023 RIP: 0010:f2fs_release_page+0x36f/0x870 fs/f2fs/data.c:3615 Code: ff df 80 3c 08 00 74 08 4c 89 e7 e8 8b d2 8d ff bb 28 07 00 00 49 03 1c 24 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <0f> b6 04 08 84 c0 0f 85 72 04 00 00 44 8b 23 bb 00 00 00 40 be 00 RSP: 0000:ffffc90004c45730 EFLAGS: 00010202 RAX: 00000000000000e5 RBX: 0000000000000728 RCX: dffffc0000000000 RDX: 0000000000000000 RSI: 0000000000000282 RDI: ffff8881114503c8 RBP: ffffc90004c45768 R08: ffffffff821a2134 R09: fffff94000ae1531 R10: 0000000000000000 R11: dffffc0000000001 R12: ffff8881114503c8 R13: 4000000000002005 R14: 1ffffd4000ae1531 R15: ffffea000570a980 FS: 00007fe322fda6c0(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000001ffffe40 CR3: 0000000114b38000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: try_to_release_page+0x188/0x1e0 mm/filemap.c:3702 shrink_page_list+0x1a25/0x4c60 mm/vmscan.c:1460 shrink_inactive_list+0x591/0x1150 mm/vmscan.c:2048 shrink_list mm/vmscan.c:2267 [inline] shrink_lruvec+0xced/0x3860 mm/vmscan.c:5434 shrink_node_memcgs mm/vmscan.c:5621 [inline] shrink_node+0xdf3/0x1fb0 mm/vmscan.c:5651 shrink_zones mm/vmscan.c:5854 [inline] do_try_to_free_pages+0x67e/0x15e0 mm/vmscan.c:5912 try_to_free_mem_cgroup_pages+0x369/0x830 mm/vmscan.c:6230 try_charge+0x4b8/0x15f0 mm/memcontrol.c:2742 __mem_cgroup_charge+0x147/0x6e0 mm/memcontrol.c:6847 mem_cgroup_charge include/linux/memcontrol.h:458 [inline] __add_to_page_cache_locked+0x29d/0xba0 mm/filemap.c:854 add_to_page_cache_lru+0x117/0x2c0 mm/filemap.c:948 pagecache_get_page+0x71e/0x950 mm/filemap.c:1859 grab_cache_page_write_begin+0x5d/0xa0 mm/filemap.c:3456 ext4_da_write_begin+0x587/0xf60 fs/ext4/inode.c:3055 generic_perform_write+0x2cd/0x570 mm/filemap.c:3506 ext4_buffered_write_iter+0x482/0x610 fs/ext4/file.c:271 ext4_file_write_iter+0x193/0x1c80 fs/ext4/file.c:685 __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:2287 do_coredump+0x1eb8/0x2d60 fs/coredump.c:811 get_signal+0x102c/0x1410 kernel/signal.c:2768 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+0x5a/0x80 kernel/entry/common.c:287 irqentry_exit+0x12/0x60 kernel/entry/common.c:375 exc_general_protection+0x415/0x490 arch/x86/kernel/traps.c:557 asm_exc_general_protection+0x1e/0x30 arch/x86/include/asm/idtentry.h:565 RIP: 0033:0x7fe3242dbaf1 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:00000000200003e0 EFLAGS: 00010217 RAX: 0000000000000000 RBX: 00007fe3243fb2c0 RCX: 00007fe3242dbae9 RDX: 0000000020000180 RSI: 00000000200003e0 RDI: 0000000020000000 RBP: 00007fe32432747a R08: 0000000020000400 R09: 0000000020000400 R10: 00000000200001c0 R11: 0000000000000206 R12: 0000000000000000 R13: 000000000000006e R14: 00007fe3243fb2c0 R15: 00007ffd8ef2d3c8 Modules linked in: ---[ end trace 07501b253604541b ]--- RIP: 0010:f2fs_release_page+0x36f/0x870 fs/f2fs/data.c:3615 Code: ff df 80 3c 08 00 74 08 4c 89 e7 e8 8b d2 8d ff bb 28 07 00 00 49 03 1c 24 48 89 d8 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <0f> b6 04 08 84 c0 0f 85 72 04 00 00 44 8b 23 bb 00 00 00 40 be 00 RSP: 0000:ffffc90004c45730 EFLAGS: 00010202 RAX: 00000000000000e5 RBX: 0000000000000728 RCX: dffffc0000000000 RDX: 0000000000000000 RSI: 0000000000000282 RDI: ffff8881114503c8 RBP: ffffc90004c45768 R08: ffffffff821a2134 R09: fffff94000ae1531 R10: 0000000000000000 R11: dffffc0000000001 R12: ffff8881114503c8 R13: 4000000000002005 R14: 1ffffd4000ae1531 R15: ffffea000570a980 FS: 00007fe322fda6c0(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055555579a430 CR3: 0000000114b38000 CR4: 00000000003506a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 ---------------- Code disassembly (best guess), 1 bytes skipped: 0: df 80 3c 08 00 74 filds 0x7400083c(%rax) 6: 08 4c 89 e7 or %cl,-0x19(%rcx,%rcx,4) a: e8 8b d2 8d ff call 0xff8dd29a f: bb 28 07 00 00 mov $0x728,%ebx 14: 49 03 1c 24 add (%r12),%rbx 18: 48 89 d8 mov %rbx,%rax 1b: 48 c1 e8 03 shr $0x3,%rax 1f: 48 b9 00 00 00 00 00 movabs $0xdffffc0000000000,%rcx 26: fc ff df * 29: 0f b6 04 08 movzbl (%rax,%rcx,1),%eax <-- trapping instruction 2d: 84 c0 test %al,%al 2f: 0f 85 72 04 00 00 jne 0x4a7 35: 44 8b 23 mov (%rbx),%r12d 38: bb 00 00 00 40 mov $0x40000000,%ebx 3d: be .byte 0xbe