From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org, billodo@redhat.com
Subject: Re: [PATCH 1/2] libxfs: add more bounds checking to sb sanity checks
Date: Fri, 27 Jul 2018 09:28:55 +1000 [thread overview]
Message-ID: <20180726232855.GD2234@dastard> (raw)
In-Reply-To: <153262651940.8934.17525988748289196893.stgit@magnolia>
On Thu, Jul 26, 2018 at 10:35:19AM -0700, Darrick J. Wong wrote:
> From: Bill O'Donnell <billodo@redhat.com>
>
> Current sb verifier doesn't check bounds on sb_fdblocks and sb_ifree.
> Add sanity checks for these parameters.
>
> Signed-off-by: Bill O'Donnell <billodo@redhat.com>
> [darrick: remove the icount check, tweak the comments a little]
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/libxfs/xfs_sb.c | 45 +++++++++++++++++++++++++++++++++++----------
> 1 file changed, 35 insertions(+), 10 deletions(-)
>
>
> diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
> index b3ad15956366..b2c683588519 100644
> --- a/fs/xfs/libxfs/xfs_sb.c
> +++ b/fs/xfs/libxfs/xfs_sb.c
> @@ -599,22 +599,16 @@ xfs_sb_to_disk(
> static int
> xfs_sb_verify(
> struct xfs_buf *bp,
> + struct xfs_sb *sb,
> bool check_version)
> {
> struct xfs_mount *mp = bp->b_target->bt_mount;
> - struct xfs_sb sb;
> -
> - /*
> - * Use call variant which doesn't convert quota flags from disk
> - * format, because xfs_mount_validate_sb checks the on-disk flags.
> - */
> - __xfs_sb_from_disk(&sb, XFS_BUF_TO_SBP(bp), false);
>
> /*
> * Only check the in progress field for the primary superblock as
> * mkfs.xfs doesn't clear it from secondary superblocks.
> */
> - return xfs_mount_validate_sb(mp, &sb,
> + return xfs_mount_validate_sb(mp, sb,
> bp->b_maps[0].bm_bn == XFS_SB_DADDR,
> check_version);
Why do we need to keep this wrapper function? The in-progress check
is a primary superblock read verifier check (only useful at mount
time), as is the "check_version" flag used to validate the V5
feature mask during mount.
i.e. xfs_sb_verify() needs to go away, and the read-side only checks
need to be moved from xfs_mount_validate_sb() into
xfs_sb_read_verify() too. At which point, xfs_mount_validate_sb()
has nothing to do with mount and can be renamed to
xfs_sb_verify_common()....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2018-07-27 0:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-26 17:35 [PATCH 1/2] libxfs: add more bounds checking to sb sanity checks Darrick J. Wong
2018-07-26 17:35 ` [PATCH 2/2] xfs: verify icount in superblock write Darrick J. Wong
2018-07-26 17:48 ` Bill O'Donnell
2018-07-26 23:20 ` Dave Chinner
2018-07-27 0:07 ` Darrick J. Wong
2018-07-27 10:44 ` Brian Foster
2018-07-27 14:30 ` Eric Sandeen
2018-07-27 22:13 ` Darrick J. Wong
2018-07-29 4:39 ` Dave Chinner
2018-07-30 12:36 ` Brian Foster
2018-07-26 18:25 ` [PATCH 1/2] libxfs: add more bounds checking to sb sanity checks Bill O'Donnell
2018-07-26 23:28 ` Dave Chinner [this message]
2018-07-27 15:05 ` Eric Sandeen
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=20180726232855.GD2234@dastard \
--to=david@fromorbit.com \
--cc=billodo@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@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).