[2/2] btrfs-progs: fuzz-tests: add image trigers abort of open_ctree()
diff mbox series

Message ID 20191118055335.9927-2-Damenly_Su@gmx.com
State New
Headers show
Series
  • [1/2] btrfs-progs: block group: do not exclude bytenr adjacent to block group
Related show

Commit Message

Damenly Su Nov. 18, 2019, 5:53 a.m. UTC
From: Su Yue <Damenly_Su@gmx.com>

This test case contains a bad block of dev tree and trigers abort while
open_ctree() due to its exquisite chunk layout. It can't be repaired
by fsck, so put it into fuzz-tests/images.

The image is provided by Ruud van Asseldonk. This commit just did xz
and writes the record.

Link: https://github.com/kdave/btrfs-progs/issues/210
Signed-off-by: Su Yue <Damenly_Su@gmx.com>
---
 .../images/bad-dev-tree-node.raw.txt          |  58 ++++++++++++++++++
 .../images/bad-dev-tree-node.raw.xz           | Bin 0 -> 18788 bytes
 2 files changed, 58 insertions(+)
 create mode 100644 tests/fuzz-tests/images/bad-dev-tree-node.raw.txt
 create mode 100644 tests/fuzz-tests/images/bad-dev-tree-node.raw.xz

GIT binary patch
literal 18788
zcmeHPc{J4h{-24+I+0yyY+1u-lC6;^MAnSP*q4x^$oh;mOLjB1hOvi|ks?b8i6M-&
zM3O97AF@P3nA?5sz2`aioZs*M?%exSe&>Aun=}7>&Ut@c@7MSBe!btH_l^?A+yVrm
zogS#v-Uot$4}(CUgFWV*6pARVtu+XAZHGcBsG;bbI?H)o+1})Fvcz=3P5RBnNx`sJ
zaxE%q;B)1{?Xj^2as@0yA$LB+i?ErFp?O+-Vki7Is#8OlFE_sT*1c$TyXZ~my4Nc{
z55CvVVZz!3(<{)>ub^>PzfWZdC+TH^<VcNfv*oXAZY1rXp7-9-O3zOcKq+@Hq@1R-
z^Za?zp{%HOx8Jrf+4w~-1C}7j1!u+whE7KAJvdB6&c$~q_<lG)v4JCQc@^3zpw#$o
z9_B`Hq!)oO(9;c%j``)z2<1IiGcA59z_?F?U2M*)<hbtD-evu;XZ{~-ka+~RlG9s8
zqLK;AHQlFPX>lcx{d_!>TfBK1p5m5nN0rcC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zgo-c%lFno93+9$a>k9dN<wF&jQ@d#A530e>d2`O>OuU@bUPmrR`^d--HyI<7gz<DV
zw(TCO9E~ug^de4h(QE;O)ItfxLcH`kGgtE62Ic>_n@N0Jr38=_)no-&zkv1od*}5#
zv_%194lw3^gfRzj7{FlwhwZ6>6d)ymlmt=|NXh@tLv;X$QORMoU~SO6bX>F~|2Sfm
z+rnX<8^0mq;Z>gvyK-hJTTZ7B$G-Sxa7DK}{wGgYYQ71Tqs-U*fXQm=o!fgm!`FT{
zGGz9oiTL{nYzfxBV2wFNm_^;?=gj&2^B_prD10TCG5}WJOA%w^=BO9PP6YW8Z|G!y
z&RGppY)eT>#Ij)RUWU7(3-yI`D7#MYG@ESwBG0gwp7?n0uqm3Lr2hO6q;({FXF%-7
z4ji*e^05H!8Q`A%eGDHkgZ9c~KOjP=6d^#sfPev&Cs26;mFGV_@ua>Gp+XG(>(`~<
z^=P2S1oW7I9@8Ftk_zZBs&&{m$H&Lc&=btAc8~L^z}pM$o%KVrvG?(^lw<RRf4tTI
zu59`fiJYpV*TW;{|7ut4J&(+S-*xiIyg~VYH_Y_MYKA}Sx-}n8;rC|5et%exH;D0V
zJxTv#)?NI2F%2@$e7J`rw%1k>%t0^h;OON66Ojtt42akNK)m8)#z2I<<n;fs9wa8D
t`gqW{T}i789XkBIa5M;9n+y&OZ9MVqzt2Ne`5fG;@-*LmgJ{tfe*vz)$c+F1

literal 0
HcmV?d00001

Patch
diff mbox series

diff --git a/tests/fuzz-tests/images/bad-dev-tree-node.raw.txt b/tests/fuzz-tests/images/bad-dev-tree-node.raw.txt
new file mode 100644
index 000000000000..64935568c7a6
--- /dev/null
+++ b/tests/fuzz-tests/images/bad-dev-tree-node.raw.txt
@@ -0,0 +1,58 @@ 
+URL: https://github.com/kdave/btrfs-progs/issues/210
+
+ruuda commented on Sep 24
+Running btrfs check on the attached minimal file system causes the following:
+
+Opening filesystem to check...
+extent_io.c:158: insert_state: BUG_ON `end < start` triggered, value 1
+btrfs(+0x2de57)[0x560c4d7cfe57]
+btrfs(+0x2e210)[0x560c4d7d0210]
+btrfs(set_extent_bits+0x254)[0x560c4d7d0854]
+btrfs(exclude_super_stripes+0xbf)[0x560c4d7c65ff]
+btrfs(btrfs_read_block_groups+0x29d)[0x560c4d7c698d]
+btrfs(btrfs_setup_all_roots+0x3f3)[0x560c4d7c0b23]
+btrfs(+0x1ef53)[0x560c4d7c0f53]
+btrfs(open_ctree_fs_info+0x90)[0x560c4d7c11a0]
+btrfs(+0x6d3f9)[0x560c4d80f3f9]
+btrfs(main+0x94)[0x560c4d7b60c4]
+/usr/lib/libc.so.6(__libc_start_main+0xf3)[0x7fd189773ee3]
+btrfs(_start+0x2e)[0x560c4d7b635e]
+zsh: abort (core dumped)  btrfs check /tmp/bad.btrfs
+Tested versions:
+
+v5.2.1 as shipped by Arch in 5.2.1-1
+v5.2.2 built from source (55a8c96)
+Data to reproduce:
+
+4a2d85625461bfed3cb60c53e5e913.zip
+
+GDB output:
+Starting program: /btrfs-progs/btrfs check bad-dev-tree-node.raw
+[Thread debugging using libthread_db enabled]
+Using host libthread_db library "/usr/lib/libthread_db.so.1".
+Opening filesystem to check...
+extent_io.c:158: insert_state: BUG_ON `end < start` triggered, value 1
+/btrfs-progs/btrfs(+0xa3fa8)[0x5555555f7fa8]
+/btrfs-progs/btrfs(+0xa4046)[0x5555555f8046]
+/btrfs-progs/btrfs(+0xa45f1)[0x5555555f85f1]
+/btrfs-progs/btrfs(set_extent_bits+0x83)[0x5555555f8c63]
+/btrfs-progs/btrfs(+0xbfb90)[0x555555613b90]
+/btrfs-progs/btrfs(exclude_super_stripes+0x1fc)[0x555555613de9]
+/btrfs-progs/btrfs(+0xbd85d)[0x55555561185d]
+/btrfs-progs/btrfs(btrfs_read_block_groups+0xd3)[0x5555556119f5]
+/btrfs-progs/btrfs(btrfs_setup_all_roots+0x454)[0x555555607740]
+/btrfs-progs/btrfs(+0xb4219)[0x555555608219]
+/btrfs-progs/btrfs(open_ctree_fs_info+0x177)[0x555555608415]
+/btrfs-progs/btrfs(+0x693dd)[0x5555555bd3dd]
+/btrfs-progs/btrfs(+0x14dc7)[0x555555568dc7]
+/btrfs-progs/btrfs(main+0x126)[0x555555569713]
+/usr/lib/libc.so.6(__libc_start_main+0xf3)[0x7ffff7a85153]
+/btrfs-progs/btrfs(_start+0x2e)[0x555555568cce]
+
+Program received signal SIGABRT, Aborted.
+0x00007ffff7a99f25 in raise () from /usr/lib/libc.so.6
+
+
+The compressed fuzz image causes above btrfsck abort.
+Fixed by commit "btrfs-progs: block group: do not exclude bytenr
+adjacent to block group".
diff --git a/tests/fuzz-tests/images/bad-dev-tree-node.raw.xz b/tests/fuzz-tests/images/bad-dev-tree-node.raw.xz
new file mode 100644
index 0000000000000000000000000000000000000000..a6e62106da03d81a2dbafa23f0c8082d75f82af0