================================================================== BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:72 [inline] BUG: KASAN: use-after-free in atomic_long_read include/linux/atomic/atomic-instrumented.h:1265 [inline] BUG: KASAN: use-after-free in filp_close+0x26/0x160 fs/open.c:1415 Read of size 8 at addr ffff888021f07470 by task syz-executor.0/14119 CPU: 1 PID: 14119 Comm: syz-executor.0 Not tainted 6.2.0-rc3-next-20230112-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:306 [inline] print_report+0x15e/0x45d mm/kasan/report.c:417 kasan_report+0xc0/0xf0 mm/kasan/report.c:517 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x141/0x190 mm/kasan/generic.c:189 instrument_atomic_read include/linux/instrumented.h:72 [inline] atomic_long_read include/linux/atomic/atomic-instrumented.h:1265 [inline] filp_close+0x26/0x160 fs/open.c:1415 close_fd+0x7a/0xa0 fs/file.c:664 __do_sys_close fs/open.c:1440 [inline] __se_sys_close fs/open.c:1438 [inline] __x64_sys_close+0x33/0xa0 fs/open.c:1438 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f186f43df7b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44 RSP: 002b:00007ffc63930d70 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007f186f43df7b RDX: 0000001b2d220000 RSI: 0000001b2d238760 RDI: 0000000000000003 RBP: 00007f186f5ad980 R08: 0000000000000000 R09: 000000000cf51930 R10: 00007ffc639ed090 R11: 0000000000000293 R12: 0000000000106d46 R13: 00007ffc63930e70 R14: 00007f186f5ac1f0 R15: 0000000000000032 Allocated by task 14120: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 __kasan_slab_alloc+0x7f/0x90 mm/kasan/common.c:325 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:769 [inline] slab_alloc_node mm/slub.c:3452 [inline] slab_alloc mm/slub.c:3460 [inline] __kmem_cache_alloc_lru mm/slub.c:3467 [inline] kmem_cache_alloc+0x175/0x320 mm/slub.c:3476 kmem_cache_zalloc include/linux/slab.h:710 [inline] __alloc_file+0x21/0x270 fs/file_table.c:139 alloc_empty_file+0x71/0x170 fs/file_table.c:188 path_openat+0xe6/0x2b40 fs/namei.c:3701 do_filp_open+0x1ba/0x410 fs/namei.c:3742 do_sys_openat2+0x16d/0x4c0 fs/open.c:1311 do_sys_open fs/open.c:1327 [inline] __do_sys_openat fs/open.c:1343 [inline] __se_sys_openat fs/open.c:1338 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1338 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 75: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:518 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807 slab_free mm/slub.c:3787 [inline] kmem_cache_free+0xec/0x4e0 mm/slub.c:3809 rcu_do_batch kernel/rcu/tree.c:2113 [inline] rcu_core+0x821/0x1920 kernel/rcu/tree.c:2373 __do_softirq+0x1fb/0xaf6 kernel/softirq.c:571 Last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:488 __call_rcu_common.constprop.0+0x99/0x780 kernel/rcu/tree.c:2622 task_work_run+0x16f/0x270 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x210/0x240 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:297 do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:488 task_work_add+0x7f/0x2c0 kernel/task_work.c:48 fput fs/file_table.c:377 [inline] fput+0xeb/0x1a0 fs/file_table.c:370 fdput include/linux/file.h:45 [inline] fdput_pos include/linux/file.h:80 [inline] ksys_write+0x201/0x250 fs/read_write.c:640 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888021f07400 which belongs to the cache filp of size 456 The buggy address is located 112 bytes inside of 456-byte region [ffff888021f07400, ffff888021f075c8) The buggy address belongs to the physical page: page:ffffea000087c180 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21f06 head:ffffea000087c180 order:1 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff888070c77d01 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffff8880125eda00 ffffea0001ea2880 0000000000000004 raw: 0000000000000000 00000000000c000c 00000001ffffffff ffff888070c77d01 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4438, tgid 4438 (udevd), ts 1067211728343, free_ts 1067151110747 prep_new_page mm/page_alloc.c:2549 [inline] get_page_from_freelist+0x11bb/0x2d50 mm/page_alloc.c:4324 __alloc_pages+0x1cb/0x5c0 mm/page_alloc.c:5590 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2281 alloc_slab_page mm/slub.c:1851 [inline] allocate_slab+0x25f/0x350 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3193 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3292 __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] slab_alloc mm/slub.c:3460 [inline] __kmem_cache_alloc_lru mm/slub.c:3467 [inline] kmem_cache_alloc+0x30a/0x320 mm/slub.c:3476 kmem_cache_zalloc include/linux/slab.h:710 [inline] __alloc_file+0x21/0x270 fs/file_table.c:139 alloc_empty_file+0x71/0x170 fs/file_table.c:188 path_openat+0xe6/0x2b40 fs/namei.c:3701 do_filp_open+0x1ba/0x410 fs/namei.c:3742 do_sys_openat2+0x16d/0x4c0 fs/open.c:1311 do_sys_open fs/open.c:1327 [inline] __do_sys_openat fs/open.c:1343 [inline] __se_sys_openat fs/open.c:1338 [inline] __x64_sys_openat+0x143/0x1f0 fs/open.c:1338 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1451 [inline] free_pcp_prepare+0x4d0/0x910 mm/page_alloc.c:1501 free_unref_page_prepare mm/page_alloc.c:3387 [inline] free_unref_page+0x1d/0x490 mm/page_alloc.c:3482 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x192/0x220 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:302 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:769 [inline] slab_alloc_node mm/slub.c:3452 [inline] __kmem_cache_alloc_node+0x17c/0x330 mm/slub.c:3491 __do_kmalloc_node mm/slab_common.c:966 [inline] __kmalloc+0x4a/0xd0 mm/slab_common.c:980 kmalloc include/linux/slab.h:584 [inline] tomoyo_realpath_from_path+0xc3/0x600 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x22d/0x430 security/tomoyo/file.c:822 security_inode_getattr+0xd3/0x140 security/security.c:1375 vfs_getattr fs/stat.c:167 [inline] vfs_statx+0x16e/0x430 fs/stat.c:242 vfs_fstatat+0x90/0xb0 fs/stat.c:276 __do_sys_newfstatat+0x8a/0x110 fs/stat.c:446 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff888021f07300: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc ffff888021f07380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888021f07400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888021f07480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888021f07500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================