================================================================== BUG: KASAN: slab-use-after-free in f2fs_filemap_fault+0xd1/0x2c0 fs/f2fs/file.c:49 Read of size 8 at addr ffff88801ec6b240 by task syz-executor.4/12314 CPU: 0 PID: 12314 Comm: syz-executor.4 Not tainted 6.8.0-rc5-syzkaller #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+0x1e7/0x2e0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0x167/0x540 mm/kasan/report.c:488 kasan_report+0x142/0x180 mm/kasan/report.c:601 f2fs_filemap_fault+0xd1/0x2c0 fs/f2fs/file.c:49 __do_fault+0x135/0x460 mm/memory.c:4376 do_read_fault mm/memory.c:4738 [inline] do_fault mm/memory.c:4868 [inline] do_pte_missing mm/memory.c:3745 [inline] handle_pte_fault mm/memory.c:5144 [inline] __handle_mm_fault+0x49e6/0x72d0 mm/memory.c:5285 handle_mm_fault+0x27e/0x770 mm/memory.c:5450 do_user_addr_fault arch/x86/mm/fault.c:1415 [inline] handle_page_fault arch/x86/mm/fault.c:1507 [inline] exc_page_fault+0x2ad/0x870 arch/x86/mm/fault.c:1563 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0010:fault_in_readable+0x108/0x2b0 mm/gup.c:1990 Code: 00 00 00 0f 01 cb 0f ae e8 48 89 de 48 81 e6 ff 0f 00 00 31 ff e8 78 a0 ba ff 48 89 d8 48 25 ff 0f 00 00 4c 89 74 24 18 74 30 <8a> 1b e8 81 9b ba ff 43 0f b6 04 2f 84 c0 0f 85 4d 01 00 00 88 5c RSP: 0018:ffffc9000e7c79c0 EFLAGS: 00050206 RAX: 0000000000000500 RBX: 0000000020000500 RCX: ffff888025a23b80 RDX: 0000000000000000 RSI: 0000000000000500 RDI: 0000000000000000 RBP: ffffc9000e7c7a78 R08: ffffffff81d8d058 R09: ffffffff84947b09 R10: 0000000000000002 R11: ffff888025a23b80 R12: 0000000000001006 R13: dffffc0000000000 R14: 1ffff92001cf8f3c R15: 1ffff92001cf8f40 fault_in_iov_iter_readable+0x229/0x280 lib/iov_iter.c:94 f2fs_preallocate_blocks fs/f2fs/file.c:4552 [inline] f2fs_file_write_iter+0xc6c/0x2340 fs/f2fs/file.c:4790 call_write_iter include/linux/fs.h:2085 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0xa81/0xcb0 fs/read_write.c:590 ksys_write+0x1a0/0x2c0 fs/read_write.c:643 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 RIP: 0033:0x7f445c67dda9 Code: 28 00 00 00 75 05 48 83 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 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f445d47c0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f445c7ac120 RCX: 00007f445c67dda9 RDX: 0000000000001006 RSI: 0000000020000500 RDI: 0000000000000004 RBP: 00007f445c6ca47a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f445c7ac120 R15: 00007ffee8bdc208 Allocated by task 12294: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 unpoison_slab_object mm/kasan/common.c:314 [inline] __kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:340 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3813 [inline] slab_alloc_node mm/slub.c:3860 [inline] kmem_cache_alloc+0x16f/0x340 mm/slub.c:3867 vm_area_alloc+0x24/0x1d0 kernel/fork.c:465 mmap_region+0xbd8/0x1fa0 mm/mmap.c:2806 do_mmap+0x7ae/0xe60 mm/mmap.c:1379 vm_mmap_pgoff+0x1e2/0x420 mm/util.c:556 ksys_mmap_pgoff+0x503/0x6e0 mm/mmap.c:1425 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 Freed by task 59: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x4e/0x60 mm/kasan/generic.c:640 poison_slab_object+0xa6/0xe0 mm/kasan/common.c:241 __kasan_slab_free+0x34/0x70 mm/kasan/common.c:257 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2121 [inline] slab_free mm/slub.c:4299 [inline] kmem_cache_free+0x102/0x2a0 mm/slub.c:4363 rcu_do_batch kernel/rcu/tree.c:2190 [inline] rcu_core+0xd76/0x1810 kernel/rcu/tree.c:2465 __do_softirq+0x2bb/0x942 kernel/softirq.c:553 Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47 __kasan_record_aux_stack+0xae/0x100 mm/kasan/generic.c:586 __call_rcu_common kernel/rcu/tree.c:2715 [inline] call_rcu+0x167/0xa80 kernel/rcu/tree.c:2829 remove_vma mm/mmap.c:148 [inline] remove_mt mm/mmap.c:2285 [inline] do_vmi_align_munmap+0x15a7/0x1930 mm/mmap.c:2631 do_vmi_munmap+0x24d/0x2d0 mm/mmap.c:2695 mmap_region+0x677/0x1fa0 mm/mmap.c:2746 do_mmap+0x7ae/0xe60 mm/mmap.c:1379 vm_mmap_pgoff+0x1e2/0x420 mm/util.c:556 ksys_mmap_pgoff+0x503/0x6e0 mm/mmap.c:1425 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 The buggy address belongs to the object at ffff88801ec6b220 which belongs to the cache vm_area_struct of size 192 The buggy address is located 32 bytes inside of freed 192-byte region [ffff88801ec6b220, ffff88801ec6b2e0) The buggy address belongs to the physical page: page:ffffea00007b1ac0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1ec6b memcg:ffff88802f6e7a01 flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000800 ffff8880162b2b40 ffffea0001fdf740 dead000000000006 raw: 0000000000000000 00000000000f000f 00000001ffffffff ffff88802f6e7a01 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 10346, tgid 10346 (udevadm), ts 459361514152, free_ts 459070241247 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0x33ea/0x3580 mm/page_alloc.c:3311 __alloc_pages+0x255/0x680 mm/page_alloc.c:4567 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page+0x5f/0x160 mm/slub.c:2190 allocate_slab mm/slub.c:2354 [inline] new_slab+0x84/0x2f0 mm/slub.c:2407 ___slab_alloc+0xd17/0x13e0 mm/slub.c:3540 __slab_alloc mm/slub.c:3625 [inline] __slab_alloc_node mm/slub.c:3678 [inline] slab_alloc_node mm/slub.c:3850 [inline] kmem_cache_alloc+0x24d/0x340 mm/slub.c:3867 vm_area_alloc+0x24/0x1d0 kernel/fork.c:465 mmap_region+0xbd8/0x1fa0 mm/mmap.c:2806 do_mmap+0x7ae/0xe60 mm/mmap.c:1379 vm_mmap_pgoff+0x1e2/0x420 mm/util.c:556 ksys_mmap_pgoff+0x503/0x6e0 mm/mmap.c:1425 do_syscall_64+0xf9/0x240 entry_SYSCALL_64_after_hwframe+0x6f/0x77 page last free pid 10333 tgid 10333 stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1140 [inline] free_unref_page_prepare+0x95d/0xa80 mm/page_alloc.c:2346 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2486 vfree+0x186/0x2e0 mm/vmalloc.c:2842 do_free_pages sound/core/pcm_memory.c:93 [inline] snd_pcm_lib_free_pages+0x1cc/0x2a0 sound/core/pcm_memory.c:499 do_hw_free sound/core/pcm_native.c:893 [inline] snd_pcm_release_substream+0x2c6/0x490 sound/core/pcm_native.c:2760 snd_pcm_oss_release_file sound/core/oss/pcm_oss.c:2413 [inline] snd_pcm_oss_release+0x1a8/0x280 sound/core/oss/pcm_oss.c:2592 __fput+0x429/0x8a0 fs/file_table.c:376 task_work_run+0x24e/0x310 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa2c/0x2740 kernel/exit.c:871 do_group_exit+0x206/0x2c0 kernel/exit.c:1020 get_signal+0x176d/0x1850 kernel/signal.c:2893 arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:310 exit_to_user_mode_loop kernel/entry/common.c:105 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:201 [inline] syscall_exit_to_user_mode+0xc8/0x370 kernel/entry/common.c:212 do_syscall_64+0x108/0x240 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x6f/0x77 Memory state around the buggy address: ffff88801ec6b100: fc fc 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88801ec6b180: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc >ffff88801ec6b200: fc fc fc fc fa fb fb fb fb fb fb fb fb fb fb fb ^ ffff88801ec6b280: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff88801ec6b300: fc fc fc fc fc fc 00 00 00 00 00 00 00 00 00 00 ================================================================== ---------------- Code disassembly (best guess): 0: 00 00 add %al,(%rax) 2: 00 0f add %cl,(%rdi) 4: 01 cb add %ecx,%ebx 6: 0f ae e8 lfence 9: 48 89 de mov %rbx,%rsi c: 48 81 e6 ff 0f 00 00 and $0xfff,%rsi 13: 31 ff xor %edi,%edi 15: e8 78 a0 ba ff call 0xffbaa092 1a: 48 89 d8 mov %rbx,%rax 1d: 48 25 ff 0f 00 00 and $0xfff,%rax 23: 4c 89 74 24 18 mov %r14,0x18(%rsp) 28: 74 30 je 0x5a * 2a: 8a 1b mov (%rbx),%bl <-- trapping instruction 2c: e8 81 9b ba ff call 0xffba9bb2 31: 43 0f b6 04 2f movzbl (%r15,%r13,1),%eax 36: 84 c0 test %al,%al 38: 0f 85 4d 01 00 00 jne 0x18b 3e: 88 .byte 0x88 3f: 5c pop %rsp