[2/2] tests: add new test f_ea_inode_self_ref

Message ID 20180407051427.14883-2-tytso@mit.edu
State Accepted
Headers show
Series
  • [1/2] libext2fs: add sanity checks for ea_in_inode
Related show

Commit Message

Theodore Y. Ts'o April 7, 2018, 5:14 a.m.
Make sure we can handle a maliciously created file system containing
an inode containing an extended attribute whose e_value_inum points
back at itself.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 tests/f_ea_inode_self_ref/expect.1 |  17 +++++++++++++++++
 tests/f_ea_inode_self_ref/expect.2 |   7 +++++++
 tests/f_ea_inode_self_ref/image.gz | Bin 0 -> 661 bytes
 tests/f_ea_inode_self_ref/name     |   1 +
 4 files changed, 25 insertions(+)
 create mode 100644 tests/f_ea_inode_self_ref/expect.1
 create mode 100644 tests/f_ea_inode_self_ref/expect.2
 create mode 100644 tests/f_ea_inode_self_ref/image.gz
 create mode 100644 tests/f_ea_inode_self_ref/name

Patch

diff --git a/tests/f_ea_inode_self_ref/expect.1 b/tests/f_ea_inode_self_ref/expect.1
new file mode 100644
index 000000000..f94c04d96
--- /dev/null
+++ b/tests/f_ea_inode_self_ref/expect.1
@@ -0,0 +1,17 @@ 
+Pass 1: Checking inodes, blocks, and sizes
+Inode 16 has INLINE_DATA_FL flag but extended attribute not found.  Truncate? yes
+
+Extended attribute in inode 16 has a hash (553648128) which is invalid
+Clear? yes
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Block bitmap differences:  -20
+Fix? yes
+
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 16/16 files (0.0% non-contiguous), 21/100 blocks
+Exit status is 1
diff --git a/tests/f_ea_inode_self_ref/expect.2 b/tests/f_ea_inode_self_ref/expect.2
new file mode 100644
index 000000000..939806156
--- /dev/null
+++ b/tests/f_ea_inode_self_ref/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: 16/16 files (0.0% non-contiguous), 21/100 blocks
+Exit status is 0
diff --git a/tests/f_ea_inode_self_ref/image.gz b/tests/f_ea_inode_self_ref/image.gz
new file mode 100644
index 0000000000000000000000000000000000000000..3cc733b55280d31527a6704d8632bf062994ba20
GIT binary patch
literal 661
zc-oWi=3sc>d?Jd8`RyHFZ;?b9h7aj!riZq#v8lMC!@;!C`~=^`5<dRBHu{e1*<LEX
z*w9q+;=)pYfsz-@Eze)1T>r%+yK9C^JI|seZ)X;om4}8zU2gsR_k(@@?=}BtCjLAB
zM$bl=>B72S$y1U`j?K{7ruvn)?b@RK5q~Rk3$<FZz8<@-l3$*$6rEoaU*6-@<864)
zj`N}49Q&%jb&1ceJqdbx>dET#$K3w>k0QLE-hLlvvtyrCePv3*pO2p}d+v~`>bm~x
zRbR5cYIM%)4#O9h7PC%ClIb@Lx>7$Yey)S{im>Yc_n7NL8p|df+x4E)(`wfJ-<zMB
z$jZk4=CK#pb!qoy{`7Nq=FHn0&sS+Lcv~&~@t*AwcGGLi^roFZ{&Ql|Pp6M}AEjz~
z>b*)^s9Ku8;{Vi3QGc0p4~5qS{BQWhe#L&lKgO^8E9xEoGQW}s3o$T6O%l9tVV{$S
zefs$oryhkwtXpUQa`lhQ1(!CYTFn1<=D*SYZLg!#J_{a|uDP-6t=B$%_LX}MzixjO
zKJ8U`*^-?{=9k%hxf=U#_51%@n2*o0D?k0a^6;(D&0deQcG+7`-}1!P?)K_)6@Syt
zfBPltf4^qV_u~?u4$CtjgDqS3bsk+A^(OtEzOZ8bzZ=i~EKR!b>|xEVuezBMYiF?Z
z>n^UGy3<1P^@|%de^q_?rR-jP*|x_#^1t!6(EpR$4(9%vKW{?s%Dj7r?%b-ec((Rv
z6@U2r|Np;~Z~dd5bT4X4^1q2Qwu`Y({GW0ry8GB4=fBkx>m61yGf)CHaMv@uchUL9
IFoBT)08^(uS^xk5

literal 0
Hc-jL100001

diff --git a/tests/f_ea_inode_self_ref/name b/tests/f_ea_inode_self_ref/name
new file mode 100644
index 000000000..4e68da818
--- /dev/null
+++ b/tests/f_ea_inode_self_ref/name
@@ -0,0 +1 @@ 
+corrupted, self-referential ea_in_inode