Re: [PATCH 4/4] xfs: validate v5 feature fields

Darrick J. Wong
2022-05-03T23:29:02Z

On Wed, May 04, 2022 at 09:18:58AM +1000, Dave Chinner wrote:
> On Tue, May 03, 2022 at 03:59:18PM -0700, Darrick J. Wong wrote:
> > On Mon, May 02, 2022 at 06:20:18PM +1000, Dave Chinner wrote:
> > > From: Dave Chinner <dchinner@redhat.com>
> > >
> > > Because stupid dumb fuzzers.
> >
> > Dumb question: Should we make db_flds[] in db/sb.c (userspace) report
> > each individual feature flag as a field_t?
>
> Maybe, but we do already have the versionnum command that dumps the
> feature bits in text/human readable format....

The fuzz tests in fstests just do:

# xfs_db /dev/sda -c '<goto metadata>' -c 'print' | awk '{print $1}'

to find the fields that it should fuzz, so if we don't call out
individual bit fields in the features flags, it'll never fuzz them.
I guess I"ll look into changing that...

--D

> > I've been wondering why none
> > of my fuzz tests ever found these problems, and it's probably because
> > it never hit the magic bits that $scriptkiddie happened to hit.
>
> Yeah, you've probably never cleared just the dirv2 bit. That one has
> an assert on it these days because the kernel only supports v2-based
> directory formats. In other cases, things still work but we
> probably don't do the right thing for v5 formats :)
>
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david@fromorbit.com