================================================================== BUG: KASAN: use-after-free in caching_kthread+0x7b9/0x8e0 fs/btrfs/inode-map.c:45 Read of size 8 at addr ffff8880673f26b0 by task btrfs-ino-cache/10017 CPU: 0 PID: 10017 Comm: btrfs-ino-cache Not tainted 4.14.302-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b2/0x281 lib/dump_stack.c:58 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351 kasan_report mm/kasan/report.c:409 [inline] __asan_report_load8_noabort+0x68/0x70 mm/kasan/report.c:430 caching_kthread+0x7b9/0x8e0 fs/btrfs/inode-map.c:45 kthread+0x30d/0x420 kernel/kthread.c:232 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:406 Allocated by task 9976: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x131/0x3d0 mm/slab.c:3618 kmalloc include/linux/slab.h:488 [inline] kzalloc include/linux/slab.h:661 [inline] btrfs_alloc_root fs/btrfs/disk-io.c:1226 [inline] btrfs_read_tree_root+0x94/0x4a0 fs/btrfs/disk-io.c:1432 btrfs_read_fs_root fs/btrfs/disk-io.c:1477 [inline] btrfs_get_fs_root+0x1b6/0x790 fs/btrfs/disk-io.c:1611 btrfs_read_fs_root_no_name fs/btrfs/disk-io.h:89 [inline] open_ctree+0x4b7d/0x7530 fs/btrfs/disk-io.c:2970 btrfs_fill_super fs/btrfs/super.c:1147 [inline] btrfs_mount+0x1915/0x1fe0 fs/btrfs/super.c:1631 mount_fs+0x92/0x2a0 fs/super.c:1237 vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046 vfs_kern_mount+0x3c/0x60 fs/namespace.c:1036 mount_subvol fs/btrfs/super.c:1398 [inline] btrfs_mount+0x42a/0x1fe0 fs/btrfs/super.c:1569 mount_fs+0x92/0x2a0 fs/super.c:1237 vfs_kern_mount.part.0+0x5b/0x470 fs/namespace.c:1046 vfs_kern_mount fs/namespace.c:1036 [inline] do_new_mount fs/namespace.c:2572 [inline] do_mount+0xe65/0x2a30 fs/namespace.c:2905 SYSC_mount fs/namespace.c:3121 [inline] SyS_mount+0xa8/0x120 fs/namespace.c:3098 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 Freed by task 8026: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kfree+0xc9/0x250 mm/slab.c:3815 btrfs_put_fs_root fs/btrfs/disk-io.h:120 [inline] free_fs_root+0x270/0x320 fs/btrfs/disk-io.c:3638 btrfs_free_fs_roots+0x294/0x440 fs/btrfs/disk-io.c:2103 close_ctree+0x2c9/0x840 fs/btrfs/disk-io.c:3800 generic_shutdown_super+0x144/0x370 fs/super.c:446 kill_anon_super+0x36/0x90 fs/super.c:1006 btrfs_kill_super+0x49/0x540 fs/btrfs/super.c:2163 deactivate_locked_super+0x6c/0xd0 fs/super.c:319 deactivate_super+0x7f/0xa0 fs/super.c:350 cleanup_mnt+0x186/0x2c0 fs/namespace.c:1183 task_work_run+0x11f/0x190 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 audit: type=1804 audit(1673450156.713:3): pid=10025 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir2715303454/syzkaller.7LIx9g/18/bus" dev="sda1" ino=13966 res=1 The buggy address belongs to the object at ffff8880673f24c0 which belongs to the cache kmalloc-4096 of size 4096 The buggy address is located 496 bytes inside of 4096-byte region [ffff8880673f24c0, ffff8880673f34c0) The buggy address belongs to the page: page:ffffea00019cfc80 count:1 mapcount:0 mapping:ffff8880673f24c0 index:0x0 compound_mapcount: 0 flags: 0xfff00000008100(slab|head) raw: 00fff00000008100 ffff8880673f24c0 0000000000000000 0000000100000001 raw: ffffea00019cfda0 ffffea00019cf6a0 ffff88813fe74dc0 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880673f2580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880673f2600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880673f2680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880673f2700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880673f2780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== audit: type=1804 audit(1673450157.243:4): pid=10045 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir2715303454/syzkaller.7LIx9g/19/bus" dev="sda1" ino=13984 res=1 audit: type=1804 audit(1673450157.323:5): pid=10060 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir2715303454/syzkaller.7LIx9g/20/bus" dev="sda1" ino=13977 res=1 audit: type=1804 audit(1673450157.323:6): pid=10059 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.0" name="/root/syzkaller-testdir3645030103/syzkaller.3pbjbE/22/bus" dev="sda1" ino=13984 res=1