syzbot


possible deadlock in ovl_copy_up_start (4)

Status: upstream: reported on 2024/06/12 03:58
Subsystems: overlayfs
[Documentation on labels]
Reported-by: syzbot+6d34d0b636fea8b593eb@syzkaller.appspotmail.com
First crash: 41d, last: 39d
Discussions (2)
Title Replies (including bot) Last reply
[syzbot] Monthly overlayfs report (Jun 2024) 0 (1) 2024/06/15 17:49
[syzbot] [overlayfs?] possible deadlock in ovl_copy_up_start (4) 0 (1) 2024/06/12 03:58
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream possible deadlock in ovl_copy_up_start (3) overlayfs 1 106d 102d 0/27 closed as dup on 2024/04/08 10:02
linux-4.14 possible deadlock in ovl_copy_up_start (2) 6 914d 964d 0/1 auto-closed as invalid on 2022/05/17 06:42
upstream possible deadlock in ovl_copy_up_start (2) overlayfs 1 298d 294d 0/27 closed as dup on 2023/10/04 08:46
linux-4.14 possible deadlock in ovl_copy_up_start (4) 1 531d 531d 0/1 upstream: reported on 2023/02/03 17:59
linux-4.14 possible deadlock in ovl_copy_up_start (3) 2 702d 728d 0/1 auto-obsoleted due to no activity on 2022/12/14 20:28
linux-4.14 possible deadlock in ovl_copy_up_start 9 1174d 1382d 0/1 auto-closed as invalid on 2021/08/29 09:58
upstream possible deadlock in ovl_copy_up_start overlayfs 2 2093d 2101d 11/27 fixed on 2018/11/12 21:25

Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
6.10.0-rc2-syzkaller-00366-g771ed66105de #0 Not tainted
------------------------------------------------------
syz-executor.2/5264 is trying to acquire lock:
ffff888055db1698 (&ovl_i_lock_key[depth]){+.+.}-{3:3}, at: ovl_inode_lock_interruptible fs/overlayfs/overlayfs.h:657 [inline]
ffff888055db1698 (&ovl_i_lock_key[depth]){+.+.}-{3:3}, at: ovl_copy_up_start+0x53/0x310 fs/overlayfs/util.c:719

but task is already holding lock:
ffff88802fbb6420 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:409

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (sb_writers#4){.+.+}-{0:0}:
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1655 [inline]
       sb_start_write include/linux/fs.h:1791 [inline]
       ovl_start_write+0x11d/0x290 fs/overlayfs/util.c:31
       ovl_do_copy_up fs/overlayfs/copy_up.c:967 [inline]
       ovl_copy_up_one fs/overlayfs/copy_up.c:1168 [inline]
       ovl_copy_up_flags+0x1110/0x4470 fs/overlayfs/copy_up.c:1223
       ovl_create_object+0x113/0x370 fs/overlayfs/dir.c:638
       lookup_open fs/namei.c:3505 [inline]
       open_last_lookups fs/namei.c:3574 [inline]
       path_openat+0x1425/0x3280 fs/namei.c:3804
       do_filp_open+0x235/0x490 fs/namei.c:3834
       do_sys_openat2+0x13e/0x1d0 fs/open.c:1405
       do_sys_open fs/open.c:1420 [inline]
       __do_sys_openat fs/open.c:1436 [inline]
       __se_sys_openat fs/open.c:1431 [inline]
       __x64_sys_openat+0x247/0x2a0 fs/open.c:1431
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (&ovl_i_lock_key[depth]){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3869
       __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
       lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
       __mutex_lock_common kernel/locking/mutex.c:608 [inline]
       __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
       ovl_inode_lock_interruptible fs/overlayfs/overlayfs.h:657 [inline]
       ovl_copy_up_start+0x53/0x310 fs/overlayfs/util.c:719
       ovl_copy_up_one fs/overlayfs/copy_up.c:1161 [inline]
       ovl_copy_up_flags+0xbc1/0x4470 fs/overlayfs/copy_up.c:1223
       ovl_create_tmpfile fs/overlayfs/dir.c:1317 [inline]
       ovl_tmpfile+0x262/0x6d0 fs/overlayfs/dir.c:1373
       vfs_tmpfile+0x396/0x510 fs/namei.c:3701
       do_tmpfile+0x156/0x340 fs/namei.c:3764
       path_openat+0x2ab8/0x3280 fs/namei.c:3798
       do_filp_open+0x235/0x490 fs/namei.c:3834
       do_sys_openat2+0x13e/0x1d0 fs/open.c:1405
       do_sys_open fs/open.c:1420 [inline]
       __do_sys_open fs/open.c:1428 [inline]
       __se_sys_open fs/open.c:1424 [inline]
       __x64_sys_open+0x225/0x270 fs/open.c:1424
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  rlock(sb_writers#4);
                               lock(&ovl_i_lock_key[depth]);
                               lock(sb_writers#4);
  lock(&ovl_i_lock_key[depth]);

 *** DEADLOCK ***

2 locks held by syz-executor.2/5264:
 #0: ffff888060236420 (sb_writers#13){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:409
 #1: ffff88802fbb6420 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x3f/0x90 fs/namespace.c:409

stack backtrace:
CPU: 0 PID: 5264 Comm: syz-executor.2 Not tainted 6.10.0-rc2-syzkaller-00366-g771ed66105de #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2187
 check_prev_add kernel/locking/lockdep.c:3134 [inline]
 check_prevs_add kernel/locking/lockdep.c:3253 [inline]
 validate_chain+0x18e0/0x5900 kernel/locking/lockdep.c:3869
 __lock_acquire+0x1346/0x1fd0 kernel/locking/lockdep.c:5137
 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5754
 __mutex_lock_common kernel/locking/mutex.c:608 [inline]
 __mutex_lock+0x136/0xd70 kernel/locking/mutex.c:752
 ovl_inode_lock_interruptible fs/overlayfs/overlayfs.h:657 [inline]
 ovl_copy_up_start+0x53/0x310 fs/overlayfs/util.c:719
 ovl_copy_up_one fs/overlayfs/copy_up.c:1161 [inline]
 ovl_copy_up_flags+0xbc1/0x4470 fs/overlayfs/copy_up.c:1223
 ovl_create_tmpfile fs/overlayfs/dir.c:1317 [inline]
 ovl_tmpfile+0x262/0x6d0 fs/overlayfs/dir.c:1373
 vfs_tmpfile+0x396/0x510 fs/namei.c:3701
 do_tmpfile+0x156/0x340 fs/namei.c:3764
 path_openat+0x2ab8/0x3280 fs/namei.c:3798
 do_filp_open+0x235/0x490 fs/namei.c:3834
 do_sys_openat2+0x13e/0x1d0 fs/open.c:1405
 do_sys_open fs/open.c:1420 [inline]
 __do_sys_open fs/open.c:1428 [inline]
 __se_sys_open fs/open.c:1424 [inline]
 __x64_sys_open+0x225/0x270 fs/open.c:1424
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7ff91547cf69
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ff91627e0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 00007ff9155b3f80 RCX: 00007ff91547cf69
RDX: 0000000000000000 RSI: 0000000000591002 RDI: 0000000020000100
RBP: 00007ff9154da6fe R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007ff9155b3f80 R15: 00007ffe78e13ca8
 </TASK>

Crashes (7):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/06/09 23:04 upstream 771ed66105de 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ovl_copy_up_start
2024/06/09 23:01 upstream 771ed66105de 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ovl_copy_up_start
2024/06/09 23:01 upstream 771ed66105de 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root possible deadlock in ovl_copy_up_start
2024/06/09 22:56 upstream b8481381d4e2 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in ovl_copy_up_start
2024/06/09 22:56 upstream b8481381d4e2 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root possible deadlock in ovl_copy_up_start
2024/06/08 03:56 upstream 96e09b8f8166 82c05ab8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-upstream-fs possible deadlock in ovl_copy_up_start
2024/06/09 23:01 upstream 771ed66105de c2e07261 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream possible deadlock in ovl_copy_up_start
* Struck through repros no longer work on HEAD.