syzbot


possible deadlock in evict (3)

Status: upstream: reported on 2023/02/28 17:25
Labels: ext4 (incorrect?)
Reported-by: syzbot+dd426ae4af71f1e74729@syzkaller.appspotmail.com
First crash: 98d, last: 37d
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ext4?] possible deadlock in evict (3) 3 (4) 2023/03/01 21:55
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in evict (2) ext4 39 104d 407d 0/24 closed as dup on 2022/04/21 19:37
upstream possible deadlock in evict 3 811d 839d 0/24 auto-closed as invalid on 2021/07/11 09:40

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.3.0-syzkaller #0 Not tainted
------------------------------------------------------
kswapd0/110 is trying to acquire lock:
ffff88801c9e4650 (sb_internal){.+.+}-{0:0}, at: evict+0x2ed/0x6b0 fs/inode.c:665

but task is already holding lock:
ffffffff8c8e11c0 (fs_reclaim){+.+.}-{0:0}, at: set_task_reclaim_state mm/vmscan.c:200 [inline]
ffffffff8c8e11c0 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat+0x170/0x1ac0 mm/vmscan.c:7338

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (fs_reclaim){+.+.}-{0:0}:
       __fs_reclaim_acquire mm/page_alloc.c:4717 [inline]
       fs_reclaim_acquire+0x11d/0x160 mm/page_alloc.c:4731
       might_alloc include/linux/sched/mm.h:271 [inline]
       slab_pre_alloc_hook mm/slab.h:728 [inline]
       slab_alloc_node mm/slab.c:3241 [inline]
       __kmem_cache_alloc_node+0x3b/0x3f0 mm/slab.c:3541
       kmalloc_node_trace+0x21/0xd0 mm/slab_common.c:1074
       kmalloc_node include/linux/slab.h:606 [inline]
       kzalloc_node include/linux/slab.h:731 [inline]
       mempool_create_node mm/mempool.c:272 [inline]
       mempool_create+0x52/0xc0 mm/mempool.c:261
       mempool_create_page_pool include/linux/mempool.h:112 [inline]
       fscrypt_initialize+0x8a/0xa0 fs/crypto/crypto.c:332
       fscrypt_setup_encryption_info+0xef/0xeb0 fs/crypto/keysetup.c:563
       fscrypt_get_encryption_info+0x375/0x450 fs/crypto/keysetup.c:668
       fscrypt_setup_filename+0x23c/0xec0 fs/crypto/fname.c:458
       ext4_fname_setup_filename+0x8c/0x110 fs/ext4/crypto.c:28
       ext4_find_entry+0x8c/0x140 fs/ext4/namei.c:1724
       ext4_rename+0x5d0/0x2790 fs/ext4/namei.c:3840
       ext4_rename2+0x1c7/0x270 fs/ext4/namei.c:4200
       vfs_rename+0xef6/0x17a0 fs/namei.c:4772
       do_renameat2+0xb62/0xc90 fs/namei.c:4923
       __do_sys_renameat2 fs/namei.c:4956 [inline]
       __se_sys_renameat2 fs/namei.c:4953 [inline]
       __x64_sys_renameat2+0xe8/0x120 fs/namei.c:4953
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #2 (fscrypt_init_mutex){+.+.}-{3:3}:
       __mutex_lock_common kernel/locking/mutex.c:603 [inline]
       __mutex_lock+0x12f/0x1350 kernel/locking/mutex.c:747
       fscrypt_initialize+0x40/0xa0 fs/crypto/crypto.c:326
       fscrypt_setup_encryption_info+0xef/0xeb0 fs/crypto/keysetup.c:563
       fscrypt_get_encryption_info+0x375/0x450 fs/crypto/keysetup.c:668
       fscrypt_setup_filename+0x23c/0xec0 fs/crypto/fname.c:458
       ext4_fname_setup_filename+0x8c/0x110 fs/ext4/crypto.c:28
       ext4_add_entry+0x3aa/0xe30 fs/ext4/namei.c:2379
       ext4_rename+0x1a6a/0x2790 fs/ext4/namei.c:3915
       ext4_rename2+0x1c7/0x270 fs/ext4/namei.c:4200
       vfs_rename+0xef6/0x17a0 fs/namei.c:4772
       do_renameat2+0xb62/0xc90 fs/namei.c:4923
       __do_sys_renameat2 fs/namei.c:4956 [inline]
       __se_sys_renameat2 fs/namei.c:4953 [inline]
       __x64_sys_renameat2+0xe8/0x120 fs/namei.c:4953
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #1 (jbd2_handle){++++}-{0:0}:
       start_this_handle+0xfe7/0x14e0 fs/jbd2/transaction.c:463
       jbd2__journal_start+0x390/0x850 fs/jbd2/transaction.c:520
       __ext4_journal_start_sb+0x411/0x5d0 fs/ext4/ext4_jbd2.c:111
       ext4_sample_last_mounted fs/ext4/file.c:851 [inline]
       ext4_file_open+0x618/0xbf0 fs/ext4/file.c:880
       do_dentry_open+0x6cc/0x13f0 fs/open.c:920
       do_open fs/namei.c:3560 [inline]
       path_openat+0x1baa/0x2750 fs/namei.c:3715
       do_filp_open+0x1ba/0x410 fs/namei.c:3742
       do_sys_openat2+0x16d/0x4c0 fs/open.c:1348
       do_sys_open fs/open.c:1364 [inline]
       __do_sys_openat fs/open.c:1380 [inline]
       __se_sys_openat fs/open.c:1375 [inline]
       __x64_sys_openat+0x143/0x1f0 fs/open.c:1375
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

-> #0 (sb_internal){.+.+}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3098 [inline]
       check_prevs_add kernel/locking/lockdep.c:3217 [inline]
       validate_chain kernel/locking/lockdep.c:3832 [inline]
       __lock_acquire+0x2ec7/0x5d40 kernel/locking/lockdep.c:5056
       lock_acquire kernel/locking/lockdep.c:5669 [inline]
       lock_acquire+0x1af/0x520 kernel/locking/lockdep.c:5634
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1477 [inline]
       sb_start_intwrite include/linux/fs.h:1599 [inline]
       ext4_evict_inode+0x114b/0x1ca0 fs/ext4/inode.c:240
       evict+0x2ed/0x6b0 fs/inode.c:665
       iput_final fs/inode.c:1748 [inline]
       iput.part.0+0x50a/0x740 fs/inode.c:1774
       iput+0x5c/0x80 fs/inode.c:1764
       dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401
       __dentry_kill+0x3c0/0x640 fs/dcache.c:607
       shrink_dentry_list+0x12c/0x4f0 fs/dcache.c:1201
       prune_dcache_sb+0xeb/0x150 fs/dcache.c:1282
       super_cache_scan+0x33a/0x590 fs/super.c:104
       do_shrink_slab+0x428/0xaa0 mm/vmscan.c:853
       shrink_slab+0x175/0x660 mm/vmscan.c:1013
       shrink_one+0x502/0x810 mm/vmscan.c:5343
       shrink_many mm/vmscan.c:5394 [inline]
       lru_gen_shrink_node mm/vmscan.c:5511 [inline]
       shrink_node+0x2064/0x35f0 mm/vmscan.c:6459
       kswapd_shrink_node mm/vmscan.c:7262 [inline]
       balance_pgdat+0xa02/0x1ac0 mm/vmscan.c:7452
       kswapd+0x677/0xd60 mm/vmscan.c:7712
       kthread+0x2e8/0x3a0 kernel/kthread.c:376
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

other info that might help us debug this:

Chain exists of:
  sb_internal --> fscrypt_init_mutex --> fs_reclaim

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(fs_reclaim);
                               lock(fscrypt_init_mutex);
                               lock(fs_reclaim);
  lock(sb_internal);

 *** DEADLOCK ***

3 locks held by kswapd0/110:
 #0: ffffffff8c8e11c0 (fs_reclaim){+.+.}-{0:0}, at: set_task_reclaim_state mm/vmscan.c:200 [inline]
 #0: ffffffff8c8e11c0 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat+0x170/0x1ac0 mm/vmscan.c:7338
 #1: ffffffff8c897f30 (shrinker_rwsem){++++}-{3:3}, at: shrink_slab+0xc7/0x660 mm/vmscan.c:1003
 #2: ffff88801c9e40e0 (&type->s_umount_key#50){++++}-{3:3}, at: trylock_super fs/super.c:414 [inline]
 #2: ffff88801c9e40e0 (&type->s_umount_key#50){++++}-{3:3}, at: super_cache_scan+0x70/0x590 fs/super.c:79

stack backtrace:
CPU: 3 PID: 110 Comm: kswapd0 Not tainted 6.3.0-syzkaller #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2178
 check_prev_add kernel/locking/lockdep.c:3098 [inline]
 check_prevs_add kernel/locking/lockdep.c:3217 [inline]
 validate_chain kernel/locking/lockdep.c:3832 [inline]
 __lock_acquire+0x2ec7/0x5d40 kernel/locking/lockdep.c:5056
 lock_acquire kernel/locking/lockdep.c:5669 [inline]
 lock_acquire+0x1af/0x520 kernel/locking/lockdep.c:5634
 percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
 __sb_start_write include/linux/fs.h:1477 [inline]
 sb_start_intwrite include/linux/fs.h:1599 [inline]
 ext4_evict_inode+0x114b/0x1ca0 fs/ext4/inode.c:240
 evict+0x2ed/0x6b0 fs/inode.c:665
 iput_final fs/inode.c:1748 [inline]
 iput.part.0+0x50a/0x740 fs/inode.c:1774
 iput+0x5c/0x80 fs/inode.c:1764
 dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:401
 __dentry_kill+0x3c0/0x640 fs/dcache.c:607
 shrink_dentry_list+0x12c/0x4f0 fs/dcache.c:1201
 prune_dcache_sb+0xeb/0x150 fs/dcache.c:1282
 super_cache_scan+0x33a/0x590 fs/super.c:104
 do_shrink_slab+0x428/0xaa0 mm/vmscan.c:853
 shrink_slab+0x175/0x660 mm/vmscan.c:1013
 shrink_one+0x502/0x810 mm/vmscan.c:5343
 shrink_many mm/vmscan.c:5394 [inline]
 lru_gen_shrink_node mm/vmscan.c:5511 [inline]
 shrink_node+0x2064/0x35f0 mm/vmscan.c:6459
 kswapd_shrink_node mm/vmscan.c:7262 [inline]
 balance_pgdat+0xa02/0x1ac0 mm/vmscan.c:7452
 kswapd+0x677/0xd60 mm/vmscan.c:7712
 kthread+0x2e8/0x3a0 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
 </TASK>

Crashes (108):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Manager Title
2023/04/24 09:25 upstream 457391b03803 c778c7f4 .config console log report info ci-qemu-upstream possible deadlock in evict
2023/04/23 21:48 upstream 457391b03803 2b32bd34 .config console log report info ci-qemu-upstream possible deadlock in evict
2023/04/22 20:15 upstream 2caeeb9d4a1b 2b32bd34 .config console log report info ci-qemu-upstream possible deadlock in evict
2023/04/20 10:24 upstream cb0856346a60 5ed6c74d .config console log report info ci-qemu-upstream possible deadlock in evict
2023/04/14 13:05 upstream 44149752e998 ec410564 .config console log report info ci-qemu-upstream possible deadlock in evict
2023/04/08 02:53 upstream aa318c48808c 71147e29 .config console log report info ci-qemu-upstream possible deadlock in evict
2023/04/05 15:46 upstream 76f598ba7d8e 8b834965 .config console log report info ci-qemu-upstream possible deadlock in evict
2023/04/05 12:37 upstream 76f598ba7d8e 831373d3 .config console log report info ci-qemu-upstream possible deadlock in evict
2023/04/03 07:48 upstream 7e364e56293b 41147e3e .config console log report info ci-qemu-upstream possible deadlock in evict
2023/04/02 20:38 upstream 6ab608fe852b f325deb0 .config console log report info ci-qemu-upstream possible deadlock in evict
2023/03/30 19:02 upstream 8bb95a1662f8 f325deb0 .config console log report info ci-qemu-upstream possible deadlock in evict
2023/02/28 17:01 upstream ae3419fbac84 95aee97a .config console log report info ci-qemu-upstream possible deadlock in evict
2023/02/27 23:06 upstream 982818426a0f e792ae78 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in evict
2023/04/26 16:06 upstream 0cfd8703e7da 19a3dabe .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/25 13:36 upstream 173ea743bf7a 65320f8e .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/25 11:17 upstream 173ea743bf7a 65320f8e .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/24 03:39 upstream 457391b03803 2b32bd34 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/24 00:23 upstream 457391b03803 2b32bd34 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/23 21:44 upstream 457391b03803 2b32bd34 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/19 16:29 upstream 789b4a41c247 94b4184e .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/18 14:58 upstream 6a8f57ae2eb0 d931e9f0 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/17 18:55 upstream 6a8f57ae2eb0 c6ec7083 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/17 04:07 upstream 6a8f57ae2eb0 ec410564 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/17 01:14 upstream 6a8f57ae2eb0 ec410564 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/15 10:24 upstream 7a934f4bd7d6 ec410564 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/15 01:41 upstream 95abc817ab3a ec410564 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/13 12:57 upstream de4664485abb 3cfcaa1b .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/12 22:51 upstream 0bcc40255504 82d5e53e .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/12 19:45 upstream 0bcc40255504 82d5e53e .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/12 02:01 upstream 2c40519251d6 49faf98d .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/11 21:41 upstream 2c40519251d6 49faf98d .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/09 23:42 upstream 09a9639e56c0 71147e29 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/09 10:24 upstream cdc9718d5e59 71147e29 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/08 17:52 upstream aa318c48808c 71147e29 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/08 14:51 upstream aa318c48808c 71147e29 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/07 21:21 upstream f2afccfefe7b 71147e29 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/07 12:29 upstream f2afccfefe7b f7ba566d .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/07 00:04 upstream f2afccfefe7b 00ce4c67 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/06 19:52 upstream f2afccfefe7b 08707520 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/06 09:02 upstream 99ddf2254feb 08707520 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/05 20:17 upstream 99ddf2254feb 8b834965 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/05 00:00 upstream 76f598ba7d8e 831373d3 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/04 11:12 upstream 148341f0a2f5 928dd177 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/04 09:27 upstream 148341f0a2f5 928dd177 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/03 10:25 upstream 7e364e56293b 41147e3e .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/02 03:30 upstream 00c7b5f4ddc5 f325deb0 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/04/01 10:38 upstream 7b50567bdcad f325deb0 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/03/31 11:29 upstream 62bad54b26db f325deb0 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/03/31 05:31 upstream 8bb95a1662f8 f325deb0 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/03/31 00:11 upstream 8bb95a1662f8 f325deb0 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/03/30 17:57 upstream 8bb95a1662f8 f325deb0 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/02/24 17:18 upstream d2980d8d8265 630c6bc9 .config console log report info ci-qemu-upstream-386 possible deadlock in evict
2023/03/01 12:58 net-next-old 5b7c4cabbb65 f8902b57 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce possible deadlock in evict
* Struck through repros no longer work on HEAD.