syzbot


possible deadlock in blkdev_put

Status: upstream: reported C repro on 2023/01/01 16:48
Subsystems: btrfs
[Documentation on labels]
Reported-by: syzbot+c39815a69e3227f1cc8e@syzkaller.appspotmail.com
First crash: 472d, last: 443d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in blkdev_put (4) block 2 170d 184d 0/26 auto-obsoleted due to no activity on 2024/02/07 19:21
upstream possible deadlock in blkdev_put btrfs 1 1305d 1304d 0/26 auto-closed as invalid on 2021/01/18 22:03
upstream possible deadlock in blkdev_put (3) block C 870 695d 767d 22/26 fixed on 2023/02/24 13:50
upstream possible deadlock in blkdev_put (2) block C done 502 771d 872d 20/26 fixed on 2022/03/08 16:11
linux-4.14 possible deadlock in blkdev_put C 5 423d 1294d 0/1 upstream: reported C repro on 2020/10/01 09:27

Sample crash report:
BTRFS warning (device <unknown>): duplicate device /dev/loop5 devid 1 generation 8 scanned by systemd-udevd (8143)
audit: type=1800 audit(1672591570.266:2): pid=8115 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor737" name="bus" dev="loop3" ino=263 res=0
======================================================
WARNING: possible circular locking dependency detected
4.19.211-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor737/8101 is trying to acquire lock:
00000000a858a2ed (&bdev->bd_mutex){+.+.}, at: blkdev_put+0x30/0x520 fs/block_dev.c:1839

but task is already holding lock:
00000000af53f1d2 (&fs_devs->device_list_mutex){+.+.}, at: close_fs_devices.part.0+0x2e/0x8e0 fs/btrfs/volumes.c:1083

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #8 (&fs_devs->device_list_mutex){+.+.}:
       btrfs_finish_chunk_alloc+0x27b/0xf90 fs/btrfs/volumes.c:4938
       btrfs_create_pending_block_groups+0x242/0x590 fs/btrfs/extent-tree.c:10134
       __btrfs_end_transaction+0x21a/0xb00 fs/btrfs/transaction.c:855
       flush_space+0xa41/0xee0 fs/btrfs/extent-tree.c:4861
       btrfs_async_reclaim_metadata_space+0x466/0x1050 fs/btrfs/extent-tree.c:4977
       process_one_work+0x864/0x1570 kernel/workqueue.c:2153
       worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
       kthread+0x33f/0x460 kernel/kthread.c:259
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

-> #7 (sb_internal#2){.+.+}:
       sb_start_intwrite include/linux/fs.h:1626 [inline]
       start_transaction+0xa37/0xf90 fs/btrfs/transaction.c:528
       btrfs_dirty_inode+0xe3/0x210 fs/btrfs/inode.c:6165
       btrfs_update_time+0x33b/0x3d0 fs/btrfs/inode.c:6207
       update_time fs/inode.c:1675 [inline]
       touch_atime+0x23c/0x2a0 fs/inode.c:1746
       file_accessed include/linux/fs.h:2123 [inline]
       btrfs_file_mmap+0x11b/0x160 fs/btrfs/file.c:2274
       call_mmap include/linux/fs.h:1826 [inline]
       mmap_region+0xc94/0x16b0 mm/mmap.c:1757
       do_mmap+0x8e8/0x1080 mm/mmap.c:1530
       do_mmap_pgoff include/linux/mm.h:2329 [inline]
       vm_mmap_pgoff+0x197/0x200 mm/util.c:357
       ksys_mmap_pgoff+0x298/0x5a0 mm/mmap.c:1580
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #6 (&mm->mmap_sem){++++}:
       _copy_to_user+0x29/0x100 lib/usercopy.c:25
       copy_to_user include/linux/uaccess.h:155 [inline]
       _perf_ioctl+0x769/0x2300 kernel/events/core.c:5102
       perf_ioctl+0x55/0x80 kernel/events/core.c:5177
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:501 [inline]
       do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
       ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
       __do_sys_ioctl fs/ioctl.c:712 [inline]
       __se_sys_ioctl fs/ioctl.c:710 [inline]
       __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #5 (&cpuctx_mutex){+.+.}:
       perf_event_init_cpu+0xc4/0x170 kernel/events/core.c:11828
       perf_event_init+0x309/0x34e kernel/events/core.c:11875
       start_kernel+0x5b1/0x911 init/main.c:644
       secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243

-> #4 (pmus_lock){+.+.}:
       perf_event_init_cpu+0x2c/0x170 kernel/events/core.c:11822
       cpuhp_invoke_callback+0x201/0x1b80 kernel/cpu.c:170
       cpuhp_up_callbacks kernel/cpu.c:584 [inline]
       _cpu_up+0x25c/0x540 kernel/cpu.c:1192
       do_cpu_up+0xdd/0x1b0 kernel/cpu.c:1228
       smp_init+0x1ed/0x202 kernel/smp.c:578
       kernel_init_freeable+0x62b/0xab7 init/main.c:1138
       kernel_init+0xd/0x1ba init/main.c:1062
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

-> #3 (cpu_hotplug_lock.rw_sem){++++}:
       get_online_cpus include/linux/cpu.h:137 [inline]
       kmem_cache_create_usercopy+0x24/0x240 mm/slab_common.c:447
       kmem_cache_create+0xd/0x10 mm/slab_common.c:522
       bio_find_or_create_slab block/bio.c:117 [inline]
       bioset_init+0x473/0x810 block/bio.c:1920
       init_bio+0x184/0x1e0 block/bio.c:2094
       do_one_initcall+0xf1/0x740 init/main.c:884
       do_initcall_level init/main.c:952 [inline]
       do_initcalls init/main.c:960 [inline]
       do_basic_setup init/main.c:978 [inline]
       kernel_init_freeable+0x9c5/0xab7 init/main.c:1145
       kernel_init+0xd/0x1ba init/main.c:1062
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

-> #2 (bio_slab_lock){+.+.}:
       bio_find_or_create_slab block/bio.c:82 [inline]
       bioset_init+0x1ab/0x810 block/bio.c:1920
       blk_alloc_queue_node+0x189/0xbf0 block/blk-core.c:1025
       blk_mq_init_queue+0x44/0xa0 block/blk-mq.c:2500
       loop_add+0x2cb/0x8a0 drivers/block/loop.c:1996
       loop_init+0x1ef/0x24a drivers/block/loop.c:2259
       do_one_initcall+0xf1/0x740 init/main.c:884
       do_initcall_level init/main.c:952 [inline]
       do_initcalls init/main.c:960 [inline]
       do_basic_setup init/main.c:978 [inline]
       kernel_init_freeable+0x9c5/0xab7 init/main.c:1145
       kernel_init+0xd/0x1ba init/main.c:1062
       ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

-> #1 (loop_ctl_mutex){+.+.}:
       lo_open+0x19/0xd0 drivers/block/loop.c:1771
       __blkdev_get+0x372/0x1480 fs/block_dev.c:1494
       blkdev_get+0xb0/0x940 fs/block_dev.c:1627
       blkdev_open+0x202/0x290 fs/block_dev.c:1788
       do_dentry_open+0x4aa/0x1160 fs/open.c:796
       do_last fs/namei.c:3421 [inline]
       path_openat+0x793/0x2df0 fs/namei.c:3537
       do_filp_open+0x18c/0x3f0 fs/namei.c:3567
       do_sys_open+0x3b3/0x520 fs/open.c:1085
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (&bdev->bd_mutex){+.+.}:
       __mutex_lock_common kernel/locking/mutex.c:937 [inline]
       __mutex_lock+0xd7/0x1190 kernel/locking/mutex.c:1078
       blkdev_put+0x30/0x520 fs/block_dev.c:1839
       btrfs_close_bdev fs/btrfs/volumes.c:1033 [inline]
       btrfs_close_one_device fs/btrfs/volumes.c:1057 [inline]
       close_fs_devices.part.0+0x24d/0x8e0 fs/btrfs/volumes.c:1085
       close_fs_devices fs/btrfs/volumes.c:1117 [inline]
       btrfs_close_devices+0x95/0x1f0 fs/btrfs/volumes.c:1103
       close_ctree+0x3c8/0x850 fs/btrfs/disk-io.c:4047
       generic_shutdown_super+0x144/0x370 fs/super.c:456
       kill_anon_super+0x36/0x60 fs/super.c:1032
       btrfs_kill_super+0x49/0x550 fs/btrfs/super.c:2221
       deactivate_locked_super+0x94/0x160 fs/super.c:329
       deactivate_super+0x174/0x1a0 fs/super.c:360
       cleanup_mnt+0x1a8/0x290 fs/namespace.c:1098
       task_work_run+0x148/0x1c0 kernel/task_work.c:113
       tracehook_notify_resume include/linux/tracehook.h:193 [inline]
       exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
       prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
       syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
       do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

other info that might help us debug this:

Chain exists of:
  &bdev->bd_mutex --> sb_internal#2 --> &fs_devs->device_list_mutex

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&fs_devs->device_list_mutex);
                               lock(sb_internal#2);
                               lock(&fs_devs->device_list_mutex);
  lock(&bdev->bd_mutex);

 *** DEADLOCK ***

3 locks held by syz-executor737/8101:
 #0: 000000008e50af7f (&type->s_umount_key#47){+.+.}, at: deactivate_super+0x16c/0x1a0 fs/super.c:359
 #1: 000000002d041dc8 (uuid_mutex){+.+.}, at: btrfs_close_devices+0x23/0x1f0 fs/btrfs/volumes.c:1102
 #2: 00000000af53f1d2 (&fs_devs->device_list_mutex){+.+.}, at: close_fs_devices.part.0+0x2e/0x8e0 fs/btrfs/volumes.c:1083

stack backtrace:
CPU: 1 PID: 8101 Comm: syz-executor737 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1222
 check_prev_add kernel/locking/lockdep.c:1866 [inline]
 check_prevs_add kernel/locking/lockdep.c:1979 [inline]
 validate_chain kernel/locking/lockdep.c:2420 [inline]
 __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3416
 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908
 __mutex_lock_common kernel/locking/mutex.c:937 [inline]
 __mutex_lock+0xd7/0x1190 kernel/locking/mutex.c:1078
 blkdev_put+0x30/0x520 fs/block_dev.c:1839
 btrfs_close_bdev fs/btrfs/volumes.c:1033 [inline]
 btrfs_close_one_device fs/btrfs/volumes.c:1057 [inline]
 close_fs_devices.part.0+0x24d/0x8e0 fs/btrfs/volumes.c:1085
 close_fs_devices fs/btrfs/volumes.c:1117 [inline]
 btrfs_close_devices+0x95/0x1f0 fs/btrfs/volumes.c:1103
 close_ctree+0x3c8/0x850 fs/btrfs/disk-io.c:4047
 generic_shutdown_super+0x144/0x370 fs/super.c:456
 kill_anon_super+0x36/0x60 fs/super.c:1032
 btrfs_kill_super+0x49/0x550 fs/btrfs/super.c:2221
 deactivate_locked_super+0x94/0x160 fs/super.c:329
 deactivate_super+0x174/0x1a0 fs/super.c:360
 cleanup_mnt+0x1a8/0x290 fs/namespace.c:1098
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f514c20dca7
Code: ff d0 48 89 c7 b8 3c 00 00 00 0f 05 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe8b6245f8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f514c20dca7
RDX: 00007ffe8b6246b7 RSI: 000000000000000a RDI: 00007ffe8b6246b0
RBP: 00007ffe8b6246b0 R08: 00000000ffffffff R09: 00007ffe8b624490
R10: 0000555556b46683 R11: 0000000000000202 R12: 00007ffe8b625770
R13: 0000555556b465f0 R14: 00007ffe8b624620 R15: 00007ffe8b625790
BTRFS warning (device <unknown>): duplicate device /dev/loop2 devid 1 generation 8 scanned by syz-executor737 (8149)
BTRFS info (device loop0): enabling inode map caching
BTRFS info (device loop0): trying to use backup root at mount time
BTRFS warning (device <unknown>): duplicate device /dev/loop1 devid 1 generation 8 scanned by syz-executor737 (8154)
BTRFS info (device loop0): use zlib compression, level 3
BTRFS warning (device <unknown>): duplicate device /dev/loop4 devid 1 generation 8 scanned by syz-executor737 (8152)
BTRFS warning (device <unknown>): duplicate device /dev/loop5 devid 1 generation 8 scanned by syz-executor737 (8155)
BTRFS info (device loop0): enabling ssd optimizations
BTRFS warning (device <unknown>): duplicate device /dev/loop2 devid 1 generation 8 scanned by systemd-udevd (8139)
BTRFS info (device loop0): using spread ssd allocation scheme
BTRFS warning (device <unknown>): duplicate device /dev/loop5 devid 1 generation 8 scanned by systemd-udevd (8127)
BTRFS info (device loop0): using free space tree
BTRFS info (device loop0): has skinny extents
BTRFS warning (device <unknown>): duplicate device /dev/loop4 devid 1 generation 8 scanned by systemd-udevd (8144)
BTRFS warning (device <unknown>): duplicate device /dev/loop1 devid 1 generation 8 scanned by systemd-udevd (8143)
BTRFS warning (device <unknown>): duplicate device /dev/loop3 devid 1 generation 8 scanned by syz-executor737 (8198)
BTRFS warning (device <unknown>): duplicate device /dev/loop3 devid 1 generation 8 scanned by systemd-udevd (8132)
audit: type=1800 audit(1672591571.807:3): pid=8147 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor737" name="bus" dev="loop0" ino=263 res=0
BTRFS info (device loop1): enabling inode map caching
BTRFS info (device loop1): trying to use backup root at mount time
BTRFS warning (device <unknown>): duplicate device /dev/loop4 devid 1 generation 8 scanned by syz-executor737 (8204)
BTRFS info (device loop1): use zlib compression, level 3
BTRFS info (device loop1): enabling ssd optimizations
BTRFS warning (device <unknown>): duplicate device /dev/loop2 devid 1 generation 8 scanned by syz-executor737 (8201)
BTRFS info (device loop1): using spread ssd allocation scheme
BTRFS warning (device <unknown>): duplicate device /dev/loop4 devid 1 generation 8 scanned by systemd-udevd (8132)
BTRFS warning (device <unknown>): duplicate device /dev/loop2 devid 1 generation 8 scanned by systemd-udevd (8139)
BTRFS info (device loop1): using free space tree
BTRFS info (device loop1): has skinny extents
BTRFS warning (device <unknown>): duplicate device /dev/loop5 devid 1 generation 8 scanned by syz-executor737 (8207)
BTRFS warning (device <unknown>): duplicate device /dev/loop5 devid 1 generation 8 scanned by systemd-udevd (8143)
BTRFS warning (device <unknown>): duplicate device /dev/loop3 devid 1 generation 8 scanned by syz-executor737 (8234)
BTRFS warning (device <unknown>): duplicate device /dev/loop3 devid 1 generation 8 scanned by systemd-udevd (8139)
BTRFS warning (device <unknown>): duplicate device /dev/loop0 devid 1 generation 8 scanned by syz-executor737 (8251)
BTRFS warning (device <unknown>): duplicate device /dev/loop0 devid 1 generation 8 scanned by systemd-udevd (8132)
BTRFS warning (device <unknown>): duplicate device /dev/loop4 devid 1 generation 8 scanned by syz-executor737 (8254)
BTRFS warning (device <unknown>): duplicate device /dev/loop4 devid 1 generation 8 scanned by systemd-udevd (8143)
audit: type=1800 audit(1672591572.497:4): pid=8205 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor737" name="bus" dev="loop1" ino=263 res=0
BTRFS info (device loop2): enabling inode map caching
BTRFS info (device loop2): trying to use backup root at mount time
BTRFS info (device loop2): use zlib compression, level 3
BTRFS info (device loop2): enabling ssd optimizations
BTRFS warning (device <unknown>): duplicate device /dev/loop5 devid 1 generation 8 scanned by syz-executor737 (8268)
BTRFS info (device loop2): using spread ssd allocation scheme
BTRFS warning (device <unknown>): duplicate device /dev/loop5 devid 1 generation 8 scanned by systemd-udevd (8132)
BTRFS info (device loop2): using free space tree
BTRFS info (device loop2): has skinny extents
BTRFS warning (device <unknown>): duplicate device /dev/loop3 devid 1 generation 8 scanned by syz-executor737 (8290)
BTRFS warning (device <unknown>): duplicate device /dev/loop3 devid 1 generation 8 scanned by systemd-udevd (8139)
BTRFS warning (device <unknown>): duplicate device /dev/loop0 devid 1 generation 8 scanned by syz-executor737 (8294)
BTRFS warning (device <unknown>): duplicate device /dev/loop0 devid 1 generation 8 scanned by systemd-udevd (8132)
BTRFS warning (device <unknown>): duplicate device /dev/loop4 devid 1 generation 8 scanned by syz-executor737 (8300)
BTRFS warning (device <unknown>): duplicate device /dev/loop4 devid 1 generation 8 scanned by systemd-udevd (8143)
audit: type=1800 audit(1672591573.127:5): pid=8258 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor737" name="bus" dev="loop2" ino=263 res=0
BTRFS info (device loop1): enabling inode map caching
BTRFS warning (device <unknown>): duplicate device /dev/loop5 devid 1 generation 8 scanned by syz-executor737 (8313)
BTRFS info (device loop1): trying to use backup root at mount time
BTRFS info (device loop1): use zlib compression, level 3
BTRFS info (device loop1): enabling ssd optimizations
BTRFS info (device loop1): using spread ssd allocation scheme
BTRFS warning (device <unknown>): duplicate device /dev/loop5 devid 1 generation 8 scanned by systemd-udevd (8144)
BTRFS warning (device <unknown>): duplicate device /dev/loop3 devid 1 generation 8 scanned by syz-executor737 (8333)
BTRFS info (device loop1): using free space tree
BTRFS info (device loop1): has skinny extents
BTRFS warning (device <unknown>): duplicate device /dev/loop3 devid 1 generation 8 scanned by systemd-udevd (8139)
BTRFS warning (device <unknown>): duplicate device /dev/loop4 devid 1 generation 8 scanned by syz-executor737 (8347)
BTRFS warning (device <unknown>): duplicate device /dev/loop4 devid 1 generation 8 scanned by systemd-udevd (8132)
BTRFS warning (device <unknown>): duplicate device /dev/loop0 devid 1 generation 8 scanned by syz-executor737 (8344)
BTRFS warning (device <unknown>): duplicate device /dev/loop0 devid 1 generation 8 scanned by systemd-udevd (8144)
audit: type=1800 audit(1672591573.687:6): pid=8311 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor737" name="bus" dev="loop1" ino=263 res=0
BTRFS warning (device <unknown>): duplicate device /dev/loop5 devid 1 generation 8 scanned by syz-executor737 (8365)
BTRFS info (device loop3): enabling inode map caching
BTRFS info (device loop3): trying to use backup root at mount time
BTRFS info (device loop3): use zlib compression, level 3
BTRFS info (device loop3): enabling ssd optimizations
BTRFS info (device loop3): using spread ssd allocation scheme
BTRFS info (device loop3): using free space tree
BTRFS info (device loop3): has skinny extents
BTRFS warning (device <unknown>): duplicate device /dev/loop2 devid 1 generation 8 scanned by syz-executor737 (8366)
BTRFS warning (device <unknown>): duplicate device /dev/loop4 devid 1 generation 8 scanned by syz-executor737 (8388)
BTRFS warning (device <unknown>): duplicate device /dev/loop2 devid 1 generation 8 scanned by systemd-udevd (8139)
BTRFS warning (device <unknown>): duplicate device /dev/loop4 devid 1 generation 8 scanned by systemd-udevd (8132)
BTRFS warning (device <unknown>): duplicate device /dev/loop0 devid 1 generation 8 scanned by syz-executor737 (8398)
audit: type=1800 audit(1672591574.097:7): pid=8368 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor737" name="bus" dev="loop3" ino=263 res=0
BTRFS warning (device <unknown>): duplicate device /dev/loop0 devid 1 generation 8 scanned by systemd-udevd (8143)
==================================================================
BUG: KASAN: use-after-free in caching_kthread+0x871/0x970 fs/btrfs/inode-map.c:31
Read of size 8 at addr ffff88808f1386f0 by task btrfs-ino-cache/8452

CPU: 1 PID: 8452 Comm: btrfs-ino-cache Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_load8_noabort+0x88/0x90 mm/kasan/report.c:433
 caching_kthread+0x871/0x970 fs/btrfs/inode-map.c:31
 kthread+0x33f/0x460 kernel/kthread.c:259
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 8368:
 kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625
 kmalloc include/linux/slab.h:515 [inline]
 kzalloc include/linux/slab.h:709 [inline]
 btrfs_alloc_root fs/btrfs/disk-io.c:1220 [inline]
 btrfs_read_tree_root+0x94/0x560 fs/btrfs/disk-io.c:1421
 btrfs_read_fs_root fs/btrfs/disk-io.c:1467 [inline]
 btrfs_get_fs_root+0x239/0x890 fs/btrfs/disk-io.c:1601
 btrfs_read_fs_root_no_name fs/btrfs/disk-io.h:80 [inline]
 open_ctree+0x469c/0x61e0 fs/btrfs/disk-io.c:3181
 btrfs_fill_super fs/btrfs/super.c:1209 [inline]
 btrfs_mount_root+0x12e5/0x1830 fs/btrfs/super.c:1613
 mount_fs+0xa3/0x310 fs/super.c:1261
 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
 vfs_kern_mount+0x3c/0x60 fs/namespace.c:951
 btrfs_mount+0x23a/0xaa0 fs/btrfs/super.c:1681
 mount_fs+0xa3/0x310 fs/super.c:1261
 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
 vfs_kern_mount fs/namespace.c:951 [inline]
 do_new_mount fs/namespace.c:2492 [inline]
 do_mount+0x115c/0x2f50 fs/namespace.c:2822
 ksys_mount+0xcf/0x130 fs/namespace.c:3038
 __do_sys_mount fs/namespace.c:3052 [inline]
 __se_sys_mount fs/namespace.c:3049 [inline]
 __x64_sys_mount+0xba/0x150 fs/namespace.c:3049
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8101:
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcc/0x210 mm/slab.c:3822
 btrfs_put_fs_root fs/btrfs/disk-io.h:111 [inline]
 btrfs_free_fs_root+0x1e6/0x260 fs/btrfs/disk-io.c:3861
 btrfs_free_fs_roots+0x2ef/0x4d0 fs/btrfs/disk-io.c:2092
 close_ctree+0x306/0x850 fs/btrfs/disk-io.c:4017
 generic_shutdown_super+0x144/0x370 fs/super.c:456
 kill_anon_super+0x36/0x60 fs/super.c:1032
 btrfs_kill_super+0x49/0x550 fs/btrfs/super.c:2221
 deactivate_locked_super+0x94/0x160 fs/super.c:329
 deactivate_super+0x174/0x1a0 fs/super.c:360
 cleanup_mnt+0x1a8/0x290 fs/namespace.c:1098
 task_work_run+0x148/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88808f138500
 which belongs to the cache kmalloc-4096 of size 4096
The buggy address is located 496 bytes inside of
 4096-byte region [ffff88808f138500, ffff88808f139500)
The buggy address belongs to the page:
page:ffffea00023c4e00 count:1 mapcount:0 mapping:ffff88813bff0dc0 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea0002881508 ffffea00028ccf08 ffff88813bff0dc0
raw: 0000000000000000 ffff88808f138500 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808f138580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88808f138600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88808f138680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff88808f138700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88808f138780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
BTRFS warning (device <unknown>): duplicate device /dev/loop4 devid 1 generation 8 scanned by syz-executor737 (8442)
audit: type=1800 audit(1672591574.137:8): pid=8454 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor737" name="bus" dev="sda1" ino=13892 res=0
BTRFS warning (device <unknown>): duplicate device /dev/loop2 devid 1 generation 8 scanned by syz-executor737 (8439)
audit: type=1800 audit(1672591574.638:9): pid=8457 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=collect_data cause=failed(directio) comm="syz-executor737" name="bus" dev="sda1" ino=13893 res=0

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/01/01 16:47 linux-4.19.y 3f8a27f9e27b ab32d508 .config console log report syz C [disk image] [vmlinux] [mounted in repro] ci2-linux-4-19 possible deadlock in blkdev_put
2023/01/31 02:48 linux-4.19.y 3f8a27f9e27b b68fb8d6 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in blkdev_put
* Struck through repros no longer work on HEAD.