* [Qemu-devel] [PATCH 0/3] parallels: additional iotests and a minor bugfix
@ 2014-10-08 9:13 Denis V. Lunev
2014-10-08 9:13 ` [Qemu-devel] [PATCH 1/3] iotests: replace fake parallels image with authentic one Denis V. Lunev
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Denis V. Lunev @ 2014-10-08 9:13 UTC (permalink / raw)
Cc: Kevin Wolf, Denis V. Lunev, Jeff Cody, qemu-devel,
Stefan Hajnoczi
Pls find here test authentic test material, i.e. parallels images
with "WithoutFreeSpace" and "WithouFreSpacExt" signatures created
in authentic way + a minor bug fix for access to non-initialized
memory found by valgrind.
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Jeff Cody <jcody@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 1/3] iotests: replace fake parallels image with authentic one
2014-10-08 9:13 [Qemu-devel] [PATCH 0/3] parallels: additional iotests and a minor bugfix Denis V. Lunev
@ 2014-10-08 9:13 ` Denis V. Lunev
2014-10-08 9:13 ` [Qemu-devel] [PATCH 2/3] iotests: add v2 parallels sample image and simple test for it Denis V. Lunev
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Denis V. Lunev @ 2014-10-08 9:13 UTC (permalink / raw)
Cc: Kevin Wolf, Denis V. Lunev, Jeff Cody, qemu-devel,
Stefan Hajnoczi
The image was generated using http://openvz.org/Ploop utility and properly
filled with the same content as original one.
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Jeff Cody <jcody@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
---
tests/qemu-iotests/076 | 10 +++++-----
tests/qemu-iotests/076.out | 8 ++++----
tests/qemu-iotests/sample_images/fake.parallels.bz2 | Bin 141 -> 0 bytes
tests/qemu-iotests/sample_images/parallels-v1.bz2 | Bin 0 -> 147 bytes
4 files changed, 9 insertions(+), 9 deletions(-)
delete mode 100644 tests/qemu-iotests/sample_images/fake.parallels.bz2
create mode 100644 tests/qemu-iotests/sample_images/parallels-v1.bz2
diff --git a/tests/qemu-iotests/076 b/tests/qemu-iotests/076
index b614a7d..a300ee2 100755
--- a/tests/qemu-iotests/076
+++ b/tests/qemu-iotests/076
@@ -47,26 +47,26 @@ catalog_entries_offset=$((0x20))
nb_sectors_offset=$((0x24))
echo
-echo "== Read from a valid (enough) image =="
-_use_sample_img fake.parallels.bz2
+echo "== Read from a valid v1 image =="
+_use_sample_img parallels-v1.bz2
{ $QEMU_IO -c "read -P 0x11 0 64k" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir
echo
echo "== Negative catalog size =="
-_use_sample_img fake.parallels.bz2
+_use_sample_img parallels-v1.bz2
poke_file "$TEST_IMG" "$catalog_entries_offset" "\xff\xff\xff\xff"
{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir
echo
echo "== Overflow in catalog allocation =="
-_use_sample_img fake.parallels.bz2
+_use_sample_img parallels-v1.bz2
poke_file "$TEST_IMG" "$nb_sectors_offset" "\xff\xff\xff\xff"
poke_file "$TEST_IMG" "$catalog_entries_offset" "\x01\x00\x00\x40"
{ $QEMU_IO -c "read 64M 64M" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir
echo
echo "== Zero sectors per track =="
-_use_sample_img fake.parallels.bz2
+_use_sample_img parallels-v1.bz2
poke_file "$TEST_IMG" "$tracks_offset" "\x00\x00\x00\x00"
{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir
diff --git a/tests/qemu-iotests/076.out b/tests/qemu-iotests/076.out
index f7745d8..fd26f3c 100644
--- a/tests/qemu-iotests/076.out
+++ b/tests/qemu-iotests/076.out
@@ -1,18 +1,18 @@
QA output created by 076
-== Read from a valid (enough) image ==
+== Read from a valid v1 image ==
read 65536/65536 bytes at offset 0
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
== Negative catalog size ==
-qemu-io: can't open device TEST_DIR/fake.parallels: Catalog too large
+qemu-io: can't open device TEST_DIR/parallels-v1: Catalog too large
no file open, try 'help open'
== Overflow in catalog allocation ==
-qemu-io: can't open device TEST_DIR/fake.parallels: Catalog too large
+qemu-io: can't open device TEST_DIR/parallels-v1: Catalog too large
no file open, try 'help open'
== Zero sectors per track ==
-qemu-io: can't open device TEST_DIR/fake.parallels: Invalid image: Zero sectors per track
+qemu-io: can't open device TEST_DIR/parallels-v1: Invalid image: Zero sectors per track
no file open, try 'help open'
*** done
diff --git a/tests/qemu-iotests/sample_images/fake.parallels.bz2 b/tests/qemu-iotests/sample_images/fake.parallels.bz2
deleted file mode 100644
index ffb5f13bac31bc9ab6e1ea5c0cfa26786f2c4cc6..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 141
zcmV;80CN9AT4*^jL0KkKS*i&LJ^%_Hf6(xNVE_;S2ml2D2!JYJ)&M{N00969FaWp;
z000b`1pojBOn|7QnnOSv)YEF7cgIVO0ByGSdk7e?fW`f$x`2Bi3t$bd06owJs09G{
vKo+1B1LXi)0CVe)J@eC^zBuEJbFFJA24D=p8Gt*$AL8yvrwS4kK_LggA5<|C
diff --git a/tests/qemu-iotests/sample_images/parallels-v1.bz2 b/tests/qemu-iotests/sample_images/parallels-v1.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..d1ef14205401a8e010d1be68bffeee92ce137d39
GIT binary patch
literal 147
zcmZ>Y%CIzaj8qGb<U2HxlYvY5|Amhp2@C-Y91N@s91U6t*BBfa7#JBi3>bEBnV0~X
zZfy+=3|x~mCkJ!L1skp^{Ftks!;qfyS}R^xuR}6WLEksaZ~=P@V<<!18pfv#p$a05
xpBl6#a54OH5Dj3ritc|OYkB_O@ArL$J-G_f4j?FXK>pD?kL6rKj5mT56#x^qEyDl+
literal 0
HcmV?d00001
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 2/3] iotests: add v2 parallels sample image and simple test for it
2014-10-08 9:13 [Qemu-devel] [PATCH 0/3] parallels: additional iotests and a minor bugfix Denis V. Lunev
2014-10-08 9:13 ` [Qemu-devel] [PATCH 1/3] iotests: replace fake parallels image with authentic one Denis V. Lunev
@ 2014-10-08 9:13 ` Denis V. Lunev
2014-10-08 9:13 ` [Qemu-devel] [PATCH 3/3] block/parallels: fix access to not initialized memory in catalog_bitmap Denis V. Lunev
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Denis V. Lunev @ 2014-10-08 9:13 UTC (permalink / raw)
Cc: Kevin Wolf, Denis V. Lunev, Jeff Cody, qemu-devel,
Stefan Hajnoczi
This is simple test image for the following commit made by me.
commit d25d59802021a747812472780d80a0e792078f40
Author: Denis V. Lunev <den@openvz.org>
Date: Mon Jul 28 20:23:55 2014 +0400
parallels: 2TB+ parallels images support
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Jeff Cody <jcody@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
---
tests/qemu-iotests/076 | 5 +++++
tests/qemu-iotests/076.out | 4 ++++
tests/qemu-iotests/sample_images/parallels-v2.bz2 | Bin 0 -> 150 bytes
3 files changed, 9 insertions(+)
create mode 100644 tests/qemu-iotests/sample_images/parallels-v2.bz2
diff --git a/tests/qemu-iotests/076 b/tests/qemu-iotests/076
index a300ee2..98d67b3 100755
--- a/tests/qemu-iotests/076
+++ b/tests/qemu-iotests/076
@@ -70,6 +70,11 @@ _use_sample_img parallels-v1.bz2
poke_file "$TEST_IMG" "$tracks_offset" "\x00\x00\x00\x00"
{ $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir
+echo
+echo "== Read from a valid v2 image =="
+_use_sample_img parallels-v2.bz2
+{ $QEMU_IO -c "read -P 0x11 0 64k" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir
+
# success, all done
echo "*** done"
rm -f $seq.full
diff --git a/tests/qemu-iotests/076.out b/tests/qemu-iotests/076.out
index fd26f3c..32ade08 100644
--- a/tests/qemu-iotests/076.out
+++ b/tests/qemu-iotests/076.out
@@ -15,4 +15,8 @@ no file open, try 'help open'
== Zero sectors per track ==
qemu-io: can't open device TEST_DIR/parallels-v1: Invalid image: Zero sectors per track
no file open, try 'help open'
+
+== Read from a valid v2 image ==
+read 65536/65536 bytes at offset 0
+64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
*** done
diff --git a/tests/qemu-iotests/sample_images/parallels-v2.bz2 b/tests/qemu-iotests/sample_images/parallels-v2.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..fd8614d061172faae50a993ac7acd3173de9aa98
GIT binary patch
literal 150
zcmV;H0BQe1T4*^jL0KkKS<`z1ga8U8f6)C%U;t162ml8F2!JYJ)<8f2004jpFaWp=
zU;vl^35GBLOaKJHsVaJ=X*QsGnW)758mCWPt$+@EvggMtTP~K8Aeq(bOlAS_fGVI1
zR{#%`0aSoc2hsqlKqv!50aXBg@8a8e-{1Q8zBk4(ssXG4tO2Y6qyhde<ce^iA*S{R
E2o&5o3;+NC
literal 0
HcmV?d00001
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 3/3] block/parallels: fix access to not initialized memory in catalog_bitmap
2014-10-08 9:13 [Qemu-devel] [PATCH 0/3] parallels: additional iotests and a minor bugfix Denis V. Lunev
2014-10-08 9:13 ` [Qemu-devel] [PATCH 1/3] iotests: replace fake parallels image with authentic one Denis V. Lunev
2014-10-08 9:13 ` [Qemu-devel] [PATCH 2/3] iotests: add v2 parallels sample image and simple test for it Denis V. Lunev
@ 2014-10-08 9:13 ` Denis V. Lunev
2014-10-08 10:55 ` [Qemu-devel] [PATCH 0/3] parallels: additional iotests and a minor bugfix Paolo Bonzini
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Denis V. Lunev @ 2014-10-08 9:13 UTC (permalink / raw)
Cc: Kevin Wolf, Denis V. Lunev, Jeff Cody, qemu-devel,
Stefan Hajnoczi
found by valgrind.
Command: ./qemu-img convert -f parallels -O qcow2 1.hds 1.img
Invalid read of size 4
at 0x17D0EF: parallels_co_read (parallels.c:357)
by 0x11FEE4: bdrv_aio_rw_vector (block.c:4640)
by 0x11FFBF: bdrv_aio_readv_em (block.c:4652)
by 0x11F55F: bdrv_co_readv_em (block.c:4862)
by 0x123428: bdrv_aligned_preadv (block.c:3056)
by 0x1239FA: bdrv_co_do_preadv (block.c:3162)
by 0x125424: bdrv_rw_co_entry (block.c:2706)
by 0x155DD9: coroutine_trampoline (coroutine-ucontext.c:118)
by 0x6975B6F: ??? (in /lib/x86_64-linux-gnu/libc-2.19.so)
The problem is that s->catalog_bitmap is allocated/filled as
gmalloc(s->catalog_size) thus index validity check must be
inclusive, i.e. index >= s->catalog_size is invalid.
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Jeff Cody <jcody@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
---
block/parallels.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/parallels.c b/block/parallels.c
index 2a814f3..4f9cd8d 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -155,7 +155,7 @@ static int64_t seek_to_sector(BlockDriverState *bs, int64_t sector_num)
offset = sector_num % s->tracks;
/* not allocated */
- if ((index > s->catalog_size) || (s->catalog_bitmap[index] == 0))
+ if ((index >= s->catalog_size) || (s->catalog_bitmap[index] == 0))
return -1;
return
((uint64_t)s->catalog_bitmap[index] * s->off_multiplier + offset) * 512;
--
1.9.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] parallels: additional iotests and a minor bugfix
2014-10-08 9:13 [Qemu-devel] [PATCH 0/3] parallels: additional iotests and a minor bugfix Denis V. Lunev
` (2 preceding siblings ...)
2014-10-08 9:13 ` [Qemu-devel] [PATCH 3/3] block/parallels: fix access to not initialized memory in catalog_bitmap Denis V. Lunev
@ 2014-10-08 10:55 ` Paolo Bonzini
2014-10-20 6:25 ` Denis V. Lunev
2014-10-28 14:42 ` Stefan Hajnoczi
5 siblings, 0 replies; 7+ messages in thread
From: Paolo Bonzini @ 2014-10-08 10:55 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: Kevin Wolf, Jeff Cody, qemu-devel, Stefan Hajnoczi
Il 08/10/2014 11:13, Denis V. Lunev ha scritto:
> Pls find here test authentic test material, i.e. parallels images
> with "WithoutFreeSpace" and "WithouFreSpacExt" signatures created
> in authentic way + a minor bug fix for access to non-initialized
> memory found by valgrind.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Jeff Cody <jcody@redhat.com>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
>
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] parallels: additional iotests and a minor bugfix
2014-10-08 9:13 [Qemu-devel] [PATCH 0/3] parallels: additional iotests and a minor bugfix Denis V. Lunev
` (3 preceding siblings ...)
2014-10-08 10:55 ` [Qemu-devel] [PATCH 0/3] parallels: additional iotests and a minor bugfix Paolo Bonzini
@ 2014-10-20 6:25 ` Denis V. Lunev
2014-10-28 14:42 ` Stefan Hajnoczi
5 siblings, 0 replies; 7+ messages in thread
From: Denis V. Lunev @ 2014-10-20 6:25 UTC (permalink / raw)
Cc: Kevin Wolf, Jeff Cody, qemu-devel, Stefan Hajnoczi
On 08/10/14 13:13, Denis V. Lunev wrote:
> Pls find here test authentic test material, i.e. parallels images
> with "WithoutFreeSpace" and "WithouFreSpacExt" signatures created
> in authentic way + a minor bug fix for access to non-initialized
> memory found by valgrind.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Jeff Cody <jcody@redhat.com>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
ping
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] parallels: additional iotests and a minor bugfix
2014-10-08 9:13 [Qemu-devel] [PATCH 0/3] parallels: additional iotests and a minor bugfix Denis V. Lunev
` (4 preceding siblings ...)
2014-10-20 6:25 ` Denis V. Lunev
@ 2014-10-28 14:42 ` Stefan Hajnoczi
5 siblings, 0 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2014-10-28 14:42 UTC (permalink / raw)
To: Denis V. Lunev; +Cc: Kevin Wolf, Jeff Cody, qemu-devel, Stefan Hajnoczi
[-- Attachment #1: Type: text/plain, Size: 571 bytes --]
On Wed, Oct 08, 2014 at 01:13:27PM +0400, Denis V. Lunev wrote:
> Pls find here test authentic test material, i.e. parallels images
> with "WithoutFreeSpace" and "WithouFreSpacExt" signatures created
> in authentic way + a minor bug fix for access to non-initialized
> memory found by valgrind.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Jeff Cody <jcody@redhat.com>
> CC: Kevin Wolf <kwolf@redhat.com>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
>
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-10-28 14:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-08 9:13 [Qemu-devel] [PATCH 0/3] parallels: additional iotests and a minor bugfix Denis V. Lunev
2014-10-08 9:13 ` [Qemu-devel] [PATCH 1/3] iotests: replace fake parallels image with authentic one Denis V. Lunev
2014-10-08 9:13 ` [Qemu-devel] [PATCH 2/3] iotests: add v2 parallels sample image and simple test for it Denis V. Lunev
2014-10-08 9:13 ` [Qemu-devel] [PATCH 3/3] block/parallels: fix access to not initialized memory in catalog_bitmap Denis V. Lunev
2014-10-08 10:55 ` [Qemu-devel] [PATCH 0/3] parallels: additional iotests and a minor bugfix Paolo Bonzini
2014-10-20 6:25 ` Denis V. Lunev
2014-10-28 14:42 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).