From: Miklos Szeredi <miklos@szeredi.hu>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Murphy Zhou <jencce.kernel@gmail.com>,
overlayfs <linux-unionfs@vger.kernel.org>
Subject: Re: [PATCH] ovl: fix oops in ovl_indexdir_cleanup() with nfs_export=on
Date: Tue, 14 Jul 2020 16:23:03 +0200 [thread overview]
Message-ID: <CAJfpegtfF-71Fucm1ZCZF96YJ6ntfc4Q+VRY45_a0iBpk6mSLw@mail.gmail.com> (raw)
In-Reply-To: <20200621063759.15497-1-amir73il@gmail.com>
On Sun, Jun 21, 2020 at 8:38 AM Amir Goldstein <amir73il@gmail.com> wrote:
>
> Mounting with nfs_export=on, xfstests overlay/031 triggers a kernel panic
> since v5.8-rc1 overlayfs updates.
>
> overlayfs: orphan index entry (index/00fb1..., ftype=4000, nlink=2)
> BUG: kernel NULL pointer dereference, address: 0000000000000030
> RIP: 0010:ovl_cleanup_and_whiteout+0x28/0x220 [overlay]
>
> Bisect point at commit c21c839b8448 ("ovl: whiteout inode sharing")
>
> Minimal reproducer:
> --------------------------------------------------
> rm -rf l u w m
> mkdir -p l u w m
> mkdir -p l/testdir
> touch l/testdir/testfile
> mount -t overlay -o lowerdir=l,upperdir=u,workdir=w,nfs_export=on overlay m
> echo 1 > m/testdir/testfile
> umount m
> rm -rf u/testdir
> mount -t overlay -o lowerdir=l,upperdir=u,workdir=w,nfs_export=on overlay m
> umount m
> --------------------------------------------------
>
> When mount with nfs_export=on, and fail to verify an orphan index, we're
> cleaning this index from indexdir by calling ovl_cleanup_and_whiteout().
> This dereferences ofs->workdir, that was earlier set to NULL.
>
> The design was that ovl->workdir will point at ovl->indexdir, but we are
> assigning ofs->indexdir to ofs->workdir only after ovl_indexdir_cleanup().
> There is no reason not to do it sooner, because once we get success from
> ofs->indexdir = ovl_workdir_create(... there is no turning back.
>
> Reported-and-tested-by: Murphy Zhou <jencce.kernel@gmail.com>
> Fixes: commit c21c839b8448 ("ovl: whiteout inode sharing")
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Thanks, applied.
Miklos
prev parent reply other threads:[~2020-07-14 14:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-21 6:37 [PATCH] ovl: fix oops in ovl_indexdir_cleanup() with nfs_export=on Amir Goldstein
2020-07-06 12:15 ` Amir Goldstein
2020-07-13 6:06 ` Murphy Zhou
2020-07-14 14:23 ` Miklos Szeredi [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=CAJfpegtfF-71Fucm1ZCZF96YJ6ntfc4Q+VRY45_a0iBpk6mSLw@mail.gmail.com \
--to=miklos@szeredi.hu \
--cc=amir73il@gmail.com \
--cc=jencce.kernel@gmail.com \
--cc=linux-unionfs@vger.kernel.org \
/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).