All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: fuzz-test: Add image for wrong chunk item in root tree
@ 2016-08-30  2:15 Qu Wenruo
  2016-08-30 14:05 ` David Sterba
  2016-08-30 14:17 ` David Sterba
  0 siblings, 2 replies; 4+ messages in thread
From: Qu Wenruo @ 2016-08-30  2:15 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Lukas Lueg

From: Lukas Lueg <lukas.lueg@gmail.com>

Reported by Lukas and the same image from him.

DATA_RELOC tree's key type is modifed to CHUNK_ITEM, causing btrfsck
interpret it as CHUNK_ITEM and cause 0 num_stripes.

Add the image to fuzz-test.

Signed-off-by: Lukas Lueg <lukas.lueg@gmail.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 .../images/wrong-chunk-item-in-root-tree.raw.txt   |  35 +++++++++++++++++++++
 .../images/wrong-chunk-item-in-root-tree.raw.xz    | Bin 0 -> 3696 bytes
 2 files changed, 35 insertions(+)
 create mode 100644 tests/fuzz-tests/images/wrong-chunk-item-in-root-tree.raw.txt
 create mode 100644 tests/fuzz-tests/images/wrong-chunk-item-in-root-tree.raw.xz

diff --git a/tests/fuzz-tests/images/wrong-chunk-item-in-root-tree.raw.txt b/tests/fuzz-tests/images/wrong-chunk-item-in-root-tree.raw.txt
new file mode 100644
index 0000000..9097e49
--- /dev/null
+++ b/tests/fuzz-tests/images/wrong-chunk-item-in-root-tree.raw.txt
@@ -0,0 +1,35 @@
+URL: https://bugzilla.kernel.org/show_bug.cgi?id=155201
+Lukas Lueg 2016-08-28 19:15:53 UTC 
+
+Created attachment 230921 [details]
+Image causing SIGFPE in btrfsck
+
+News from the fuzzer. See the attached image to reproduce using btrfs-progs
+v4.7-42-g56e9586.
+
+
+[Thread debugging using libthread_db enabled]
+Using host libthread_db library "/lib64/libthread_db.so.1".
+checking extents
+Chunk[0, 4194304] existed.
+Chunk[18446744073709551607, 228, 0]: length(1), offset(0), type(4160) mismatch
+with block group[0, 192, 4194304]: offset(4194304), objectid(0), flags(2)
+
+Program received signal SIGFPE, Arithmetic exception.
+0x000000000042b178 in calc_stripe_length (type=4160, length=1, num_stripes=0)
+at cmds-check.c:8018
+8018			stripe_size /= num_stripes;
+#0  0x000000000042b178 in calc_stripe_length (type=4160, length=1,
+num_stripes=0) at cmds-check.c:8018
+#1  0x000000000042b56d in check_chunk_refs (silent=0,
+dev_extent_cache=0x7fffffffdd30, block_group_cache=0x7fffffffdd60,
+chunk_rec=0x6b92c0) at cmds-check.c:8101
+#2  check_chunks (chunk_cache=chunk_cache@entry=0x7fffffffdd80,
+block_group_cache=block_group_cache@entry=0x7fffffffdd60,
+dev_extent_cache=dev_extent_cache@entry=0x7fffffffdd30, good=good@entry=0x0,
+bad=bad@entry=0x0, rebuild=rebuild@entry=0x0, silent=0) at cmds-check.c:8165
+#3  0x000000000042bbdd in check_chunks_and_extents (root=root@entry=0x6b2cf0)
+at cmds-check.c:8524
+#4  0x000000000042e3cb in cmd_check (argc=<optimized out>, argv=<optimized
+out>) at cmds-check.c:11430
+#5  0x000000000040a416 in main (argc=2, argv=0x7fffffffe218) at btrfs.c:243
diff --git a/tests/fuzz-tests/images/wrong-chunk-item-in-root-tree.raw.xz b/tests/fuzz-tests/images/wrong-chunk-item-in-root-tree.raw.xz
new file mode 100644
index 0000000000000000000000000000000000000000..5bc2d3b9741f79e097303f04db138fd4187c776d
GIT binary patch
literal 3696
zcmeH~`8(T*7KgvF7ZHjK9c!btL=#)1#9C@;YN@m|C|zu|#ySit7;0-H*3{IRs!~lw
ziz>x5XgjGvi5A^d?7>)ukdnFgx%cP$v~!<Xe&}Ctp65O1^PY2d48K3)4gdnvBM)r&
z096na0Dvgu6otnN<8M0)0AV{k9;Jn6Yi1`KVRZiF!#s^?O1kjY5=$v%2-#z70>aQP
zKhMf?KvKY?Nw+3*U{cr*IJutatdHMunhTP|1H0Zu+531_vGg%?DgEQSFT$MyeB2R_
zj({l|$yi9cN3VhJNeZpp-}Fp_$}?o-hun)j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(t$M!2SR*f{+Cu2;7`WTebjJm_|081MkHF&<h0ufgpnI^Dv@y
P`*ZpJ^;ZG{IQQQHY9%Vq

literal 0
HcmV?d00001

-- 
2.9.3




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs-progs: fuzz-test: Add image for wrong chunk item in root tree
  2016-08-30  2:15 [PATCH] btrfs-progs: fuzz-test: Add image for wrong chunk item in root tree Qu Wenruo
@ 2016-08-30 14:05 ` David Sterba
  2016-08-30 14:17 ` David Sterba
  1 sibling, 0 replies; 4+ messages in thread
From: David Sterba @ 2016-08-30 14:05 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs, Lukas Lueg

On Tue, Aug 30, 2016 at 10:15:50AM +0800, Qu Wenruo wrote:
> From: Lukas Lueg <lukas.lueg@gmail.com>
> 
> Reported by Lukas and the same image from him.
> 
> DATA_RELOC tree's key type is modifed to CHUNK_ITEM, causing btrfsck
> interpret it as CHUNK_ITEM and cause 0 num_stripes.
> 
> Add the image to fuzz-test.
> 
> Signed-off-by: Lukas Lueg <lukas.lueg@gmail.com>
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs-progs: fuzz-test: Add image for wrong chunk item in root tree
  2016-08-30  2:15 [PATCH] btrfs-progs: fuzz-test: Add image for wrong chunk item in root tree Qu Wenruo
  2016-08-30 14:05 ` David Sterba
@ 2016-08-30 14:17 ` David Sterba
  2016-08-31  1:01   ` Qu Wenruo
  1 sibling, 1 reply; 4+ messages in thread
From: David Sterba @ 2016-08-30 14:17 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs, Lukas Lueg

On Tue, Aug 30, 2016 at 10:15:50AM +0800, Qu Wenruo wrote:
> From: Lukas Lueg <lukas.lueg@gmail.com>
> 
> Reported by Lukas and the same image from him.
> 
> DATA_RELOC tree's key type is modifed to CHUNK_ITEM, causing btrfsck
> interpret it as CHUNK_ITEM and cause 0 num_stripes.
> 
> Add the image to fuzz-test.
> 
> Signed-off-by: Lukas Lueg <lukas.lueg@gmail.com>

BTW I think you should put Reported-by here, that's the reporter's
credit. The signed-off from you is for your contribution to the git
repository (packing the image, documenting the origin etc). I've fixed
that in the commit.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs-progs: fuzz-test: Add image for wrong chunk item in root tree
  2016-08-30 14:17 ` David Sterba
@ 2016-08-31  1:01   ` Qu Wenruo
  0 siblings, 0 replies; 4+ messages in thread
From: Qu Wenruo @ 2016-08-31  1:01 UTC (permalink / raw)
  To: dsterba, linux-btrfs, Lukas Lueg



At 08/30/2016 10:17 PM, David Sterba wrote:
> On Tue, Aug 30, 2016 at 10:15:50AM +0800, Qu Wenruo wrote:
>> From: Lukas Lueg <lukas.lueg@gmail.com>
>>
>> Reported by Lukas and the same image from him.
>>
>> DATA_RELOC tree's key type is modifed to CHUNK_ITEM, causing btrfsck
>> interpret it as CHUNK_ITEM and cause 0 num_stripes.
>>
>> Add the image to fuzz-test.
>>
>> Signed-off-by: Lukas Lueg <lukas.lueg@gmail.com>
>
> BTW I think you should put Reported-by here, that's the reporter's
> credit. The signed-off from you is for your contribution to the git
> repository (packing the image, documenting the origin etc). I've fixed
> that in the commit.
>
>
Thanks for the fix.

I'll keep this in mind.

Thanks,
Qu



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-31  1:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-30  2:15 [PATCH] btrfs-progs: fuzz-test: Add image for wrong chunk item in root tree Qu Wenruo
2016-08-30 14:05 ` David Sterba
2016-08-30 14:17 ` David Sterba
2016-08-31  1:01   ` Qu Wenruo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.