block nbd4: Device being setup by another task ====================================================== WARNING: possible circular locking dependency detected 4.19.211-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.5/28437 is trying to acquire lock: 00000000f32c61e1 (&sbi->alloc_mutex){+.+.}, at: hfsplus_block_free+0xdb/0x5d0 fs/hfsplus/bitmap.c:182 but task is already holding lock: 00000000ff223f23 (&HFSPLUS_I(inode)->extents_lock){+.+.}, at: hfsplus_file_truncate+0x1e2/0x1040 fs/hfsplus/extents.c:576 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&HFSPLUS_I(inode)->extents_lock){+.+.}: hfsplus_get_block+0x292/0x960 fs/hfsplus/extents.c:260 block_read_full_page+0x288/0xd10 fs/buffer.c:2259 do_read_cache_page+0x533/0x1170 mm/filemap.c:2828 read_mapping_page include/linux/pagemap.h:402 [inline] hfsplus_block_allocate+0x197/0xa60 fs/hfsplus/bitmap.c:37 hfsplus_file_extend+0x436/0xf40 fs/hfsplus/extents.c:468 hfsplus_get_block+0x196/0x960 fs/hfsplus/extents.c:245 __block_write_begin_int+0x46c/0x17b0 fs/buffer.c:1978 __block_write_begin fs/buffer.c:2028 [inline] block_write_begin+0x58/0x2e0 fs/buffer.c:2087 cont_write_begin+0x55a/0x820 fs/buffer.c:2440 hfsplus_write_begin+0x87/0x150 fs/hfsplus/inode.c:52 cont_expand_zero fs/buffer.c:2367 [inline] cont_write_begin+0x2ee/0x820 fs/buffer.c:2430 hfsplus_write_begin+0x87/0x150 fs/hfsplus/inode.c:52 generic_cont_expand_simple+0x106/0x170 fs/buffer.c:2331 hfsplus_setattr+0x18b/0x310 fs/hfsplus/inode.c:257 notify_change+0x70b/0xfc0 fs/attr.c:334 do_truncate+0x134/0x1f0 fs/open.c:63 do_sys_ftruncate+0x492/0x560 fs/open.c:194 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe -> #0 (&sbi->alloc_mutex){+.+.}: __mutex_lock_common kernel/locking/mutex.c:937 [inline] __mutex_lock+0xd7/0x1190 kernel/locking/mutex.c:1078 hfsplus_block_free+0xdb/0x5d0 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x228/0x520 fs/hfsplus/extents.c:363 hfsplus_file_truncate+0xd96/0x1040 fs/hfsplus/extents.c:591 hfsplus_delete_inode+0x18d/0x220 fs/hfsplus/inode.c:419 hfsplus_unlink+0x595/0x820 fs/hfsplus/dir.c:405 hfsplus_rename+0xbe/0x200 fs/hfsplus/dir.c:545 vfs_rename+0x67e/0x1bc0 fs/namei.c:4479 do_renameat2+0xb59/0xc70 fs/namei.c:4629 __do_sys_rename fs/namei.c:4675 [inline] __se_sys_rename fs/namei.c:4673 [inline] __x64_sys_rename+0x5d/0x80 fs/namei.c:4673 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&HFSPLUS_I(inode)->extents_lock); lock(&sbi->alloc_mutex); lock(&HFSPLUS_I(inode)->extents_lock); lock(&sbi->alloc_mutex); *** DEADLOCK *** 8 locks held by syz-executor.5/28437: #0: 0000000038e40cf9 (sb_writers#27){.+.+}, at: sb_start_write include/linux/fs.h:1579 [inline] #0: 0000000038e40cf9 (sb_writers#27){.+.+}, at: mnt_want_write+0x3a/0xb0 fs/namespace.c:360 #1: 00000000a9747087 (&type->s_vfs_rename_key#7){+.+.}, at: lock_rename+0x54/0x280 fs/namei.c:2867 #2: 0000000009551865 (&type->i_mutex_dir_key#16/1){+.+.}, at: inode_lock_nested include/linux/fs.h:783 [inline] #2: 0000000009551865 (&type->i_mutex_dir_key#16/1){+.+.}, at: lock_rename+0x132/0x280 fs/namei.c:2878 #3: 00000000917843df (&type->i_mutex_dir_key#16/2){+.+.}, at: inode_lock_nested include/linux/fs.h:783 [inline] #3: 00000000917843df (&type->i_mutex_dir_key#16/2){+.+.}, at: lock_rename+0x166/0x280 fs/namei.c:2879 #4: 000000008baba5f4 (&sb->s_type->i_mutex_key#34){+.+.}, at: inode_lock include/linux/fs.h:748 [inline] #4: 000000008baba5f4 (&sb->s_type->i_mutex_key#34){+.+.}, at: lock_two_nondirectories+0xec/0x110 fs/inode.c:1015 #5: 0000000008f3cb98 (&sb->s_type->i_mutex_key#34/4){+.+.}, at: inode_lock_nested include/linux/fs.h:783 [inline] #5: 0000000008f3cb98 (&sb->s_type->i_mutex_key#34/4){+.+.}, at: lock_two_nondirectories+0xd1/0x110 fs/inode.c:1017 #6: 00000000d8d13856 (&sbi->vh_mutex){+.+.}, at: hfsplus_unlink+0x140/0x820 fs/hfsplus/dir.c:370 #7: 00000000ff223f23 (&HFSPLUS_I(inode)->extents_lock){+.+.}, at: hfsplus_file_truncate+0x1e2/0x1040 fs/hfsplus/extents.c:576 stack backtrace: CPU: 0 PID: 28437 Comm: syz-executor.5 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 hfsplus_block_free+0xdb/0x5d0 fs/hfsplus/bitmap.c:182 hfsplus_free_extents+0x228/0x520 fs/hfsplus/extents.c:363 hfsplus_file_truncate+0xd96/0x1040 fs/hfsplus/extents.c:591 hfsplus_delete_inode+0x18d/0x220 fs/hfsplus/inode.c:419 hfsplus_unlink+0x595/0x820 fs/hfsplus/dir.c:405 hfsplus_rename+0xbe/0x200 fs/hfsplus/dir.c:545 vfs_rename+0x67e/0x1bc0 fs/namei.c:4479 do_renameat2+0xb59/0xc70 fs/namei.c:4629 __do_sys_rename fs/namei.c:4675 [inline] __se_sys_rename fs/namei.c:4673 [inline] __x64_sys_rename+0x5d/0x80 fs/namei.c:4673 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f8fb5f760a9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f8fb44e8168 EFLAGS: 00000246 ORIG_RAX: 0000000000000052 RAX: ffffffffffffffda RBX: 00007f8fb6095f80 RCX: 00007f8fb5f760a9 RDX: 0000000000000000 RSI: 0000000020000140 RDI: 0000000020000000 RBP: 00007f8fb5fd1ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd4aea7e8f R14: 00007f8fb44e8300 R15: 0000000000022000 audit: type=1804 audit(1672049910.346:1257): pid=28445 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir981354164/syzkaller.F1T7gW/405/bus" dev="sda1" ino=14087 res=1 attempt to access beyond end of device loop5: rw=0, want=201326594, limit=1024 Buffer I/O error on dev loop5, logical block 100663296, async page read hfsplus: unable to mark blocks free: error -5 hfsplus: can't free extent block nbd4: Device being setup by another task audit: type=1804 audit(1672049911.246:1258): pid=28455 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir981354164/syzkaller.F1T7gW/406/bus" dev="sda1" ino=14069 res=1 attempt to access beyond end of device loop5: rw=0, want=201326594, limit=1024 Buffer I/O error on dev loop5, logical block 100663296, async page read hfsplus: unable to mark blocks free: error -5 hfsplus: can't free extent device lo entered promiscuous mode block nbd4: Device being setup by another task audit: type=1804 audit(1672049911.836:1259): pid=28490 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir981354164/syzkaller.F1T7gW/407/bus" dev="sda1" ino=13950 res=1 IPVS: ftp: loaded support on port[0] = 21 block nbd4: Device being setup by another task device lo left promiscuous mode block nbd4: Device being setup by another task kauditd_printk_skb: 1 callbacks suppressed audit: type=1804 audit(1672049912.667:1261): pid=28552 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.0" name="/root/syzkaller-testdir1014385318/syzkaller.rtucYT/365/bus" dev="sda1" ino=14355 res=1 device lo entered promiscuous mode audit: type=1804 audit(1672049912.677:1262): pid=28553 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir981354164/syzkaller.F1T7gW/409/bus" dev="sda1" ino=14371 res=1 block nbd4: Device being setup by another task audit: type=1804 audit(1672049913.107:1263): pid=28566 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir981354164/syzkaller.F1T7gW/410/bus" dev="sda1" ino=14532 res=1 IPVS: ftp: loaded support on port[0] = 21 batman_adv: batadv0: Interface deactivated: batadv_slave_0 batman_adv: batadv0: Removing interface: batadv_slave_0 batman_adv: batadv0: Interface deactivated: batadv_slave_1 batman_adv: batadv0: Removing interface: batadv_slave_1 device bridge_slave_1 left promiscuous mode bridge0: port 2(bridge_slave_1) entered disabled state device bridge_slave_0 left promiscuous mode bridge0: port 1(bridge_slave_0) entered disabled state device veth1_macvtap left promiscuous mode device veth0_macvtap left promiscuous mode device veth1_vlan left promiscuous mode device veth0_vlan left promiscuous mode device hsr_slave_1 left promiscuous mode device hsr_slave_0 left promiscuous mode team0 (unregistering): Port device team_slave_1 removed team0 (unregistering): Port device team_slave_0 removed bond0 (unregistering): Releasing backup interface bond_slave_1 bond0 (unregistering): Releasing backup interface bond_slave_0 bond0 (unregistering): Released all slaves IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 block nbd4: Device being setup by another task audit: type=1804 audit(1672049917.497:1264): pid=28668 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir981354164/syzkaller.F1T7gW/411/bus" dev="sda1" ino=14852 res=1 IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 IPVS: ftp: loaded support on port[0] = 21 block nbd4: Device being setup by another task IPVS: ftp: loaded support on port[0] = 21 audit: type=1804 audit(1672049918.387:1265): pid=28930 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir981354164/syzkaller.F1T7gW/412/bus" dev="sda1" ino=15218 res=1 block nbd4: Device being setup by another task audit: type=1804 audit(1672049918.887:1266): pid=29016 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir981354164/syzkaller.F1T7gW/413/bus" dev="sda1" ino=14168 res=1 block nbd5: Device being setup by another task audit: type=1804 audit(1672049919.127:1267): pid=29034 uid=60929 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.3" name="/root/syzkaller-testdir1525651174/syzkaller.XtJH9w/385/bus" dev="sda1" ino=15138 res=1 block nbd4: Device being setup by another task audit: type=1804 audit(1672049919.617:1268): pid=29045 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.4" name="/root/syzkaller-testdir981354164/syzkaller.F1T7gW/414/bus" dev="sda1" ino=15090 res=1 EXT4-fs (loop5): mounted filesystem without journal. Opts: ,errors=continue audit: type=1804 audit(1672049919.807:1269): pid=29054 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.5" name="/root/syzkaller-testdir1083116500/syzkaller.EUtb13/61/file0/bus" dev="loop5" ino=18 res=1 audit: type=1804 audit(1672049919.807:1270): pid=29054 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.5" name="/root/syzkaller-testdir1083116500/syzkaller.EUtb13/61/file0/bus" dev="loop5" ino=18 res=1 audit: type=1804 audit(1672049919.817:1271): pid=29054 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=ToMToU comm="syz-executor.5" name="/root/syzkaller-testdir1083116500/syzkaller.EUtb13/61/file0/bus" dev="loop5" ino=18 res=1 block nbd4: Device being setup by another task EXT4-fs (loop5): mounted filesystem without journal. Opts: ,errors=continue IPVS: ftp: loaded support on port[0] = 21