================================================================== BUG: KASAN: use-after-free in cleancache_fs_enabled_mapping include/linux/cleancache.h:54 [inline] BUG: KASAN: use-after-free in cleancache_invalidate_page include/linux/cleancache.h:108 [inline] BUG: KASAN: use-after-free in unaccount_page_cache_page+0x6e6/0x750 mm/filemap.c:169 Read of size 4 at addr ffff8881c0637488 by task syz-executor.2/15139 CPU: 1 PID: 15139 Comm: syz-executor.2 Tainted: G W 5.4.233-syzkaller-00003-gf423d52eea72 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1d8/0x241 lib/dump_stack.c:118 print_address_description+0x8c/0x600 mm/kasan/report.c:384 __kasan_report+0xf3/0x120 mm/kasan/report.c:516 kasan_report+0x30/0x60 mm/kasan/common.c:653 cleancache_fs_enabled_mapping include/linux/cleancache.h:54 [inline] cleancache_invalidate_page include/linux/cleancache.h:108 [inline] unaccount_page_cache_page+0x6e6/0x750 mm/filemap.c:169 __delete_from_page_cache+0xd0/0x600 mm/filemap.c:237 __remove_mapping+0x4a2/0x590 mm/vmscan.c:978 shrink_page_list+0x22f9/0x42c0 mm/vmscan.c:1482 shrink_inactive_list+0x533/0xfe0 mm/vmscan.c:2001 shrink_list mm/vmscan.c:2293 [inline] shrink_node_memcg+0xc42/0x2430 mm/vmscan.c:2623 shrink_node+0x389/0x14a0 mm/vmscan.c:2836 shrink_zones mm/vmscan.c:3053 [inline] do_try_to_free_pages+0x63f/0x12b0 mm/vmscan.c:3111 try_to_free_mem_cgroup_pages+0x3f6/0x9b0 mm/vmscan.c:3412 memory_max_write+0x23a/0x440 mm/memcontrol.c:6220 cgroup_file_write+0x275/0x5f0 kernel/cgroup/cgroup.c:3898 kernfs_fop_write+0x2e2/0x3e0 fs/kernfs/file.c:315 __vfs_write+0x103/0x750 fs/read_write.c:494 vfs_write+0x206/0x4e0 fs/read_write.c:558 ksys_write+0x199/0x2c0 fs/read_write.c:611 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 Allocated by task 14756: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] __kasan_kmalloc+0x171/0x210 mm/kasan/common.c:529 slab_post_alloc_hook mm/slab.h:584 [inline] slab_alloc_node mm/slub.c:2829 [inline] slab_alloc mm/slub.c:2837 [inline] kmem_cache_alloc+0xd9/0x250 mm/slub.c:2842 getname_kernel+0x55/0x2d0 fs/namei.c:221 kern_path+0x19/0x40 fs/namei.c:2509 ovl_mount_dir_noesc+0x56/0x190 fs/overlayfs/super.c:750 ovl_lower_dir fs/overlayfs/super.c:813 [inline] ovl_get_lowerstack fs/overlayfs/super.c:1502 [inline] ovl_fill_super+0x16e1/0x4800 fs/overlayfs/super.c:1685 mount_nodev+0x52/0xe0 fs/super.c:1463 legacy_get_tree+0xdf/0x170 fs/fs_context.c:647 vfs_get_tree+0x85/0x260 fs/super.c:1547 do_new_mount+0x292/0x570 fs/namespace.c:2843 do_mount+0x688/0xe10 fs/namespace.c:3163 ksys_mount+0xc2/0xf0 fs/namespace.c:3372 __do_sys_mount fs/namespace.c:3386 [inline] __se_sys_mount fs/namespace.c:3383 [inline] __x64_sys_mount+0xb1/0xc0 fs/namespace.c:3383 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 Freed by task 14756: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] kasan_set_free_info mm/kasan/common.c:345 [inline] __kasan_slab_free+0x1b5/0x270 mm/kasan/common.c:487 slab_free_hook mm/slub.c:1455 [inline] slab_free_freelist_hook mm/slub.c:1494 [inline] slab_free mm/slub.c:3080 [inline] kmem_cache_free+0x10b/0x2c0 mm/slub.c:3096 putname fs/namei.c:262 [inline] filename_lookup+0x50e/0x6e0 fs/namei.c:2432 ovl_mount_dir_noesc+0x56/0x190 fs/overlayfs/super.c:750 ovl_lower_dir fs/overlayfs/super.c:813 [inline] ovl_get_lowerstack fs/overlayfs/super.c:1502 [inline] ovl_fill_super+0x16e1/0x4800 fs/overlayfs/super.c:1685 mount_nodev+0x52/0xe0 fs/super.c:1463 legacy_get_tree+0xdf/0x170 fs/fs_context.c:647 vfs_get_tree+0x85/0x260 fs/super.c:1547 do_new_mount+0x292/0x570 fs/namespace.c:2843 do_mount+0x688/0xe10 fs/namespace.c:3163 ksys_mount+0xc2/0xf0 fs/namespace.c:3372 __do_sys_mount fs/namespace.c:3386 [inline] __se_sys_mount fs/namespace.c:3383 [inline] __x64_sys_mount+0xb1/0xc0 fs/namespace.c:3383 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 The buggy address belongs to the object at ffff8881c0636600 which belongs to the cache names_cache of size 4096 The buggy address is located 3720 bytes inside of 4096-byte region [ffff8881c0636600, ffff8881c0637600) The buggy address belongs to the page: page:ffffea0007018c00 refcount:1 mapcount:0 mapping:ffff8881f5cfd680 index:0x0 compound_mapcount: 0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5cfd680 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) set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook mm/page_alloc.c:2165 [inline] prep_new_page+0x18f/0x370 mm/page_alloc.c:2171 get_page_from_freelist+0x2d13/0x2d90 mm/page_alloc.c:3794 __alloc_pages_nodemask+0x393/0x840 mm/page_alloc.c:4891 alloc_slab_page+0x39/0x3c0 mm/slub.c:343 allocate_slab mm/slub.c:1683 [inline] new_slab+0x97/0x440 mm/slub.c:1749 new_slab_objects mm/slub.c:2505 [inline] ___slab_alloc+0x2fe/0x490 mm/slub.c:2667 __slab_alloc+0x62/0xa0 mm/slub.c:2707 slab_alloc_node mm/slub.c:2792 [inline] slab_alloc mm/slub.c:2837 [inline] kmem_cache_alloc+0x109/0x250 mm/slub.c:2842 getname_flags+0xb8/0x4e0 fs/namei.c:141 user_path_at_empty+0x28/0x50 fs/namei.c:2683 user_path_at include/linux/namei.h:49 [inline] do_faccessat+0x2eb/0x6f0 fs/open.c:398 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1176 [inline] __free_pages_ok+0x847/0x950 mm/page_alloc.c:1438 free_the_page mm/page_alloc.c:4953 [inline] __free_pages+0x91/0x140 mm/page_alloc.c:4959 __free_slab+0x221/0x2e0 mm/slub.c:1774 __slab_free+0x34b/0x360 mm/slub.c:3012 qlist_free_all+0x43/0xb0 mm/kasan/quarantine.c:167 quarantine_reduce+0x1d9/0x210 mm/kasan/quarantine.c:260 __kasan_kmalloc+0x41/0x210 mm/kasan/common.c:507 slab_post_alloc_hook mm/slab.h:584 [inline] slab_alloc_node mm/slub.c:2829 [inline] slab_alloc mm/slub.c:2837 [inline] kmem_cache_alloc+0xd9/0x250 mm/slub.c:2842 sock_alloc_inode+0x17/0xb0 net/socket.c:239 alloc_inode fs/inode.c:231 [inline] new_inode_pseudo+0x60/0x210 fs/inode.c:927 sock_alloc net/socket.c:559 [inline] __sock_create+0x124/0x7a0 net/socket.c:1372 sock_create net/socket.c:1459 [inline] __sys_socketpair+0x28f/0x6e0 net/socket.c:1559 __do_sys_socketpair net/socket.c:1612 [inline] __se_sys_socketpair net/socket.c:1609 [inline] __x64_sys_socketpair+0x97/0xb0 net/socket.c:1609 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 Memory state around the buggy address: ffff8881c0637380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881c0637400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881c0637480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881c0637500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881c0637580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== syz-executor.2 invoked oom-killer: gfp_mask=0xcc0(GFP_KERNEL), order=0, oom_score_adj=1000 CPU: 1 PID: 15139 Comm: syz-executor.2 Tainted: G B W 5.4.233-syzkaller-00003-gf423d52eea72 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x1d8/0x241 lib/dump_stack.c:118 dump_header+0xd5/0x6b0 mm/oom_kill.c:460 oom_kill_process+0xeb/0x2c0 mm/oom_kill.c:974 out_of_memory+0x5e1/0x890 mm/oom_kill.c:1111 mem_cgroup_out_of_memory+0x211/0x270 mm/memcontrol.c:1611 memory_max_write+0x329/0x440 mm/memcontrol.c:6227 cgroup_file_write+0x275/0x5f0 kernel/cgroup/cgroup.c:3898 kernfs_fop_write+0x2e2/0x3e0 fs/kernfs/file.c:315 __vfs_write+0x103/0x750 fs/read_write.c:494 vfs_write+0x206/0x4e0 fs/read_write.c:558 ksys_write+0x199/0x2c0 fs/read_write.c:611 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 memory: usage 136kB, limit 0kB, failcnt 56876 swap: usage 0kB, limit 9007199254740988kB, failcnt 0 Memory cgroup stats for /syz0: anon 114688 file 282624 kernel_stack 0 slab 0 sock 0 shmem 98304 file_mapped 270336 file_dirty 0 file_writeback 0 anon_thp 0 inactive_anon 0 active_anon 135168 inactive_file 0 active_file 0 unevictable 0 slab_reclaimable 0 slab_unreclaimable 0 pgfault 642774 pgmajfault 0 workingset_refault 0 workingset_activate 0 workingset_nodereclaim 0 pgrefill 608 pgscan 600 pgsteal 33 pgactivate 2739 oom-kill:constraint=CONSTRAINT_MEMCG,nodemask=(null),cpuset=syz2,mems_allowed=0,oom_memcg=/syz0,task_memcg=/syz0,task=syz-executor.0,pid=11821,uid=0 Memory cgroup out of memory: Killed process 11821 (syz-executor.0) total-vm:48516kB, anon-rss:476kB, file-rss:15308kB, shmem-rss:64kB, UID:0 pgtables:84kB oom_score_adj:0