linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: syzbot <syzbot+6a023cb2262c79301432@syzkaller.appspotmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	overlayfs <linux-unionfs@vger.kernel.org>,
	Miklos Szeredi <miklos@szeredi.hu>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>
Subject: Re: possible deadlock in ovl_dir_real_file
Date: Mon, 1 Feb 2021 11:39:16 +0200	[thread overview]
Message-ID: <CAOQ4uxip-rpMT7Mj=BW1H398FpDgDfT+PZasjQym76ueDaUqFg@mail.gmail.com> (raw)
In-Reply-To: <000000000000c83a9705ba42d18d@google.com>

On Mon, Feb 1, 2021 at 11:21 AM syzbot
<syzbot+6a023cb2262c79301432@syzkaller.appspotmail.com> wrote:
>
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit:    6642d600 Merge tag '5.11-rc5-smb3' of git://git.samba.org/..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=148aef78d00000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=9408d1770a50819c
> dashboard link: https://syzkaller.appspot.com/bug?extid=6a023cb2262c79301432
> compiler:       clang version 11.0.1
>
> Unfortunately, I don't have any reproducer for this issue yet.
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+6a023cb2262c79301432@syzkaller.appspotmail.com
>
> ============================================
> WARNING: possible recursive locking detected
> 5.11.0-rc5-syzkaller #0 Not tainted
> --------------------------------------------
> syz-executor.2/3639 is trying to acquire lock:
> ffff888084c0b5f0 (&ovl_i_mutex_dir_key[depth]){++++}-{3:3}, at: inode_lock include/linux/fs.h:773 [inline]
> ffff888084c0b5f0 (&ovl_i_mutex_dir_key[depth]){++++}-{3:3}, at: ovl_dir_real_file+0x20b/0x310 fs/overlayfs/readdir.c:886
>
> but task is already holding lock:
> ffff888084c0b5f0 (&ovl_i_mutex_dir_key[depth]){++++}-{3:3}, at: inode_lock include/linux/fs.h:773 [inline]
> ffff888084c0b5f0 (&ovl_i_mutex_dir_key[depth]){++++}-{3:3}, at: ovl_ioctl_set_flags fs/overlayfs/file.c:530 [inline]
> ffff888084c0b5f0 (&ovl_i_mutex_dir_key[depth]){++++}-{3:3}, at: ovl_ioctl+0x2fb/0x960 fs/overlayfs/file.c:569
>
> other info that might help us debug this:
>  Possible unsafe locking scenario:
>
>        CPU0
>        ----
>   lock(&ovl_i_mutex_dir_key[depth]);
>   lock(&ovl_i_mutex_dir_key[depth]);
>
>  *** DEADLOCK ***
>
>  May be due to missing lock nesting notation
>
> 2 locks held by syz-executor.2/3639:
>  #0: ffff88807a706460 (sb_writers#17){.+.+}-{0:0}, at: mnt_want_write_file+0x5a/0x250 fs/namespace.c:412
>  #1: ffff888084c0b5f0 (&ovl_i_mutex_dir_key[depth]){++++}-{3:3}, at: inode_lock include/linux/fs.h:773 [inline]
>  #1: ffff888084c0b5f0 (&ovl_i_mutex_dir_key[depth]){++++}-{3:3}, at: ovl_ioctl_set_flags fs/overlayfs/file.c:530 [inline]
>  #1: ffff888084c0b5f0 (&ovl_i_mutex_dir_key[depth]){++++}-{3:3}, at: ovl_ioctl+0x2fb/0x960 fs/overlayfs/file.c:569
>
> stack backtrace:
> CPU: 1 PID: 3639 Comm: syz-executor.2 Not tainted 5.11.0-rc5-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:79 [inline]
>  dump_stack+0x137/0x1be lib/dump_stack.c:120
>  __lock_acquire+0x2333/0x5e90 kernel/locking/lockdep.c:4670
>  lock_acquire+0x114/0x5e0 kernel/locking/lockdep.c:5442
>  down_write+0x56/0x120 kernel/locking/rwsem.c:1406
>  inode_lock include/linux/fs.h:773 [inline]
>  ovl_dir_real_file+0x20b/0x310 fs/overlayfs/readdir.c:886
>  ovl_real_fdget fs/overlayfs/file.c:136 [inline]
>  ovl_real_ioctl fs/overlayfs/file.c:499 [inline]
>  ovl_ioctl_set_flags fs/overlayfs/file.c:545 [inline]
>  ovl_ioctl+0x4de/0x960 fs/overlayfs/file.c:569
>  vfs_ioctl fs/ioctl.c:48 [inline]
>  __do_sys_ioctl fs/ioctl.c:753 [inline]
>  __se_sys_ioctl+0xfb/0x170 fs/ioctl.c:739
>  do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
>  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> RIP: 0033:0x45e219
> Code: 0d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 db b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
> RSP: 002b:00007f02ed677c68 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
> RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045e219
> RDX: 0000000000000000 RSI: 0000000040086602 RDI: 0000000000000003
> RBP: 000000000119bfc0 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 000000000119bf8c
> R13: 00007ffd373df6ef R14: 00007f02ed6789c0 R15: 000000000119bf8c
>
>

#syz fix: ovl: avoid deadlock on directory ioctl

Should be in linux-next tree already.

Thanks,
Amir.

      reply	other threads:[~2021-02-01  9:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01  9:17 possible deadlock in ovl_dir_real_file syzbot
2021-02-01  9:39 ` Amir Goldstein [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOQ4uxip-rpMT7Mj=BW1H398FpDgDfT+PZasjQym76ueDaUqFg@mail.gmail.com' \
    --to=amir73il@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=syzbot+6a023cb2262c79301432@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).