syzbot


possible deadlock in hfsplus_file_extend

Status: upstream: reported C repro on 2023/03/13 14:24
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+a9b05956c6ee2e5563cb@syzkaller.appspotmail.com
First crash: 434d, last: 1h22m
Bug presence (1)
Date Name Commit Repro Result
2023/12/28 upstream (ToT) f5837722ffec C [report] possible deadlock in hfsplus_file_extend
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 possible deadlock in hfsplus_file_extend hfsplus C 3 442d 508d 0/1 upstream: reported C repro on 2022/12/29 06:07
linux-5.15 possible deadlock in hfsplus_file_extend missing-backport origin:lts-only C 1897 2h41m 436d 0/3 upstream: reported C repro on 2023/03/11 17:12
linux-4.19 possible deadlock in hfsplus_file_extend hfsplus C 258 441d 541d 0/1 upstream: reported C repro on 2022/11/26 10:00
upstream possible deadlock in hfsplus_file_extend hfs C error 24056 6m 541d 0/26 upstream: reported C repro on 2022/11/26 08:07

Sample crash report:
loop0: detected capacity change from 0 to 1024
======================================================
WARNING: possible circular locking dependency detected
6.1.69-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor122/3542 is trying to acquire lock:
ffff88807c1a07c8 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_extend+0x1d2/0x1b10 fs/hfsplus/extents.c:457

but task is already holding lock:
ffff88807594e0b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x146/0x1c0

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&tree->tree_lock){+.+.}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
       hfsplus_file_truncate+0x80d/0xb40 fs/hfsplus/extents.c:595
       hfsplus_setattr+0x1b9/0x280 fs/hfsplus/inode.c:269
       notify_change+0xce3/0xfc0 fs/attr.c:499
       do_truncate+0x21c/0x300 fs/open.c:65
       handle_truncate fs/namei.c:3217 [inline]
       do_open fs/namei.c:3562 [inline]
       path_openat+0x27e2/0x2e60 fs/namei.c:3715
       do_filp_open+0x230/0x480 fs/namei.c:3742
       do_sys_openat2+0x13b/0x500 fs/open.c:1318
       __do_sys_openat2 fs/open.c:1375 [inline]
       __se_sys_openat2+0x237/0x2c0 fs/open.c:1353
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3090 [inline]
       check_prevs_add kernel/locking/lockdep.c:3209 [inline]
       validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
       hfsplus_file_extend+0x1d2/0x1b10 fs/hfsplus/extents.c:457
       hfsplus_bmap_reserve+0x101/0x4e0 fs/hfsplus/btree.c:358
       hfsplus_rename_cat+0x1cf/0x1090 fs/hfsplus/catalog.c:456
       hfsplus_rename+0x12a/0x1b0 fs/hfsplus/dir.c:552
       vfs_rename+0xbfc/0xf90 fs/namei.c:4786
       do_renameat2+0xcbd/0x1300 fs/namei.c:4936
       __do_sys_renameat2 fs/namei.c:4969 [inline]
       __se_sys_renameat2 fs/namei.c:4966 [inline]
       __x64_sys_renameat2+0xce/0xe0 fs/namei.c:4966
       do_syscall_x64 arch/x86/entry/common.c:51 [inline]
       do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&tree->tree_lock);
                               lock(&HFSPLUS_I(inode)->extents_lock);
                               lock(&tree->tree_lock);
  lock(&HFSPLUS_I(inode)->extents_lock);

 *** DEADLOCK ***

4 locks held by syz-executor122/3542:
 #0: ffff888075948460 (sb_writers#9){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393
 #1: ffff88807c1a1e00 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:791 [inline]
 #1: ffff88807c1a1e00 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: lock_rename+0xf6/0x1c0 fs/namei.c:2991
 #2: ffff88807c1a24c0 (&type->i_mutex_dir_key#6){++++}-{3:3}, at: inode_lock_nested include/linux/fs.h:791 [inline]
 #2: ffff88807c1a24c0 (&type->i_mutex_dir_key#6){++++}-{3:3}, at: lock_two_inodes+0xfc/0x180 fs/inode.c:1143
 #3: ffff88807594e0b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x146/0x1c0

stack backtrace:
CPU: 1 PID: 3542 Comm: syz-executor122 Not tainted 6.1.69-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2170
 check_prev_add kernel/locking/lockdep.c:3090 [inline]
 check_prevs_add kernel/locking/lockdep.c:3209 [inline]
 validate_chain+0x1661/0x5950 kernel/locking/lockdep.c:3825
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5049
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5662
 __mutex_lock_common kernel/locking/mutex.c:603 [inline]
 __mutex_lock+0x132/0xd80 kernel/locking/mutex.c:747
 hfsplus_file_extend+0x1d2/0x1b10 fs/hfsplus/extents.c:457
 hfsplus_bmap_reserve+0x101/0x4e0 fs/hfsplus/btree.c:358
 hfsplus_rename_cat+0x1cf/0x1090 fs/hfsplus/catalog.c:456
 hfsplus_rename+0x12a/0x1b0 fs/hfsplus/dir.c:552
 vfs_rename+0xbfc/0xf90 fs/namei.c:4786
 do_renameat2+0xcbd/0x1300 fs/namei.c:4936
 __do_sys_renameat2 fs/namei.c:4969 [inline]
 __se_sys_renameat2 fs/namei.c:4966 [inline]
 __x64_sys_renameat2+0xce/0xe0 fs/namei.c:4966
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f3e429567b9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 61 17 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:00007ffd979920d8 EFLAGS: 00000246 ORIG_RAX: 000000000000013c
RAX: ffffffffffffffda RBX: 0030656c69662f2e RCX: 00007f3e429567

Crashes (1948):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/01/01 11:03 linux-6.1.y 4aa6747d9352 fb427a07 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2023/12/28 06:58 linux-6.1.y 4aa6747d9352 fb427a07 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/01/21 12:13 linux-6.1.y 8fd7f4462453 9bd8dcda .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2023/08/11 07:32 linux-6.1.y 0a4a7855302d da3c3ef8 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/21 03:41 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/21 01:56 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/21 00:53 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/19 21:39 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/19 19:54 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/19 03:32 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/19 03:32 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/19 00:42 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/18 22:44 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/18 20:16 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/18 13:20 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/18 02:42 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/17 09:13 linux-6.1.y 909ba1f1b414 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/17 04:39 linux-6.1.y 909ba1f1b414 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/17 02:06 linux-6.1.y 909ba1f1b414 c2e07261 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/16 12:00 linux-6.1.y 909ba1f1b414 ef5d53ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/16 08:18 linux-6.1.y 909ba1f1b414 ef5d53ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/15 19:33 linux-6.1.y 909ba1f1b414 94b087b1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/15 16:24 linux-6.1.y 909ba1f1b414 94b087b1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/14 09:24 linux-6.1.y 909ba1f1b414 fdb4c10c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/14 06:41 linux-6.1.y 909ba1f1b414 fdb4c10c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/14 04:02 linux-6.1.y 909ba1f1b414 fdb4c10c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/14 02:57 linux-6.1.y 909ba1f1b414 fdb4c10c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/13 09:08 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/12 19:38 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/12 06:49 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/12 04:02 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/12 01:06 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/11 14:48 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/11 14:44 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/11 11:55 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/11 00:29 linux-6.1.y 909ba1f1b414 f7c35481 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/05/20 21:52 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/19 05:52 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/18 14:38 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/18 11:59 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/18 04:57 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/17 20:39 linux-6.1.y 4078fa637fcd a12e99e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/17 16:24 linux-6.1.y 4078fa637fcd a12e99e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/17 15:23 linux-6.1.y 4078fa637fcd a12e99e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/17 15:11 linux-6.1.y 4078fa637fcd a12e99e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/16 04:37 linux-6.1.y 909ba1f1b414 ef5d53ed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/15 13:34 linux-6.1.y 909ba1f1b414 94b087b1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/15 00:51 linux-6.1.y 909ba1f1b414 fdb4c10c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/14 05:07 linux-6.1.y 909ba1f1b414 fdb4c10c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/13 23:19 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/13 12:08 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/13 06:37 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/11 22:55 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/05/11 21:44 linux-6.1.y 909ba1f1b414 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2023/03/13 14:24 linux-6.1.y 6449a0ba6843 026e2200 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
* Struck through repros no longer work on HEAD.