======================================================
WARNING: possible circular locking dependency detected
5.1.0-rc7+ #93 Not tainted
------------------------------------------------------
syz-executor.2/27226 is trying to acquire lock:
000000002e5c528d (&acct->lock#2){+.+.}, at: acct_pin_kill+0x27/0x100 kernel/acct.c:173

but task is already holding lock:
00000000ee9d98c5 (sb_writers#3){.+.+}, at: sb_start_write include/linux/fs.h:1621 [inline]
00000000ee9d98c5 (sb_writers#3){.+.+}, at: mnt_want_write+0x3f/0xc0 fs/namespace.c:358

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (sb_writers#3){.+.+}:
       lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4211
       percpu_down_read include/linux/percpu-rwsem.h:36 [inline]
       __sb_start_write+0x20b/0x360 fs/super.c:1613
       sb_start_write include/linux/fs.h:1621 [inline]
       mnt_want_write+0x3f/0xc0 fs/namespace.c:358
       ovl_want_write+0x76/0xa0 fs/overlayfs/util.c:24
       ovl_xattr_set+0x53/0x5b0 fs/overlayfs/inode.c:332
       ovl_other_xattr_set+0x39/0x50 fs/overlayfs/super.c:946
       __vfs_removexattr+0x112/0x180 fs/xattr.c:376
       vfs_removexattr+0xb7/0x200 fs/xattr.c:395
       removexattr+0xda/0x130 fs/xattr.c:690
       path_removexattr+0x166/0x180 fs/xattr.c:704
       __do_sys_removexattr fs/xattr.c:718 [inline]
       __se_sys_removexattr fs/xattr.c:715 [inline]
       __x64_sys_removexattr+0x59/0x80 fs/xattr.c:715
       do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #1 (&ovl_i_mutex_key[depth]){+.+.}:
       lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4211
       down_write+0x38/0x90 kernel/locking/rwsem.c:70
       inode_lock include/linux/fs.h:772 [inline]
       ovl_write_iter+0x148/0xc20 fs/overlayfs/file.c:231
       call_write_iter include/linux/fs.h:1866 [inline]
       new_sync_write+0x4c7/0x760 fs/read_write.c:474
       __vfs_write+0xe4/0x110 fs/read_write.c:487
       __kernel_write+0x110/0x3b0 fs/read_write.c:506
       do_acct_process+0xd37/0x1150 kernel/acct.c:520
       slow_acct_process kernel/acct.c:579 [inline]
       acct_process+0x568/0x61e kernel/acct.c:605
       do_exit+0x17bd/0x2fa0 kernel/exit.c:866
       do_group_exit+0x135/0x370 kernel/exit.c:980
       __do_sys_exit_group kernel/exit.c:991 [inline]
       __se_sys_exit_group kernel/exit.c:989 [inline]
       __x64_sys_exit_group+0x44/0x50 kernel/exit.c:989
       do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

-> #0 (&acct->lock#2){+.+.}:
       check_prevs_add kernel/locking/lockdep.c:2333 [inline]
       validate_chain kernel/locking/lockdep.c:2714 [inline]
       __lock_acquire+0x239c/0x3fb0 kernel/locking/lockdep.c:3701
       lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4211
       __mutex_lock_common kernel/locking/mutex.c:925 [inline]
       __mutex_lock+0xf7/0x1310 kernel/locking/mutex.c:1072
       mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1087
       acct_pin_kill+0x27/0x100 kernel/acct.c:173
       pin_kill+0x18f/0x860 fs/fs_pin.c:50
       acct_on+0x574/0x790 kernel/acct.c:254
       __do_sys_acct kernel/acct.c:286 [inline]
       __se_sys_acct kernel/acct.c:273 [inline]
       __x64_sys_acct+0xae/0x200 kernel/acct.c:273
       do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

other info that might help us debug this:

Chain exists of:
  &acct->lock#2 --> &ovl_i_mutex_key[depth] --> sb_writers#3

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sb_writers#3);
                               lock(&ovl_i_mutex_key[depth]);
                               lock(sb_writers#3);
  lock(&acct->lock#2);

 *** DEADLOCK ***

2 locks held by syz-executor.2/27226:
 #0: 000000000da1a6f9 (acct_on_mutex){+.+.}, at: __do_sys_acct kernel/acct.c:285 [inline]
 #0: 000000000da1a6f9 (acct_on_mutex){+.+.}, at: __se_sys_acct kernel/acct.c:273 [inline]
 #0: 000000000da1a6f9 (acct_on_mutex){+.+.}, at: __x64_sys_acct+0xa6/0x200 kernel/acct.c:273
 #1: 00000000ee9d98c5 (sb_writers#3){.+.+}, at: sb_start_write include/linux/fs.h:1621 [inline]
 #1: 00000000ee9d98c5 (sb_writers#3){.+.+}, at: mnt_want_write+0x3f/0xc0 fs/namespace.c:358

stack backtrace:
CPU: 1 PID: 27226 Comm: syz-executor.2 Not tainted 5.1.0-rc7+ #93
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+0x172/0x1f0 lib/dump_stack.c:113
 print_circular_bug.isra.0.cold+0x1cc/0x28f kernel/locking/lockdep.c:1571
 check_prev_add.constprop.0+0xf11/0x23c0 kernel/locking/lockdep.c:2220
 check_prevs_add kernel/locking/lockdep.c:2333 [inline]
 validate_chain kernel/locking/lockdep.c:2714 [inline]
 __lock_acquire+0x239c/0x3fb0 kernel/locking/lockdep.c:3701
 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4211
 __mutex_lock_common kernel/locking/mutex.c:925 [inline]
 __mutex_lock+0xf7/0x1310 kernel/locking/mutex.c:1072
 mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:1087
 acct_pin_kill+0x27/0x100 kernel/acct.c:173
 pin_kill+0x18f/0x860 fs/fs_pin.c:50
 acct_on+0x574/0x790 kernel/acct.c:254
 __do_sys_acct kernel/acct.c:286 [inline]
 __se_sys_acct kernel/acct.c:273 [inline]
 __x64_sys_acct+0xae/0x200 kernel/acct.c:273
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x2000020d
Code: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 65 64 25 a7 4a 2a e9 2c a8 42 98 0f 05 <bf> 10 00 74 00 c4 a3 7b f0 c5 01 41 e2 e9 b5 c4 22 eb aa bb 3c 00
RSP: 002b:00007f5af9b07bd8 EFLAGS: 00000a87 ORIG_RAX: 00000000000000a3
RAX: ffffffffffffffda RBX: 0000000000000009 RCX: 000000002000020d
RDX: c6a0e87d0fb80841 RSI: 0000000000000000 RDI: 0000000000740010
RBP: 000000000000008a R08: 0000000000000005 R09: 0000000000000006
R10: 0000000000000007 R11: 0000000000000a87 R12: 000000000000000b
R13: 000000000000000c R14: 000000000000000d R15: 00000000ffffffff