syzbot


possible deadlock in freeze_super (3)

Status: upstream: reported on 2025/04/30 22:14
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+ddfdaf196c473805d049@syzkaller.appspotmail.com
First crash: 5d02h, last: 5d02h
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] [ext4?] possible deadlock in freeze_super (3) 0 (1) 2025/04/30 22:14
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in freeze_super (2) gfs2 C error done 15 718d 934d 22/28 fixed on 2023/06/08 14:41
linux-5.15 possible deadlock in freeze_super 1 264d 264d 0/3 auto-obsoleted due to no activity on 2024/11/18 15:18
upstream possible deadlock in freeze_super gfs2 938 1489d 1621d 0/28 auto-closed as invalid on 2021/07/02 04:50
linux-5.15 possible deadlock in freeze_super (2) origin:lts-only C error 9 5d05h 147d 0/3 upstream: reported C repro on 2024/12/05 16:25

Sample crash report:
EXT4-fs (loop1): shut down requested (0)
======================================================
WARNING: possible circular locking dependency detected
6.15.0-rc3-syzkaller-00342-g5bc1018675ec #0 Not tainted
------------------------------------------------------
syz.1.1609/17619 is trying to acquire lock:
ffff888068790610 (sb_internal){++++}-{0:0}, at: sb_wait_write fs/super.c:1855 [inline]
ffff888068790610 (sb_internal){++++}-{0:0}, at: freeze_super+0x7aa/0xeb0 fs/super.c:2063

but task is already holding lock:
ffff888068790518 (sb_pagefaults){++++}-{0:0}, at: sb_wait_write fs/super.c:1855 [inline]
ffff888068790518 (sb_pagefaults){++++}-{0:0}, at: freeze_super+0x4f1/0xeb0 fs/super.c:2049

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #4 (sb_pagefaults){++++}-{0:0}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5866
       percpu_down_read+0x44/0x1b0 include/linux/percpu-rwsem.h:52
       __sb_start_write include/linux/fs.h:1783 [inline]
       sb_start_pagefault include/linux/fs.h:1948 [inline]
       ext4_page_mkwrite+0x1de/0x1110 fs/ext4/inode.c:6220
       do_page_mkwrite+0x14a/0x310 mm/memory.c:3287
       do_shared_fault mm/memory.c:5594 [inline]
       do_fault mm/memory.c:5656 [inline]
       do_pte_missing mm/memory.c:4160 [inline]
       handle_pte_fault mm/memory.c:5997 [inline]
       __handle_mm_fault+0x18d2/0x5380 mm/memory.c:6140
       handle_mm_fault+0x2d5/0x7f0 mm/memory.c:6309
       do_user_addr_fault+0x764/0x1390 arch/x86/mm/fault.c:1388
       handle_page_fault arch/x86/mm/fault.c:1480 [inline]
       exc_page_fault+0x68/0x110 arch/x86/mm/fault.c:1538
       asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:623

-> #3 (&mm->mmap_lock){++++}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5866
       __might_fault+0xcc/0x130 mm/memory.c:7151
       _inline_copy_to_user include/linux/uaccess.h:192 [inline]
       _copy_to_user+0x2c/0xb0 lib/usercopy.c:26
       copy_to_user include/linux/uaccess.h:225 [inline]
       fiemap_fill_next_extent+0x1c0/0x390 fs/ioctl.c:145
       ocfs2_fiemap+0x888/0xc90 fs/ocfs2/extent_map.c:806
       ioctl_fiemap fs/ioctl.c:220 [inline]
       do_vfs_ioctl+0x1638/0x1eb0 fs/ioctl.c:840
       __do_sys_ioctl fs/ioctl.c:904 [inline]
       __se_sys_ioctl+0x82/0x170 fs/ioctl.c:892
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xf6/0x210 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #2 (&ocfs2_quota_ip_alloc_sem_key){++++}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5866
       down_write+0x96/0x1f0 kernel/locking/rwsem.c:1577
       ocfs2_create_local_dquot+0x19d/0x1a40 fs/ocfs2/quota_local.c:1232
       ocfs2_acquire_dquot+0x80f/0xb30 fs/ocfs2/quota_global.c:883
       dqget+0x7ae/0xf10 fs/quota/dquot.c:977
       dquot_get_dqblk+0x22/0x60 fs/quota/dquot.c:2684
       quota_getquota+0x287/0x4f0 fs/quota/quota.c:214
       __do_sys_quotactl fs/quota/quota.c:961 [inline]
       __se_sys_quotactl+0x279/0x950 fs/quota/quota.c:917
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xf6/0x210 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&dquot->dq_lock){+.+.}-{4:4}:
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5866
       __mutex_lock_common kernel/locking/mutex.c:601 [inline]
       __mutex_lock+0x182/0xe80 kernel/locking/mutex.c:746
       dquot_release+0x66/0x600 fs/quota/dquot.c:531
       ext4_release_dquot+0x3ee/0x6c0 fs/ext4/ext4_jbd2.h:-1
       quota_release_workfn+0x35c/0x610 fs/quota/dquot.c:840
       process_one_work kernel/workqueue.c:3238 [inline]
       process_scheduled_works+0xadb/0x17a0 kernel/workqueue.c:3319
       worker_thread+0x8a0/0xda0 kernel/workqueue.c:3400
       kthread+0x70e/0x8a0 kernel/kthread.c:464
       ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:153
       ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

-> #0 (sb_internal){++++}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3166 [inline]
       check_prevs_add kernel/locking/lockdep.c:3285 [inline]
       validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3909
       __lock_acquire+0xaac/0xd20 kernel/locking/lockdep.c:5235
       lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5866
       percpu_down_write+0x54/0x330 kernel/locking/percpu-rwsem.c:229
       sb_wait_write fs/super.c:1855 [inline]
       freeze_super+0x7aa/0xeb0 fs/super.c:2063
       fs_bdev_freeze+0x19f/0x310 fs/super.c:1484
       bdev_freeze+0xd5/0x220 block/bdev.c:298
       ext4_force_shutdown+0x322/0x560 fs/ext4/ioctl.c:822
       ext4_ioctl_shutdown fs/ext4/ioctl.c:857 [inline]
       __ext4_ioctl fs/ext4/ioctl.c:1581 [inline]
       ext4_ioctl+0x1d1d/0x34f0 fs/ext4/ioctl.c:1620
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:906 [inline]
       __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:892
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0xf6/0x210 arch/x86/entry/syscall_64.c:94
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

Chain exists of:
  sb_internal --> &mm->mmap_lock --> sb_pagefaults

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sb_pagefaults);
                               lock(&mm->mmap_lock);
                               lock(sb_pagefaults);
  lock(sb_internal);

 *** DEADLOCK ***

4 locks held by syz.1.1609/17619:
 #0: ffff88802294c6b0 (&bdev->bd_fsfreeze_mutex){+.+.}-{4:4}, at: bdev_freeze+0x2a/0x220 block/bdev.c:289
 #1: ffff888068790420 (sb_writers#4){++++}-{0:0}, at: sb_wait_write fs/super.c:1855 [inline]
 #1: ffff888068790420 (sb_writers#4){++++}-{0:0}, at: freeze_super+0x4c2/0xeb0 fs/super.c:2044
 #2: ffff8880687900e0 (&type->s_umount_key#30){++++}-{4:4}, at: __super_lock fs/super.c:56 [inline]
 #2: ffff8880687900e0 (&type->s_umount_key#30){++++}-{4:4}, at: __super_lock_excl fs/super.c:71 [inline]
 #2: ffff8880687900e0 (&type->s_umount_key#30){++++}-{4:4}, at: freeze_super+0x4ca/0xeb0 fs/super.c:2045
 #3: ffff888068790518 (sb_pagefaults){++++}-{0:0}, at: sb_wait_write fs/super.c:1855 [inline]
 #3: ffff888068790518 (sb_pagefaults){++++}-{0:0}, at: freeze_super+0x4f1/0xeb0 fs/super.c:2049

stack backtrace:
CPU: 0 UID: 0 PID: 17619 Comm: syz.1.1609 Not tainted 6.15.0-rc3-syzkaller-00342-g5bc1018675ec #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/19/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
 print_circular_bug+0x2ee/0x310 kernel/locking/lockdep.c:2079
 check_noncircular+0x134/0x160 kernel/locking/lockdep.c:2211
 check_prev_add kernel/locking/lockdep.c:3166 [inline]
 check_prevs_add kernel/locking/lockdep.c:3285 [inline]
 validate_chain+0xb9b/0x2140 kernel/locking/lockdep.c:3909
 __lock_acquire+0xaac/0xd20 kernel/locking/lockdep.c:5235
 lock_acquire+0x120/0x360 kernel/locking/lockdep.c:5866
 percpu_down_write+0x54/0x330 kernel/locking/percpu-rwsem.c:229
 sb_wait_write fs/super.c:1855 [inline]
 freeze_super+0x7aa/0xeb0 fs/super.c:2063
 fs_bdev_freeze+0x19f/0x310 fs/super.c:1484
 bdev_freeze+0xd5/0x220 block/bdev.c:298
 ext4_force_shutdown+0x322/0x560 fs/ext4/ioctl.c:822
 ext4_ioctl_shutdown fs/ext4/ioctl.c:857 [inline]
 __ext4_ioctl fs/ext4/ioctl.c:1581 [inline]
 ext4_ioctl+0x1d1d/0x34f0 fs/ext4/ioctl.c:1620
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:906 [inline]
 __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:892
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0xf6/0x210 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f10c5d8e969
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f10c6c05038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f10c5fb5fa0 RCX: 00007f10c5d8e969
RDX: 00002000000003c0 RSI: 000000008004587d RDI: 0000000000000004
RBP: 00007f10c5e10ab1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f10c5fb5fa0 R15: 00007ffe2f425698
 </TASK>

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/04/26 22:06 upstream 5bc1018675ec c6b4fb39 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in freeze_super
* Struck through repros no longer work on HEAD.