qemu-irix/tests
Kevin Wolf ffa3ab0217 qcow2: Don't rely on free_cluster_index in alloc_refcount_block() (CVE-2014-0147)
free_cluster_index is only correct if update_refcount() was called from
an allocation function, and even there it's brittle because it's used to
protect unfinished allocations which still have a refcount of 0 - if it
moves in the wrong place, the unfinished allocation can be corrupted.

So not using it any more seems to be a good idea. Instead, use the
first requested cluster to do the calculations. Return -EAGAIN if
unfinished allocations could become invalid and let the caller restart
its search for some free clusters.

The context of creating a snapsnot is one situation where
update_refcount() is called outside of a cluster allocation. For this
case, the change fixes a buffer overflow if a cluster is referenced in
an L2 table that cannot be represented by an existing refcount block.
(new_table[refcount_table_index] was out of bounds)

[Bump the qemu-iotests 026 refblock_alloc.write leak count from 10 to
11.
--Stefan]

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit b106ad9185)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2014-07-03 16:18:12 -05:00
..
libqos
multiboot tests: Multiboot mmap test case 2013-10-28 17:34:42 +01:00
qapi-schema OptsVisitor: introduce unit tests, with test cases for range flattening 2013-08-20 11:52:00 -04:00
qemu-iotests qcow2: Don't rely on free_cluster_index in alloc_refcount_block() (CVE-2014-0147) 2014-07-03 16:18:12 -05:00
tcg tests: Fix 'make test' for i686 hosts (build regression) 2014-06-25 15:23:31 -05:00
.gitignore tests: Fix schema parser test for in-tree build 2013-10-02 22:55:27 +04:00
Makefile qdev-monitor-test: add device_add leak test cases 2013-11-07 13:58:58 +01:00
blockdev-test.c blockdev-test: add test case for drive_add duplicate IDs 2013-11-07 13:58:58 +01:00
boot-order-test.c qtest: Use -display none by default 2013-11-19 10:28:14 +01:00
check-block.sh
check-qdict.c
check-qfloat.c
check-qint.c
check-qjson.c
check-qlist.c
check-qstring.c
endianness-test.c qtest: Use -display none by default 2013-11-19 10:28:14 +01:00
fdc-test.c libqtest: rename qmp() to qmp_discard_response() 2013-11-07 13:58:43 +01:00
fw_cfg-test.c qtest: Use -display none by default 2013-11-19 10:28:14 +01:00
hd-geo-test.c qtest: Use -display none by default 2013-11-19 10:28:14 +01:00
i440fx-test.c qtest: Use -display none by default 2013-11-19 10:28:14 +01:00
ide-test.c libqtest: rename qmp() to qmp_discard_response() 2013-11-07 13:58:43 +01:00
libqtest.c qtest: Use -display none by default 2013-11-19 10:28:14 +01:00
libqtest.h libqtest: add qmp(fmt, ...) -> QDict* function 2013-11-07 13:58:53 +01:00
m48t59-test.c qtest: Use -display none by default 2013-11-19 10:28:14 +01:00
qdev-monitor-test.c qdev-monitor-test: add device_add leak test cases 2013-11-07 13:58:58 +01:00
qemu-iotests-quick.sh
qom-test.c qtest: Use -display none by default 2013-11-19 10:28:14 +01:00
rtc-test.c qtest: Use -display none by default 2013-11-19 10:28:14 +01:00
test-aio.c aio / timers: fix build of test/test-aio.c on non-linux platforms 2013-09-06 15:25:08 +02:00
test-bitops.c tests: fix 64-bit int literals for 32-bit hosts 2013-11-05 19:59:43 -08:00
test-coroutine.c coroutine: fix /perf/nesting coroutine benchmark 2013-09-19 13:21:41 +02:00
test-cutils.c
test-hbitmap.c
test-int128.c
test-iov.c
test-mul64.c
test-opts-visitor.c tests: fix 64-bit int literals for 32-bit hosts 2013-11-05 19:59:43 -08:00
test-qdev-global-props.c qdev: Set globals in instance_post_init function 2013-08-16 18:44:33 +02:00
test-qmp-commands.c
test-qmp-input-strict.c
test-qmp-input-visitor.c tests: fix memleak in error path test for input visitor 2013-11-05 19:58:38 -08:00
test-qmp-output-visitor.c
test-string-input-visitor.c
test-string-output-visitor.c
test-thread-pool.c aio / timers: Add QEMUTimerListGroup to AioContext 2013-08-22 19:10:27 +02:00
test-throttle.c misc: New spelling fixes in comments 2013-10-26 13:01:57 +04:00
test-visitor-serialization.c
test-x86-cpuid.c
test-xbzrle.c
tmp105-test.c qtest: Use -display none by default 2013-11-19 10:28:14 +01:00