lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140801181323.12496.25530.stgit@birch.djwong.org>
Date:	Fri, 01 Aug 2014 11:13:23 -0700
From:	"Darrick J. Wong" <darrick.wong@...cle.com>
To:	tytso@....edu, darrick.wong@...cle.com
Cc:	linux-ext4@...r.kernel.org
Subject: [PATCH 15/19] tests: add tests for directory entry blocks with
 checksum errors

From: Darrick J. Wong <darrick.wong@...cle.com>

Add some regression tests to examine how e2fsck handles directory
entry blocks and htree blocks with (a) malformed directory entries;
(b) incorrect checksums; or (c) obviously garbage entries.

Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com>
---
 tests/f_dir_bad_csum/expect.1   |   62 +++++++++++++++++++++++++++++++++++++++
 tests/f_dir_bad_csum/expect.2   |    7 ++++
 tests/f_dir_bad_csum/image.gz   |  Bin
 tests/f_dir_bad_csum/name       |    1 +
 tests/f_htree_bad_csum/expect.1 |   28 ++++++++++++++++++
 tests/f_htree_bad_csum/expect.2 |    7 ++++
 tests/f_htree_bad_csum/image.gz |  Bin
 tests/f_htree_bad_csum/name     |    1 +
 8 files changed, 106 insertions(+)
 create mode 100644 tests/f_dir_bad_csum/expect.1
 create mode 100644 tests/f_dir_bad_csum/expect.2
 create mode 100644 tests/f_dir_bad_csum/image.gz
 create mode 100644 tests/f_dir_bad_csum/name
 create mode 100644 tests/f_htree_bad_csum/expect.1
 create mode 100644 tests/f_htree_bad_csum/expect.2
 create mode 100644 tests/f_htree_bad_csum/image.gz
 create mode 100644 tests/f_htree_bad_csum/name

diff --git a/tests/f_dir_bad_csum/expect.1 b/tests/f_dir_bad_csum/expect.1
new file mode 100644
index 0000000..bbcbfcb
--- /dev/null
+++ b/tests/f_dir_bad_csum/expect.1
@@ -0,0 +1,62 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Directory inode 12, block #0, offset 12: directory passes checks but fails checksum.
+Fix? yes
+
+Directory inode 13, block #0, offset 0: directory has no checksum.
+Fix? yes
+
+Directory inode 13, block #0, offset 1012: directory passes checks but fails checksum.
+Fix? yes
+
+Directory inode 14, block #0, offset 0: directory has no checksum.
+Fix? yes
+
+Directory inode 14, block #0, offset 12: directory passes checks but fails checksum.
+Fix? yes
+
+Directory inode 15, block #0, offset 0: directory has no checksum.
+Fix? yes
+
+Directory inode 15, block #0, offset 1000: directory corrupted
+Salvage? yes
+
+Directory inode 16, block #0, offset 0: directory has no checksum.
+Fix? yes
+
+Directory inode 16, block #0, offset 12: directory corrupted
+Salvage? yes
+
+Directory inode 17, block #0, offset 0: directory has no checksum.
+Fix? yes
+
+Directory inode 17, block #0, offset 0: directory corrupted
+Salvage? yes
+
+Missing '.' in directory inode 17.
+Fix? yes
+
+Setting filetype for entry '.' in ??? (17) to 2.
+Missing '..' in directory inode 17.
+Fix? yes
+
+Setting filetype for entry '..' in ??? (17) to 2.
+Entry 'file' in ??? (18) has invalid inode #: 4294967295.
+Clear? yes
+
+Pass 3: Checking directory connectivity
+'..' in /6 (17) is <The NULL inode> (0), should be / (2).
+Fix? yes
+
+Pass 3A: Optimizing directories
+Pass 4: Checking reference counts
+Unattached inode 19
+Connect to /lost+found? yes
+
+Inode 19 ref count is 2, should be 1.  Fix? yes
+
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 19/128 files (5.3% non-contiguous), 1098/2048 blocks
+Exit status is 1
diff --git a/tests/f_dir_bad_csum/expect.2 b/tests/f_dir_bad_csum/expect.2
new file mode 100644
index 0000000..f5a3e5f
--- /dev/null
+++ b/tests/f_dir_bad_csum/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 19/128 files (5.3% non-contiguous), 1098/2048 blocks
+Exit status is 0
diff --git a/tests/f_dir_bad_csum/image.gz b/tests/f_dir_bad_csum/image.gz
new file mode 100644
index 0000000000000000000000000000000000000000..4b581876f07c1ec989ef85977dc53741b6356130
GIT binary patch
literal 3499
zcmeH{=~Gi@...27(kdFKSc$SkIw-aXxQv2^a1}bGE)Yjh6dD;>6j>4=KvWDDi-5`!
z8Y+vTSBrqC5DN$rC8;2bS_#Xr3AwQ($exgd?BTwpAN>~`&dmAnd^mIF{GM|TA?s_C
zzRd%E%S~s6!4VXOjmeydq^b7ltvdixr?&)}SAOSxyteo_@...GIsL{3&G%79X4VCq
z+t3_nu=fe*Hw!nd#5LdjZG{E0_UETRJlhfF5bnl2sa|8|k!>EnYHPmF{_62UI+;PI
zbDGw?rd))OxoKHRKAkSr6dFk53}14J!xwk`eA-~HC*J3gvUN>c5BJFP=G@...Ch#s
zD7>PAkO%&6=;`UIPV>Ws%45obDo*Ff?c*++?W~>CV;c=Li`F!QS&BYC03=9Q{7W2+
zIkG)zeo#?5NvXO2=!|~8%ZetmL80xcH}$nH6d}Fp$TNp|`yow;wNTl5<l#xEG6V64
z<Ke*FW#P^-74a>z8mF7XcT&FF@...|VKK{R=M{a!F44Zztn%;(JJ8<Djr__zB@%o6
zS8RO!P?Yy-_k;s0mz#VNe*^Eav_HEF<{TWmUXBj#Cf&<3&xkI$btlh0Eo}(z5#+^)
z4>Mj1MesII%6zxBDOyM_S7l5kSi6RWCh9x$a`G)IWGjXu+~V|pc2=$qzPO4+YkFAC
ziC@...!Xvu8;$xoKF{?D&l!lep3&h(Msxrv9rtaWWL$r5y4MMiVew_Lf*^r5f@L~f
z2fPn6RS@z(s?kgWJ<%&b504DoZdZBaaQ`5;@!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xqA$gxXC<AOWxFw8%xS`teHmI!=~1iGlCm1TM6<%#S9
z*Q^6O+#XOqY!(;>94l8Xe%$TAv0+xLxtWuw1G&b`TsKT`*ggJUgEKfQff9bgf-h(k
z(ZLiflWolO?Esd(CC|$@...D=6EV$|87+acs&nn3^zIgK+unn*N*mzK-f7m}){e_T
eCi*vijx?8MS|ae75~%BgmvwK;FEcUOX!0LSB4$+p

literal 0
HcmV?d00001

diff --git a/tests/f_dir_bad_csum/name b/tests/f_dir_bad_csum/name
new file mode 100644
index 0000000..140ae45
--- /dev/null
+++ b/tests/f_dir_bad_csum/name
@@ -0,0 +1 @@
+dir block w/ missing/bad csum, no tail, or dir block corruption (metadata_csum)
diff --git a/tests/f_htree_bad_csum/expect.1 b/tests/f_htree_bad_csum/expect.1
new file mode 100644
index 0000000..258362b
--- /dev/null
+++ b/tests/f_htree_bad_csum/expect.1
@@ -0,0 +1,28 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Problem in HTREE directory inode 12: root node fails checksum.
+Clear HTree index? yes
+
+Problem in HTREE directory inode 18: root node fails checksum.
+Clear HTree index? yes
+
+Directory inode 24, block #0, offset 1020: directory corrupted
+Salvage? yes
+
+Problem in HTREE directory inode 24: root node fails checksum.
+Clear HTree index? yes
+
+Problem in HTREE directory inode 30: root node fails checksum.
+Clear HTree index? yes
+
+Problem in HTREE directory inode 36: root node fails checksum.
+Clear HTree index? yes
+
+Pass 3: Checking directory connectivity
+Pass 3A: Optimizing directories
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 47/128 files (2.1% non-contiguous), 1108/2048 blocks
+Exit status is 1
diff --git a/tests/f_htree_bad_csum/expect.2 b/tests/f_htree_bad_csum/expect.2
new file mode 100644
index 0000000..7e3523b
--- /dev/null
+++ b/tests/f_htree_bad_csum/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 47/128 files (2.1% non-contiguous), 1108/2048 blocks
+Exit status is 0
diff --git a/tests/f_htree_bad_csum/image.gz b/tests/f_htree_bad_csum/image.gz
new file mode 100644
index 0000000000000000000000000000000000000000..def571c7900f39bf236a52f0086fccb54049c8c2
GIT binary patch
literal 5462
zcmeHKX;c&0x^-y9;VCLA(oxebB3>180U^p%t?33MDz-xdGNfBXK!gAhkSTS&h)9EA
zBSVWqur;IwH6lY~vRZ+J83h3uBP2jWfDi&?s?>Qw?X}*0@...I-}S6jtJXTF>U?L{
z{`R-ODtyAS1+lw2PcB+K(YNyH`u5uk-e;F~elu0?@...Izh;fG_JOrQ=06MV)^2~k
zqu9jNcF~5IWTThM-aPWr6XYJcni|x;>*1Ngv)>jn<C&Z8Z+dL7<Ib8j>wi1sEZDth
zAh)`E)1zJ+@...ohu9ad)9$HMzgLZp-gb~OZqt<FwrJL^FLvgYO4!Y0Q=3yV;`X}K
z;~5tyfu|zl*;cgInGXw6Q%Xu6x*ksJJi08oEh87=P-kC0KW=mSSV{u!mXHZ?EVf$b
zcn#?ARl~#F4Bd)y0q}gs%xLOX`;<lhcyuIlDB+qh9ZMh5;dp@...jgi@...6nI}_n
zgH<$>Bx9=i_8aDGf>Ra22@...%`EeB@L@f)>Z8jhwr<&orG`%DaZg0v`NsZ?$;5ED
z4XKZq`b!!H8O&tNX%C0>q_4W0(pa`l<jrtxRXLnlv*2G3%%Xd4)0TA@...CF!LXja
z2FzeuD`rDHN-pi~?Zvj(YHfF~&v3J)b(pjfkm+Xx?npPqYTH|z{02!RX?3149yg|+
z*Kq$}A5vy*`8I}hyYu)iymxKvYF*{DQo`8p&5sWI6HxaS$>6W}YIwA<TwrX|)tzIL
z<D&*F7S_g?fnS4#YW)AWT&ZLOD12}^CpNCV{Ci?<f~2I~DrrTUm6up(+i&oAc_ixs
zAe>f(@qvIjbm>2q*|qPH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2*RZyV7FP5U3mYw6^I^vwKK25GWa!SLYmx
z9^4szpw%8@...z$MsZ){1C#=3`@...D9=&2t+7NAEd*ppfqYT=4+TiK?KGYMUn}5>
zG1l)=@...0z}&gIV)z%wS}-epy>#)={J!imUrCUC1GshI)4q{sY&pjo{%z&*8Te-g
z{vR-K{9Fvl_weDN;o}*kuI}T;L?Q=r8oRsQDXy6Lw8CfnTDd@...qt>ZqR>^|Lz-i
z-JR=Rzh0V8!fkeaZ&7<cce@...}CpU`*qAa>f0-PiaIKET^#z+8e`X}0A`rg3;WC#
uQiPIdXP=mk>5^6-Ms)Cn|MI^u0rY<`x_orrD!#$gguQ&Ge8GaR7W^mWdKZ}h

literal 0
HcmV?d00001

diff --git a/tests/f_htree_bad_csum/name b/tests/f_htree_bad_csum/name
new file mode 100644
index 0000000..ebfc3ea
--- /dev/null
+++ b/tests/f_htree_bad_csum/name
@@ -0,0 +1 @@
+htree block w/ missing/bad csum, bad protective dirent, or htree index corruption (metadata_csum)

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ