From: Dave Chinner <david@fromorbit.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: "Darrick J . Wong" <darrick.wong@oracle.com>,
Eryu Guan <guaneryu@gmail.com>,
Miklos Szeredi <miklos@szeredi.hu>,
linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] xfs: fix GPF in swapfile_activate of file from overlayfs
Date: Sat, 25 Aug 2018 09:39:01 +1000 [thread overview]
Message-ID: <20180824233901.GA2234@dastard> (raw)
In-Reply-To: <1535101371-26461-1-git-send-email-amir73il@gmail.com>
On Fri, Aug 24, 2018 at 12:02:51PM +0300, Amir Goldstein wrote:
> Since overlayfs implements stacked file operations, f_inode
> is no longer euqivalent to f_mapping->host and xfs should use
> the latter, same as generic_swapfile_activate().
Since when has file_inode() not pointed to the inode backing the
struct file?
> Using f_inode results in an attempt to dereference an xfs_inode
> struct from an ovl_inode pointer:
>
> CPU: 0 PID: 2462 Comm: swapon Not tainted
> 4.18.0-xfstests-12721-g33e17876ea4e #3402
> RIP: 0010:xfs_find_bdev_for_inode+0x23/0x2f
> Call Trace:
> xfs_iomap_swapfile_activate+0x1f/0x43
> __se_sys_swapon+0xb1a/0xee9
>
> Fixes: d1d04ef8572b ("ovl: stack file ops")
Oh, since about 3 days ago.
So now we've got to deal with a vfs interface change that isn't
documented, hasn't been clearly communicated prior to merging, and
it subtly breaks a subset of callers.
So, please enlighten me with a documentation patch before changing
any XFS code: What is the new behaviour and the rules we must follow
for calling file_inode()?
I'm also interested in understanding whether anyone auditted all the
callers to see if they follow those rules. There are another
20-odd file_inode() calls in XFS, and ~750 across fs/. How many
other places have been checked for correctness under the new rules?
i.e. I can't review this patch without also confirming that all the
other file_inode() callers in XFS are still correct, and I can't do
that until I understand what the new behaviour of file_inode() is
and when it is not safe to use.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2018-08-25 3:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-24 9:02 [PATCH] xfs: fix GPF in swapfile_activate of file from overlayfs Amir Goldstein
2018-08-24 23:39 ` Dave Chinner [this message]
2018-08-25 10:47 ` Amir Goldstein
2018-08-25 20:04 ` Miklos Szeredi
2018-08-26 11:32 ` Amir Goldstein
2018-08-26 22:59 ` Dave Chinner
2018-08-27 7:17 ` Amir Goldstein
2018-08-26 22:52 ` Dave Chinner
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=20180824233901.GA2234@dastard \
--to=david@fromorbit.com \
--cc=amir73il@gmail.com \
--cc=darrick.wong@oracle.com \
--cc=guaneryu@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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).