syzbot


possible deadlock in hfs_find_init

Status: fixed on 2021/11/10 00:50
Subsystems: hfs
[Documentation on labels]
Reported-by: syzbot+b718ec84a87b7e73ade4@syzkaller.appspotmail.com
Fix commit: b3b2177a2d79 hfs: add lock nesting notation to hfs_find_init
First crash: 2429d, last: 1436d
Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: possible deadlock in hfs_find_init (log)
Repro: C syz .config
  
Fix bisection: failed (error log, bisect log)
  
Discussions (18)
Title Replies (including bot) Last reply
[PATCH 4.14 00/38] 4.14.242-rc1 review 42 (42) 2021/08/04 02:56
[PATCH 4.9 00/32] 4.9.278-rc1 review 35 (35) 2021/08/03 19:14
[PATCH 4.4 00/26] 4.4.278-rc1 review 30 (30) 2021/08/03 19:14
[PATCH 5.10 00/24] 5.10.55-rc1 review 34 (34) 2021/07/31 07:51
[PATCH 5.13 00/22] 5.13.7-rc1 review 29 (29) 2021/07/31 05:36
[PATCH 5.4 00/21] 5.4.137-rc1 review 27 (27) 2021/07/31 04:43
[PATCH 4.19 00/17] 4.19.200-rc1 review 23 (23) 2021/07/31 04:42
[PATCH AUTOSEL 5.13 01/19] net/802/mrp: fix memleak in mrp_request_join() 23 (23) 2021/07/28 14:07
[PATCH AUTOSEL 4.4 1/7] net/802/mrp: fix memleak in mrp_request_join() 7 (7) 2021/07/23 03:59
[PATCH AUTOSEL 4.9 1/7] net/802/mrp: fix memleak in mrp_request_join() 7 (7) 2021/07/23 03:59
[PATCH AUTOSEL 4.14 1/8] net/802/mrp: fix memleak in mrp_request_join() 8 (8) 2021/07/23 03:58
[PATCH AUTOSEL 4.19 01/11] net/802/mrp: fix memleak in mrp_request_join() 11 (11) 2021/07/23 03:58
[PATCH AUTOSEL 5.4 01/14] net/802/mrp: fix memleak in mrp_request_join() 14 (14) 2021/07/23 03:58
[PATCH AUTOSEL 5.10 01/17] net/802/mrp: fix memleak in mrp_request_join() 17 (17) 2021/07/23 03:57
[patch 12/13] hfs: add lock nesting notation to hfs_find_init 1 (1) 2021/07/15 04:27
[PATCH v2 0/3] hfs: fix various errors 8 (8) 2021/07/01 17:04
[PATCH 0/3] hfs: fix various errors 10 (10) 2021/06/30 16:49
possible deadlock in hfs_find_init 0 (1) 2018/04/23 01:02
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 possible deadlock in hfs_find_init origin:upstream C error 85 5d19h 631d 0/3 upstream: reported C repro on 2023/03/22 23:14
linux-4.14 possible deadlock in hfs_find_init hfs C 1 654d 687d 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 648d 714d 0/1 upstream: reported C repro on 2022/12/30 06:08
upstream possible deadlock in hfs_find_init (2) hfs C error 2025 10m 717d 0/28 upstream: reported C repro on 2022/12/27 00:59
linux-6.1 possible deadlock in hfs_find_init origin:upstream C 104 10h51m 634d 0/3 upstream: reported C repro on 2023/03/20 17:38
Last patch testing requests (4)
Created Duration User Patch Repo Result
2021/06/29 13:59 13m desmondcheongzx@gmail.com patch upstream OK
2021/06/29 10:48 14m desmondcheongzx@gmail.com patch upstream OK
2021/06/29 07:16 8m desmondcheongzx@gmail.com patch upstream report log
2021/06/29 06:56 8m desmondcheongzx@gmail.com patch upstream report log
Fix bisection attempts (16)
Created Duration User Patch Repo Result
2021/03/01 06:05 0m bisect fix upstream error job log
2021/02/06 14:26 1m bisect fix upstream error job log
2021/01/07 13:12 15m bisect fix upstream OK (0) job log log
2020/12/07 11:44 15m bisect fix upstream OK (0) job log log
2020/11/07 02:12 15m bisect fix upstream OK (0) job log log
2020/10/07 04:43 16m bisect fix upstream OK (0) job log log
2020/08/27 03:27 15m bisect fix upstream OK (0) job log log
2020/07/26 13:57 15m bisect fix upstream OK (0) job log log
2020/06/15 14:44 17m bisect fix upstream OK (0) job log log
2020/05/16 13:37 17m bisect fix upstream OK (0) job log log
2020/04/16 13:20 16m bisect fix upstream OK (0) job log log
2020/03/16 22:33 17m bisect fix upstream OK (0) job log log
2020/02/11 21:34 17m bisect fix upstream OK (0) job log log
2020/01/12 21:07 17m bisect fix upstream OK (0) job log log
2019/12/10 14:13 17m bisect fix upstream OK (0) job log log
2019/08/01 07:19 18m bisect fix upstream OK (0) job log log

Sample crash report:
hfs: unable to locate alternate MDB
hfs: continuing without an alternate MDB

============================================
WARNING: possible recursive locking detected
4.17.0-rc1+ #9 Not tainted
--------------------------------------------
syzkaller905163/4505 is trying to acquire lock:
00000000cf71528f (&tree->tree_lock){+.+.}, at: hfs_find_init+0x11c/0x180 fs/hfs/bfind.c:28

but task is already holding lock:
000000007d108cde (&tree->tree_lock){+.+.}, at: hfs_find_init+0x11c/0x180 fs/hfs/bfind.c:28

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

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

 *** DEADLOCK ***

 May be due to missing lock nesting notation

3 locks held by syzkaller905163/4505:
 #0: 000000005253f77a (&type->s_umount_key#36/1){+.+.}, at: alloc_super fs/super.c:212 [inline]
 #0: 000000005253f77a (&type->s_umount_key#36/1){+.+.}, at: sget_userns+0x2dd/0xf20 fs/super.c:503
 #1: 000000007d108cde (&tree->tree_lock){+.+.}, at: hfs_find_init+0x11c/0x180 fs/hfs/bfind.c:28
 #2: 00000000d9af4d52 (&HFS_I(tree->inode)->extents_lock){+.+.}, at: hfs_get_block+0x56c/0x850 fs/hfs/extent.c:359

stack backtrace:
CPU: 1 PID: 4505 Comm: syzkaller905163 Not tainted 4.17.0-rc1+ #9
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1b9/0x294 lib/dump_stack.c:113
 print_deadlock_bug kernel/locking/lockdep.c:1761 [inline]
 check_deadlock kernel/locking/lockdep.c:1805 [inline]
 validate_chain kernel/locking/lockdep.c:2401 [inline]
 __lock_acquire.cold.62+0x18c/0x55b kernel/locking/lockdep.c:3431
 lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3920
 __mutex_lock_common kernel/locking/mutex.c:756 [inline]
 __mutex_lock+0x16d/0x17f0 kernel/locking/mutex.c:893
 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908
 hfs_find_init+0x11c/0x180 fs/hfs/bfind.c:28
 hfs_ext_read_extent+0x1b9/0xc20 fs/hfs/extent.c:196
 hfs_get_block+0x578/0x850 fs/hfs/extent.c:360
 block_read_full_page+0x2c7/0xab0 fs/buffer.c:2236
 hfs_readpage+0x1c/0x20 fs/hfs/inode.c:38
 do_read_cache_page+0x778/0x13b0 mm/filemap.c:2806
 read_cache_page+0x61/0x80 mm/filemap.c:2894
 read_mapping_page include/linux/pagemap.h:402 [inline]
 __hfs_bnode_create+0x601/0x9f0 fs/hfs/bnode.c:281
 hfs_bnode_find+0x2b8/0xb80 fs/hfs/bnode.c:330
 hfs_brec_find+0x2f3/0x5b0 fs/hfs/bfind.c:114
 hfs_brec_read+0x27/0x120 fs/hfs/bfind.c:153
 hfs_cat_find_brec+0x14a/0x400 fs/hfs/catalog.c:186
 hfs_fill_super+0x11f4/0x18c0 fs/hfs/super.c:426
 mount_bdev+0x30c/0x3e0 fs/super.c:1165
 hfs_mount+0x34/0x40 fs/hfs/super.c:463
 mount_fs+0xae/0x328 fs/super.c:1268
 vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
 vfs_kern_mount fs/namespace.c:1027 [inline]
 do_new_mount fs/namespace.c:2517 [inline]
 do_mount+0x564/0x3070 fs/namespace.c:2847
 ksys_mount+0x12d/0x140 fs/namespace.c:3063
 __do_sys_mount fs/namespace.c:3077 [inline]
 __se_sys_mount fs/namespace.c:3074 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3074
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x442e4a
RSP: 002b:00007ffe9b4269d8 EFLAGS: 00000297 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000020000258 RCX: 0000000000442e4a
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffe9b4269e0

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/04/20 19:30 upstream 43f70c960180 cc402841 .config console log report syz C ci-upstream-kasan-gce-root
* Struck through repros no longer work on HEAD.