syzbot


possible deadlock in hfsplus_file_extend

Status: fixed on 2024/09/08 06:54
Bug presence: origin:upstream
Labels: missing-backport
[Documentation on labels]
Reported-by: syzbot+a9b05956c6ee2e5563cb@syzkaller.appspotmail.com
Fix commit: c11c3a4524be hfsplus: fix to avoid false alarm of circular locking
First crash: 619d, last: 110d
Fix bisection: fixed by (bisect log) :
commit c11c3a4524beae83026b19c9ce3b3c28d2641e32
Author: Chao Yu <chao@kernel.org>
Date: Fri Jun 7 14:23:04 2024 +0000

  hfsplus: fix to avoid false alarm of circular locking

  
Bug presence (3)
Date Name Commit Repro Result
2024/07/24 linux-6.1.y (ToT) 9b3f9a5b12dc C [report] possible deadlock in hfsplus_file_extend
2023/12/28 upstream (ToT) f5837722ffec C [report] possible deadlock in hfsplus_file_extend
2024/07/24 upstream (ToT) 786c8248dbd3 C Didn't crash
Similar bugs (6)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in hfsplus_file_extend (2) hfs C 3 13d 10d 0/28 upstream: reported C repro on 2024/11/11 11:50
linux-5.15 possible deadlock in hfsplus_file_extend (2) 2 39d 39d 0/3 upstream: reported on 2024/10/13 10:23
linux-4.14 possible deadlock in hfsplus_file_extend hfsplus C 3 627d 693d 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 done 3439 94d 620d 3/3 fixed on 2024/09/23 09:27
linux-4.19 possible deadlock in hfsplus_file_extend hfsplus C 258 626d 726d 0/1 upstream: reported C repro on 2022/11/26 10:00
upstream possible deadlock in hfsplus_file_extend hfs C error done 31659 38d 726d 28/28 fixed on 2024/10/21 12:45

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-executor680/3542 is trying to acquire lock:
ffff88807d2487c8 (&HFSPLUS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfsplus_file_extend+0x1d2/0x1b10 fs/hfsplus/extents.c:457

but task is already holding lock:
ffff8880772900b0 (&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_open fs/open.c:1334 [inline]
       __do_sys_creat fs/open.c:1410 [inline]
       __se_sys_creat fs/open.c:1404 [inline]
       __x64_sys_creat+0x11f/0x160 fs/open.c:1404
       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_rename fs/namei.c:4982 [inline]
       __se_sys_rename fs/namei.c:4980 [inline]
       __x64_sys_rename+0x82/0x90 fs/namei.c:4980
       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 ***

5 locks held by syz-executor680/3542:
 #0: ffff88807d194460 (sb_writers#9){.+.+}-{0:0}, at: mnt_want_write+0x3b/0x80 fs/namespace.c:393
 #1: ffff88807d249e00 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:791 [inline]
 #1: ffff88807d249e00 (&type->i_mutex_dir_key#6/1){+.+.}-{3:3}, at: lock_rename+0xf6/0x1c0 fs/namei.c:2991
 #2: ffff88807cda09c0 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: inode_lock_nested include/linux/fs.h:791 [inline]
 #2: ffff88807cda09c0 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: lock_two_inodes+0xfc/0x180 fs/inode.c:1143
 #3: ffff88807d24ab80 (&sb->s_type->i_mutex_key#15/4){+.+.}-{3:3}, at: vfs_rename+0x749/0xf90 fs/namei.c:4758
 #4: ffff8880772900b0 (&tree->tree_lock){+.+.}-{3:3}, at: hfsplus_find_init+0x146/0x1c0

stack backtrace:
CPU: 1 PID: 3542 Comm: syz-executor680 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_rename fs/namei.c:4982 [inline]
 __se_sys_rename fs/namei.c:4980 [inline]
 __x64_sys_rename+0x82/0x90 fs/namei.c:4980
 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:0x7f350e0b36f9
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:00007ffe68b2a4a8 EFLAGS: 00000246 ORIG_RAX: 0000000000000052
RAX: ffffffffffffffda RBX: 0031656c69662f2e RCX: 00007f350e0b36f9
RDX: 00007f350e0b36f9 RSI: 0000000020000300 RDI: 0000000020000b00

Crashes (2760):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
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/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
2024/08/03 06:07 linux-6.1.y c1cec4dad96b 1786a2a8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/08/03 04:14 linux-6.1.y c1cec4dad96b 1786a2a8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/08/03 02:59 linux-6.1.y c1cec4dad96b 1786a2a8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/08/03 00:40 linux-6.1.y c1cec4dad96b 1786a2a8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/08/02 20:10 linux-6.1.y c1cec4dad96b 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/08/02 18:44 linux-6.1.y c1cec4dad96b 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/08/01 09:36 linux-6.1.y c1cec4dad96b 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/08/01 06:39 linux-6.1.y c1cec4dad96b 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/08/01 05:29 linux-6.1.y c1cec4dad96b 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/08/01 03:23 linux-6.1.y c1cec4dad96b 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/08/01 00:26 linux-6.1.y c1cec4dad96b 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/31 23:05 linux-6.1.y c1cec4dad96b 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/30 23:09 linux-6.1.y c1cec4dad96b 6fde257d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/30 18:17 linux-6.1.y c1cec4dad96b 6fde257d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/30 14:48 linux-6.1.y c1cec4dad96b 5187fc86 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/29 23:00 linux-6.1.y c1cec4dad96b 5187fc86 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/29 21:42 linux-6.1.y c1cec4dad96b 5187fc86 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/29 19:53 linux-6.1.y c1cec4dad96b 5187fc86 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/29 18:25 linux-6.1.y c1cec4dad96b 5187fc86 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/29 15:53 linux-6.1.y c1cec4dad96b 5187fc86 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/29 14:36 linux-6.1.y c1cec4dad96b 5187fc86 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/29 13:29 linux-6.1.y c1cec4dad96b 5187fc86 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/29 11:25 linux-6.1.y c1cec4dad96b 5187fc86 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/28 01:13 linux-6.1.y c1cec4dad96b 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/27 19:30 linux-6.1.y c1cec4dad96b 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/27 18:21 linux-6.1.y c1cec4dad96b 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/27 16:55 linux-6.1.y c1cec4dad96b 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/27 15:21 linux-6.1.y c1cec4dad96b 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/27 12:10 linux-6.1.y c1cec4dad96b 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/26 22:21 linux-6.1.y c18e82d3ee44 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/26 19:59 linux-6.1.y c18e82d3ee44 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/26 06:55 linux-6.1.y c18e82d3ee44 3f86dfed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/26 06:18 linux-6.1.y c18e82d3ee44 3f86dfed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/26 03:59 linux-6.1.y c18e82d3ee44 3f86dfed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/26 02:13 linux-6.1.y c18e82d3ee44 3f86dfed .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/25 20:54 linux-6.1.y c18e82d3ee44 466a14e5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/07/25 18:25 linux-6.1.y c18e82d3ee44 466a14e5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in hfsplus_file_extend
2024/08/02 13:22 linux-6.1.y c1cec4dad96b 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/08/02 10:34 linux-6.1.y c1cec4dad96b 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/08/02 08:08 linux-6.1.y c1cec4dad96b 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/08/01 12:37 linux-6.1.y c1cec4dad96b 1e9c4cf3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/07/31 01:33 linux-6.1.y c1cec4dad96b 6fde257d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/07/30 21:01 linux-6.1.y c1cec4dad96b 6fde257d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/07/30 08:24 linux-6.1.y c1cec4dad96b 5187fc86 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/07/27 14:01 linux-6.1.y c1cec4dad96b 46eb10b7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in hfsplus_file_extend
2024/07/26 23:22 linux-6.1.y c18e82d3ee44 46eb10b7 .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.