syzbot


possible deadlock in hfs_find_init

Status: upstream: reported C repro on 2023/03/22 23:14
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+5ec6d29e9352c6f10dc7@syzkaller.appspotmail.com
First crash: 425d, last: 14h05m
Fix bisection: failed (error log, bisect log)
  
Bug presence (1)
Date Name Commit Repro Result
2024/04/24 upstream (ToT) e88c4cfcb7b8 C [report] possible deadlock in hfs_find_init
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 possible deadlock in hfs_find_init hfs C 1 448d 480d 0/1 upstream: reported C repro on 2023/01/26 19:14
linux-4.19 possible deadlock in hfs_find_init hfs C error 7 442d 508d 0/1 upstream: reported C repro on 2022/12/30 06:08
upstream possible deadlock in hfs_find_init (2) hfs C error 354 1d00h 511d 0/26 upstream: reported C repro on 2022/12/27 00:59
linux-6.1 possible deadlock in hfs_find_init origin:upstream C 33 3d19h 427d 0/3 upstream: reported C repro on 2023/03/20 17:38
upstream possible deadlock in hfs_find_init hfs C done error 1 1230d 2220d 20/26 fixed on 2021/11/10 00:50

Sample crash report:
=======================================================
============================================
WARNING: possible recursive locking detected
5.15.153-syzkaller #0 Not tainted
--------------------------------------------
syz-executor178/3499 is trying to acquire lock:
ffff8880790b80b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfs_find_init+0x16a/0x1e0

but task is already holding lock:
ffff8880790b80b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfs_find_init+0x16a/0x1e0

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&tree->tree_lock/1);
  lock(&tree->tree_lock/1);

 *** DEADLOCK ***

 May be due to missing lock nesting notation

5 locks held by syz-executor178/3499:
 #0: ffff8880790be460 (sb_writers#9){.+.+}-{0:0}, at: vfs_write+0x29a/0xe50 fs/read_write.c:590
 #1: ffff888016591628 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline]
 #1: ffff888016591628 (&sb->s_type->i_mutex_key#15){+.+.}-{3:3}, at: generic_file_write_iter+0x7c/0x1b0 mm/filemap.c:3941
 #2: ffff888016591478 (&HFS_I(inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xfb/0x1440 fs/hfs/extent.c:397
 #3: ffff8880790b80b0 (&tree->tree_lock/1){+.+.}-{3:3}, at: hfs_find_init+0x16a/0x1e0
 #4: ffff8880165900f8 (&HFS_I(tree->inode)->extents_lock){+.+.}-{3:3}, at: hfs_extend_file+0xfb/0x1440 fs/hfs/extent.c:397

stack backtrace:
CPU: 1 PID: 3499 Comm: syz-executor178 Not tainted 5.15.153-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_deadlock_bug kernel/locking/lockdep.c:2946 [inline]
 check_deadlock kernel/locking/lockdep.c:2989 [inline]
 validate_chain+0x46d2/0x5930 kernel/locking/lockdep.c:3775
 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
 __mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
 __mutex_lock kernel/locking/mutex.c:729 [inline]
 mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
 hfs_find_init+0x16a/0x1e0
 hfs_ext_read_extent fs/hfs/extent.c:200 [inline]
 hfs_extend_file+0x317/0x1440 fs/hfs/extent.c:401
 hfs_bmap_reserve+0xd5/0x3f0 fs/hfs/btree.c:231
 __hfs_ext_write_extent+0x22e/0x4f0 fs/hfs/extent.c:121
 __hfs_ext_cache_extent+0x6a/0x990 fs/hfs/extent.c:174
 hfs_ext_read_extent fs/hfs/extent.c:202 [inline]
 hfs_extend_file+0x340/0x1440 fs/hfs/extent.c:401
 hfs_get_block+0x3e0/0xb60 fs/hfs/extent.c:353
 __block_write_begin_int+0x60b/0x1650 fs/buffer.c:2012
 __block_write_begin fs/buffer.c:2062 [inline]
 block_write_begin fs/buffer.c:2122 [inline]
 cont_write_begin+0x5d6/0x840 fs/buffer.c:2471
 hfs_write_begin+0x92/0xd0 fs/hfs/inode.c:59
 generic_perform_write+0x2bf/0x5b0 mm/filemap.c:3785
 __generic_file_write_iter+0x243/0x4f0 mm/filemap.c:3912
 generic_file_write_iter+0xa7/0x1b0 mm/filemap.c:3944
 call_write_iter include/linux/fs.h:2148 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0xacf/0xe50 fs/read_write.c:594
 ksys_write+0x1a2/0x2c0 fs/read_write.c:647
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fbb13e2ff19
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 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:00007ffd2f8fd188 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fbb13e79095 RCX: 00007fbb13e2ff19
RDX: 000000000208e24b RSI: 0000000020000080 RDI: 0000000000000005
RBP: 00007fbb13e7909d R08: 0000555556c564c0 R09: 0000555556c564c0
R10: 0000555556c564c0 R11: 0000000000000246 R12: 00007ffd2f8fd1b0
R13: 00007ffd2f8fd3d8 R14: 431bde82d7b634db R15: 00007fbb13e7903b
 </TASK>

Crashes (23):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/09 10:28 linux-5.15.y 9465fef4ae35 f3234354 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan possible deadlock in hfs_find_init
2023/06/17 03:50 linux-5.15.y 471e639e59d1 f3921d4d .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan-arm64 possible deadlock in hfs_find_init
2023/07/23 02:21 linux-5.15.y d54cfc420586 27cbe77f .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-5-15-kasan possible deadlock in hfs_find_init
2024/05/20 23:26 linux-5.15.y 83655231580b c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hfs_find_init
2024/05/20 23:24 linux-5.15.y 83655231580b c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hfs_find_init
2024/05/15 09:43 linux-5.15.y 284087d4f7d5 94b087b1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hfs_find_init
2024/05/14 07:46 linux-5.15.y 284087d4f7d5 fdb4c10c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hfs_find_init
2024/05/11 08:47 linux-5.15.y 284087d4f7d5 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hfs_find_init
2024/05/10 02:42 linux-5.15.y 284087d4f7d5 de979bc2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hfs_find_init
2024/05/07 08:52 linux-5.15.y 284087d4f7d5 fa7a5cf0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hfs_find_init
2024/05/06 14:54 linux-5.15.y 284087d4f7d5 d884b519 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hfs_find_init
2024/04/21 16:28 linux-5.15.y c52b9710c83d af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hfs_find_init
2024/04/08 02:35 linux-5.15.y 9465fef4ae35 ca620dd8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hfs_find_init
2024/05/13 18:34 linux-5.15.y 284087d4f7d5 9026e142 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in hfs_find_init
2024/05/03 22:57 linux-5.15.y 284087d4f7d5 dd26401e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in hfs_find_init
2024/04/21 16:35 linux-5.15.y c52b9710c83d af24b050 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in hfs_find_init
2024/04/18 06:01 linux-5.15.y c52b9710c83d acc528cb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in hfs_find_init
2024/01/22 16:08 linux-5.15.y ddcaf4999061 9bd8dcda .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in hfs_find_init
2023/06/15 12:29 linux-5.15.y 471e639e59d1 90d4044e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan possible deadlock in hfs_find_init
2023/07/07 17:47 linux-5.15.y d54cfc420586 668cb1fa .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in hfs_find_init
2023/04/28 19:58 linux-5.15.y f48aeeaaa64c 62df2017 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in hfs_find_init
2023/04/19 22:01 linux-5.15.y 4fdad925aa1a a219f34e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in hfs_find_init
2023/03/22 23:13 linux-5.15.y 115472395b0a f94b4a29 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 possible deadlock in hfs_find_init
* Struck through repros no longer work on HEAD.