From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: "zhengbin (A)" <zhengbin13@huawei.com>
Cc: Dave Chinner <david@fromorbit.com>,
sandeen@redhat.com, linux-xfs@vger.kernel.org,
renxudong1@huawei.com, "zhangyi (F)" <yi.zhang@huawei.com>
Subject: Re: Questions about XFS abnormal img mount test
Date: Thu, 13 Feb 2020 09:11:46 -0800 [thread overview]
Message-ID: <20200213171146.GD6870@magnolia> (raw)
In-Reply-To: <852729bc-729a-3ec5-bd85-f2b445ab07e3@huawei.com>
On Thu, Feb 13, 2020 at 04:33:38PM +0800, zhengbin (A) wrote:
>
> On 2020/2/11 9:15, Dave Chinner wrote:
> > On Mon, Feb 10, 2020 at 11:02:08AM +0800, zhengbin (A) wrote:
> >> ### question
> >> We recently used fuzz(hydra) to test 4.19 stable XFS and automatically generate tmp.img (XFS v5 format, but some metadata is wrong)
> > So you create impossible situations in the on-disk format, then
> > recalculate the CRC to make appear valid to the filesystem?
> >
> >> Test as follows:
> >> mount tmp.img tmpdir
> >> cp file tmpdir
> >> sync --> stuck
> >>
> >> ### cause analysis
> >> This is because tmp.img (only 1 AG) has some problems. Using xfs_repair detect information as follows:
> > Please use at least 2 AGs for your fuzzer images. There's no point
> > in testing single AG filesystems because:
> > a) they are not supported
> Maybe we can add a check in mount? If there is only 1 AG, refuse to mount?
No, that will break existing users. Single AG filesystems exist in a
weird gray area where they're not supported but they're not explicitly
prohibited either.
--D
> > b) there is no redundant information in the filesysetm to
> > be able to detect a vast range of potential corruptions.
> >
> >> agf_freeblks 0, counted 3224 in ag 0
> >> agf_longest 536874136, counted 3224 in ag 0
> >> sb_fdblocks 613, counted 3228
> > So the AGF verifier is missing these checks:
> >
> > a) agf_longest < agf_freeblks
> > b) agf_freeblks < sb_dblocks / sb_agcount
> > c) agf_freeblks < sb_fdblocks
>
> b is not ok,
>
> ie: disk is 10G, mkfs.xfs -d agsize=3G, so there will be 4 AG, while the last AG is 1G.
>
> sb_dblocks is 10G, while the first AG's agf_freeblks is 3G > 10G/4=2.5G
>
> >
> > and probably some other things as well. Can you please add these
> > checks to xfs_agf_verify() (and any other obvious bounds tests that
> > are missing) and submit the patch for inclusion?
> I will send a patch
> > Cheers,
> >
> > Dave.
>
prev parent reply other threads:[~2020-02-13 17:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-10 3:02 Questions about XFS abnormal img mount test zhengbin (A)
2020-02-10 3:59 ` Eric Sandeen
2020-02-11 1:15 ` Dave Chinner
2020-02-13 8:33 ` zhengbin (A)
2020-02-13 17:11 ` Darrick J. Wong [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=20200213171146.GD6870@magnolia \
--to=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=linux-xfs@vger.kernel.org \
--cc=renxudong1@huawei.com \
--cc=sandeen@redhat.com \
--cc=yi.zhang@huawei.com \
--cc=zhengbin13@huawei.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