From: Andreas Dilger Subject: Re: [PATCH 1/2] tests: dumpe2fs against an image with bad os_type. Date: Tue, 18 Jul 2017 14:06:57 -0600 Message-ID: <02464BBF-7F20-48EC-84A2-97E2AFA9DD97@dilger.ca> References: <20170718192919.32406-1-abuchbinder@google.com> <20170718192919.32406-2-abuchbinder@google.com> Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: multipart/signed; boundary="Apple-Mail=_980CEC3E-2CAA-408C-ABA0-F3B2ABD54AA6"; protocol="application/pgp-signature"; micalg=pgp-sha1 Cc: Ext4 Developers List To: Adam Buchbinder Return-path: Received: from mail-io0-f169.google.com ([209.85.223.169]:34059 "EHLO mail-io0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751470AbdGRUHC (ORCPT ); Tue, 18 Jul 2017 16:07:02 -0400 Received: by mail-io0-f169.google.com with SMTP id l7so12767730iof.1 for ; Tue, 18 Jul 2017 13:07:02 -0700 (PDT) In-Reply-To: <20170718192919.32406-2-abuchbinder@google.com> Sender: linux-ext4-owner@vger.kernel.org List-ID: --Apple-Mail=_980CEC3E-2CAA-408C-ABA0-F3B2ABD54AA6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Jul 18, 2017, at 1:29 PM, Adam Buchbinder = wrote: >=20 > The os_type here is large enough to be negative when interpreted as a > signed integer. >=20 > This test case was generated by american fuzzy lop, starting from a > base filesystem image from files.fuzzing-project.org. It is preferable to create the image filesystem via script as part of = the test (e.g. using "debugfs -w ssv ostype 0xf00000000" or similar), rather than using a binary image. That allows us to see what is being changed, rather than getting a binary blob. Cheers, Andreas > Signed-off-by: Adam Buchbinder > --- > tests/d_bad_ostype/expect | 1 + > tests/d_bad_ostype/image.gz | Bin 0 -> 272 bytes > tests/d_bad_ostype/name | 1 + > tests/d_bad_ostype/script | 19 +++++++++++++++++++ > 4 files changed, 21 insertions(+) > create mode 100644 tests/d_bad_ostype/expect > create mode 100644 tests/d_bad_ostype/image.gz > create mode 100644 tests/d_bad_ostype/name > create mode 100644 tests/d_bad_ostype/script >=20 > diff --git a/tests/d_bad_ostype/expect b/tests/d_bad_ostype/expect > new file mode 100644 > index 00000000..b00318c4 > --- /dev/null > +++ b/tests/d_bad_ostype/expect > @@ -0,0 +1 @@ > +Filesystem OS type: (unknown os) > diff --git a/tests/d_bad_ostype/image.gz b/tests/d_bad_ostype/image.gz > new file mode 100644 > index = 0000000000000000000000000000000000000000..06805e1093c1ce9d2dc172aa89fb57ea= edfa5505 > GIT binary patch > literal 272 > zcmV+r0q_1FiwFpQOm0~K18HqxXJr6mU>F6XU=3D)m0AOOS;K+Fup8bHhh#Ei%a6d)L+ > z?&+16q1uYMkqiv~{|CQk1gnGa!Jq-Aj~m1RVhgBwAhY*~Zq>5lb9}siN7?zgx^kZA > z?$FQ8E731WEiR$5|B%5FZu@YTFo#cl{h8X~OW!;Lxt9kjw+`qxTG+{mLtK~^mW_f@ > zKq3I;O%@<#WdP-WCLo_>fL$~SM!_hc7x@3b9z-?#9|fae6pTDzKhO>s1*2dT3>1L1 > z13>-wb@2W@{lHsC25<-DIneI+Pz;e_0goMk0ElL%r=3Dv!}hye|aK*E591(fz-7$U<6 > WPk-bB5lS6L2LJ#sc=3DEFV7ytl=20 > literal 0 > HcmV?d00001 >=20 > diff --git a/tests/d_bad_ostype/name b/tests/d_bad_ostype/name > new file mode 100644 > index 00000000..3da887a8 > --- /dev/null > +++ b/tests/d_bad_ostype/name > @@ -0,0 +1 @@ > +handle bad (negative) os_type > diff --git a/tests/d_bad_ostype/script b/tests/d_bad_ostype/script > new file mode 100644 > index 00000000..94f356a6 > --- /dev/null > +++ b/tests/d_bad_ostype/script > @@ -0,0 +1,19 @@ > +gzip -dc < $test_dir/image.gz > $TMPFILE > + > +OUT=3D$test_name.log > +EXP=3D$test_dir/expect > +$DUMPE2FS $TMPFILE 2>&1 | sed -f $cmd_dir/filter.sed | grep = 'Filesystem OS type:' > $OUT > + > +rm -f $TMPFILE > +cmp -s $OUT $EXP > +status=3D$? > + > +if [ "$status" =3D 0 ] ; then > + echo "$test_name: $test_description: ok" > + touch $test_name.ok > +else > + echo "$test_name: $test_description: failed" > + diff $DIFF_OPTS $EXP $OUT > $test_name.failed > + rm -f $test_name.tmp > +fi > +unset OUT EXP > -- > 2.14.0.rc0.284.gd933b75aa4-goog >=20 Cheers, Andreas --Apple-Mail=_980CEC3E-2CAA-408C-ABA0-F3B2ABD54AA6 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iD8DBQFZbmpipIg59Q01vtYRAv/VAKCyNSSUFsfFMkMfPFmnk21qmixzYgCfQkBT tKbV5co93aK7NydpzXv0yKw= =N6tf -----END PGP SIGNATURE----- --Apple-Mail=_980CEC3E-2CAA-408C-ABA0-F3B2ABD54AA6--