hfsplus: xattr searching failed ====================================================== WARNING: possible circular locking dependency detected 4.14.302-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.3/11431 is trying to acquire lock: (&sbi->alloc_mutex){+.+.}, at: [] hfsplus_block_free+0xc7/0x560 fs/hfsplus/bitmap.c:182 but task is already holding lock: (&tree->tree_lock/1){+.+.}, at: [] hfsplus_find_init+0x161/0x220 fs/hfsplus/bfind.c:33 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #2 (&tree->tree_lock/1){+.+.}: __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893 hfsplus_find_init+0x161/0x220 fs/hfsplus/bfind.c:33 hfsplus_ext_read_extent+0x15f/0x9e0 fs/hfsplus/extents.c:216 hfsplus_get_block+0x23e/0x820 fs/hfsplus/extents.c:268 block_read_full_page+0x25e/0x8d0 fs/buffer.c:2316 do_read_cache_page+0x38e/0xc10 mm/filemap.c:2713 read_mapping_page include/linux/pagemap.h:398 [inline] hfsplus_block_allocate+0x189/0x910 fs/hfsplus/bitmap.c:37 hfsplus_file_extend+0x421/0xef0 fs/hfsplus/extents.c:463 hfsplus_get_block+0x15b/0x820 fs/hfsplus/extents.c:245 __block_write_begin_int+0x35c/0x11d0 fs/buffer.c:2038 __block_write_begin fs/buffer.c:2088 [inline] block_write_begin+0x58/0x270 fs/buffer.c:2147 cont_write_begin+0x4a3/0x740 fs/buffer.c:2497 hfsplus_write_begin+0x87/0x130 fs/hfsplus/inode.c:53 generic_perform_write+0x1d5/0x430 mm/filemap.c:3055 __generic_file_write_iter+0x227/0x590 mm/filemap.c:3180 generic_file_write_iter+0x36f/0x650 mm/filemap.c:3208 call_write_iter include/linux/fs.h:1780 [inline] new_sync_write fs/read_write.c:469 [inline] __vfs_write+0x44c/0x630 fs/read_write.c:482 vfs_write+0x17f/0x4d0 fs/read_write.c:544 SYSC_pwrite64 fs/read_write.c:632 [inline] SyS_pwrite64+0x116/0x140 fs/read_write.c:619 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 -> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}: __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893 hfsplus_get_block+0x1f9/0x820 fs/hfsplus/extents.c:260 block_read_full_page+0x25e/0x8d0 fs/buffer.c:2316 do_read_cache_page+0x38e/0xc10 mm/filemap.c:2713 read_mapping_page include/linux/pagemap.h:398 [inline] hfsplus_block_allocate+0x189/0x910 fs/hfsplus/bitmap.c:37 hfsplus_file_extend+0x421/0xef0 fs/hfsplus/extents.c:463 hfsplus_get_block+0x15b/0x820 fs/hfsplus/extents.c:245 __block_write_begin_int+0x35c/0x11d0 fs/buffer.c:2038 __block_write_begin fs/buffer.c:2088 [inline] block_write_begin+0x58/0x270 fs/buffer.c:2147 cont_write_begin+0x4a3/0x740 fs/buffer.c:2497 hfsplus_write_begin+0x87/0x130 fs/hfsplus/inode.c:53 generic_perform_write+0x1d5/0x430 mm/filemap.c:3055 __generic_file_write_iter+0x227/0x590 mm/filemap.c:3180 generic_file_write_iter+0x36f/0x650 mm/filemap.c:3208 call_write_iter include/linux/fs.h:1780 [inline] new_sync_write fs/read_write.c:469 [inline] __vfs_write+0x44c/0x630 fs/read_write.c:482 vfs_write+0x17f/0x4d0 fs/read_write.c:544 SYSC_pwrite64 fs/read_write.c:632 [inline] SyS_pwrite64+0x116/0x140 fs/read_write.c:619 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 -> #0 (&sbi->alloc_mutex){+.+.}: lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893 hfsplus_block_free+0xc7/0x560 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x320/0x440 fs/hfsplus/extents.c:371 hfsplus_file_truncate+0xbc0/0xe80 fs/hfsplus/extents.c:585 hfsplus_file_release+0xbc/0x1e0 fs/hfsplus/inode.c:234 __fput+0x25f/0x7a0 fs/file_table.c:210 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 other info that might help us debug this: Chain exists of: &sbi->alloc_mutex --> &HFSPLUS_I(inode)->extents_lock --> &tree->tree_lock/1 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&tree->tree_lock/1); lock(&HFSPLUS_I(inode)->extents_lock); lock(&tree->tree_lock/1); lock(&sbi->alloc_mutex); *** DEADLOCK *** 3 locks held by syz-executor.3/11431: #0: (&sb->s_type->i_mutex_key#21){+.+.}, at: [] inode_lock include/linux/fs.h:719 [inline] #0: (&sb->s_type->i_mutex_key#21){+.+.}, at: [] hfsplus_file_release+0xb4/0x1e0 fs/hfsplus/inode.c:233 #1: (&hip->extents_lock){+.+.}, at: [] hfsplus_file_truncate+0x1ba/0xe80 fs/hfsplus/extents.c:571 #2: (&tree->tree_lock/1){+.+.}, at: [] hfsplus_find_init+0x161/0x220 fs/hfsplus/bfind.c:33 stack backtrace: CPU: 0 PID: 11431 Comm: syz-executor.3 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_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258 check_prev_add kernel/locking/lockdep.c:1905 [inline] check_prevs_add kernel/locking/lockdep.c:2022 [inline] validate_chain kernel/locking/lockdep.c:2464 [inline] __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 __mutex_lock_common kernel/locking/mutex.c:756 [inline] __mutex_lock+0xc4/0x1310 kernel/locking/mutex.c:893 hfsplus_block_free+0xc7/0x560 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x320/0x440 fs/hfsplus/extents.c:371 hfsplus_file_truncate+0xbc0/0xe80 fs/hfsplus/extents.c:585 hfsplus_file_release+0xbc/0x1e0 fs/hfsplus/inode.c:234 __fput+0x25f/0x7a0 fs/file_table.c:210 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 RIP: 0033:0x7f14100daf7b RSP: 002b:00007ffcbc010c20 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000005 RCX: 00007f14100daf7b RDX: 00007f140fc9d8e8 RSI: ffffffffffffffff RDI: 0000000000000004 RBP: 00007f141024a980 R08: 0000000000000000 R09: 00007f140fc9d000 R10: 00007f140fc9d8f0 R11: 0000000000000293 R12: 000000000003e90a R13: 00007ffcbc010d20 R14: 00007f1410248f80 R15: 0000000000000032 BTRFS: device fsid e417788f-7a09-42b2-9266-8ddc5d5d35d2 devid 1 transid 8 /dev/loop1 BTRFS error (device loop1): unsupported checksum algorithm 1 BTRFS error (device loop1): superblock checksum mismatch BTRFS error (device loop1): open_ctree failed kauditd_printk_skb: 4 callbacks suppressed audit: type=1804 audit(1673011012.871:4): pid=11571 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.1" name="/root/syzkaller-testdir1164563783/syzkaller.FIuewa/92/bus" dev="sda1" ino=13872 res=1 block nbd1: Attempted send on invalid socket print_req_error: I/O error, dev nbd1, sector 1 VFS: unable to read V7 FS superblock on device nbd1. VFS: could not find a valid V7 on nbd1. unregister_netdevice: waiting for ip6gre0 to become free. Usage count = -1 audit: type=1800 audit(1673011014.302:5): pid=11776 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.2" name="file0" dev="sda1" ino=14198 res=0 BTRFS error (device loop3): unsupported checksum algorithm 3 BTRFS error (device loop3): superblock checksum mismatch BTRFS error (device loop3): open_ctree failed befs: (nbd4): No write support. Marking filesystem read-only block nbd4: Attempted send on invalid socket print_req_error: I/O error, dev nbd4, sector 0 befs: (nbd4): unable to read superblock befs: (nbd4): No write support. Marking filesystem read-only block nbd4: Attempted send on invalid socket print_req_error: I/O error, dev nbd4, sector 0 befs: (nbd4): unable to read superblock BTRFS error (device loop3): unsupported checksum algorithm 3 BTRFS error (device loop3): superblock checksum mismatch befs: (nbd4): No write support. Marking filesystem read-only block nbd4: Attempted send on invalid socket print_req_error: I/O error, dev nbd4, sector 0 befs: (nbd4): unable to read superblock BTRFS error (device loop3): open_ctree failed befs: (nbd4): No write support. Marking filesystem read-only audit: type=1800 audit(1673011015.182:6): pid=11862 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.2" name="file0" dev="sda1" ino=14204 res=0 block nbd4: Attempted send on invalid socket print_req_error: I/O error, dev nbd4, sector 0 befs: (nbd4): unable to read superblock BTRFS error (device loop3): unsupported checksum algorithm 3 BTRFS error (device loop3): superblock checksum mismatch BTRFS error (device loop3): open_ctree failed hfsplus: failed to load root directory audit: type=1800 audit(1673011015.502:7): pid=11926 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.2" name="file0" dev="sda1" ino=14219 res=0 BTRFS error (device loop3): unsupported checksum algorithm 3 BTRFS error (device loop3): superblock checksum mismatch BTRFS error (device loop3): open_ctree failed caif:caif_disconnect_client(): nothing to disconnect BTRFS error (device loop1): unsupported checksum algorithm 1 BTRFS error (device loop1): superblock checksum mismatch BTRFS error (device loop1): open_ctree failed audit: type=1800 audit(1673011016.632:8): pid=11997 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.1" name="bus" dev="sda1" ino=14218 res=0 audit: type=1804 audit(1673011016.632:9): pid=11997 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.1" name="/root/syzkaller-testdir1164563783/syzkaller.FIuewa/111/bus" dev="sda1" ino=14218 res=1 nbd: must specify a device to reconfigure MTD: Attempt to mount non-MTD device "/dev/loop4" romfs: Mounting image 'rom 637cf1fa' through the block layer MTD: Attempt to mount non-MTD device "/dev/loop4" romfs: Mounting image 'rom 637cf1fa' through the block layer netlink: 24 bytes leftover after parsing attributes in process `syz-executor.5'. MTD: Attempt to mount non-MTD device "/dev/loop4" romfs: Mounting image 'rom 637cf1fa' through the block layer netlink: 24 bytes leftover after parsing attributes in process `syz-executor.5'. MTD: Attempt to mount non-MTD device "/dev/loop3" romfs: bad initial checksum on dev loop3. MTD: Attempt to mount non-MTD device "/dev/loop4" romfs: Mounting image 'rom 637cf1fa' through the block layer netlink: 12 bytes leftover after parsing attributes in process `syz-executor.2'. netlink: 24 bytes leftover after parsing attributes in process `syz-executor.5'. MTD: Attempt to mount non-MTD device "/dev/loop3" romfs: bad initial checksum on dev loop3. netlink: 12 bytes leftover after parsing attributes in process `syz-executor.2'. print_req_error: I/O error, dev loop3, sector 2 netlink: 4564 bytes leftover after parsing attributes in process `syz-executor.4'. Buffer I/O error on dev loop3, logical block 1, async page read print_req_error: I/O error, dev loop3, sector 4 Buffer I/O error on dev loop3, logical block 2, async page read print_req_error: I/O error, dev loop3, sector 6 Buffer I/O error on dev loop3, logical block 3, async page read netlink: 24 bytes leftover after parsing attributes in process `syz-executor.4'. MTD: Attempt to mount non-MTD device "/dev/loop3" romfs: bad initial checksum on dev loop3. netlink: 12 bytes leftover after parsing attributes in process `syz-executor.2'. netlink: 24 bytes leftover after parsing attributes in process `syz-executor.5'. MTD: Attempt to mount non-MTD device "/dev/loop3" EXT4-fs (loop4): couldn't mount RDWR because of unsupported optional features (8000) netlink: 12 bytes leftover after parsing attributes in process `syz-executor.2'. romfs: bad initial checksum on dev loop3.