================================================================== BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:71 [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+0x22/0x160 fs/open.c:1382 Read of size 8 at addr ffff88807ca9b1f0 by task syz-executor.2/13672 CPU: 0 PID: 13672 Comm: syz-executor.2 Not tainted 5.18.0-next-20220603-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189 instrument_atomic_read include/linux/instrumented.h:71 [inline] atomic_long_read include/linux/atomic/atomic-instrumented.h:1265 [inline] filp_close+0x22/0x160 fs/open.c:1382 close_fd+0x76/0xa0 fs/file.c:664 __do_sys_close fs/open.c:1407 [inline] __se_sys_close fs/open.c:1405 [inline] __x64_sys_close+0x2f/0xa0 fs/open.c:1405 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 RIP: 0033:0x7fdcae83bd4b 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:00007fffb92bb560 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007fdcae83bd4b RDX: 00007fdcae9a0888 RSI: ffffffffffffffff RDI: 0000000000000003 RBP: 00007fdcae99d960 R08: 0000000000000000 R09: 00007fdcae9a0890 R10: 00007fffb92bb660 R11: 0000000000000293 R12: 0000000000085d46 R13: 00007fffb92bb660 R14: 00007fdcae99bf60 R15: 0000000000000032 Allocated by task 13680: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:469 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:750 [inline] slab_alloc_node mm/slub.c:3214 [inline] slab_alloc mm/slub.c:3222 [inline] __kmem_cache_alloc_lru mm/slub.c:3229 [inline] kmem_cache_alloc+0x204/0x3b0 mm/slub.c:3239 kmem_cache_zalloc include/linux/slab.h:723 [inline] __alloc_file+0x21/0x270 fs/file_table.c:138 alloc_empty_file+0x6d/0x170 fs/file_table.c:187 path_openat+0xe4/0x2910 fs/namei.c:3639 do_filp_open+0x1aa/0x400 fs/namei.c:3680 do_sys_openat2+0x16d/0x4c0 fs/open.c:1278 do_sys_open fs/open.c:1294 [inline] __do_sys_openat fs/open.c:1310 [inline] __se_sys_openat fs/open.c:1305 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1305 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Freed by task 16: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x166/0x1a0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1727 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1753 slab_free mm/slub.c:3507 [inline] kmem_cache_free+0xdd/0x5a0 mm/slub.c:3524 rcu_do_batch kernel/rcu/tree.c:2578 [inline] rcu_core+0x7b1/0x1880 kernel/rcu/tree.c:2838 __do_softirq+0x29b/0x9c2 kernel/softirq.c:571 Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 call_rcu+0x99/0x790 kernel/rcu/tree.c:3126 task_work_run+0xdd/0x1a0 kernel/task_work.c:177 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:169 [inline] exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 task_work_add+0x3a/0x1f0 kernel/task_work.c:48 fput fs/file_table.c:378 [inline] fput+0xe7/0x190 fs/file_table.c:371 io_close fs/io_uring.c:6053 [inline] io_issue_sqe+0x3f29/0x9780 fs/io_uring.c:8464 io_queue_sqe fs/io_uring.c:8794 [inline] io_submit_sqe fs/io_uring.c:9058 [inline] io_submit_sqes+0x161d/0x8000 fs/io_uring.c:9169 __do_sys_io_uring_enter+0x1112/0x2300 fs/io_uring.c:12101 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 The buggy address belongs to the object at ffff88807ca9b180 which belongs to the cache filp of size 456 The buggy address is located 112 bytes inside of 456-byte region [ffff88807ca9b180, ffff88807ca9b348) The buggy address belongs to the physical page: page:ffffea0001f2a680 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7ca9a head:ffffea0001f2a680 order:1 compound_mapcount:0 compound_pincount:0 memcg:ffff88801e381101 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0001f2a880 dead000000000004 ffff888140007a00 raw: 0000000000000000 00000000800c000c 00000001ffffffff ffff88801e381101 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 2979, tgid 2979 (udevd), ts 27525510131, free_ts 27272535974 prep_new_page mm/page_alloc.c:2460 [inline] get_page_from_freelist+0xa64/0x3d10 mm/page_alloc.c:4279 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5503 alloc_pages+0x1aa/0x310 mm/mempolicy.c:2279 alloc_slab_page mm/slub.c:1797 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1942 new_slab mm/slub.c:2002 [inline] ___slab_alloc+0x985/0xd90 mm/slub.c:3002 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3089 slab_alloc_node mm/slub.c:3180 [inline] slab_alloc mm/slub.c:3222 [inline] __kmem_cache_alloc_lru mm/slub.c:3229 [inline] kmem_cache_alloc+0x360/0x3b0 mm/slub.c:3239 kmem_cache_zalloc include/linux/slab.h:723 [inline] __alloc_file+0x21/0x270 fs/file_table.c:138 alloc_empty_file+0x6d/0x170 fs/file_table.c:187 path_openat+0xe4/0x2910 fs/namei.c:3639 do_filp_open+0x1aa/0x400 fs/namei.c:3680 do_sys_openat2+0x16d/0x4c0 fs/open.c:1278 do_sys_open fs/open.c:1294 [inline] __do_sys_openat fs/open.c:1310 [inline] __se_sys_openat fs/open.c:1305 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1305 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1375 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1425 free_unref_page_prepare mm/page_alloc.c:3311 [inline] free_unref_page+0x19/0x7b0 mm/page_alloc.c:3426 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2521 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:446 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:750 [inline] slab_alloc_node mm/slub.c:3214 [inline] slab_alloc mm/slub.c:3222 [inline] __kmalloc+0x200/0x350 mm/slub.c:4413 kmalloc include/linux/slab.h:605 [inline] kzalloc include/linux/slab.h:733 [inline] tomoyo_encode2.part.0+0xe9/0x3a0 security/tomoyo/realpath.c:45 tomoyo_encode2 security/tomoyo/realpath.c:31 [inline] tomoyo_encode+0x28/0x50 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x186/0x620 security/tomoyo/realpath.c:288 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_check_open_permission+0x272/0x380 security/tomoyo/file.c:771 tomoyo_file_open security/tomoyo/tomoyo.c:320 [inline] tomoyo_file_open+0x9d/0xc0 security/tomoyo/tomoyo.c:315 security_file_open+0x45/0xb0 security/security.c:1645 do_dentry_open+0x349/0x11f0 fs/open.c:835 do_open fs/namei.c:3520 [inline] path_openat+0x1c71/0x2910 fs/namei.c:3653 do_filp_open+0x1aa/0x400 fs/namei.c:3680 Memory state around the buggy address: ffff88807ca9b080: fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc ffff88807ca9b100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88807ca9b180: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807ca9b200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807ca9b280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================