[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 07/20] qcow2: Assert that the crypto header does not
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PULL 07/20] qcow2: Assert that the crypto header does not overlap other metadata |
Date: |
Tue, 14 Nov 2017 18:24:04 +0100 |
From: Alberto Garcia <address@hidden>
The crypto header is initialized only when QEMU is creating a new
image, so there's no chance of this happening on a corrupted image.
If QEMU is really trying to allocate the header overlapping other
existing metadata sections then this is a serious bug in QEMU itself
so let's add an assertion.
Signed-off-by: Alberto Garcia <address@hidden>
Message-id: address@hidden
Reviewed-by: Daniel P. Berrange <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
block/qcow2.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/qcow2.c b/block/qcow2.c
index defc1fe49f..b3d66a0e88 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -126,6 +126,7 @@ static ssize_t qcow2_crypto_hdr_init_func(QCryptoBlock
*block, size_t headerlen,
/* Zero fill remaining space in cluster so it has predictable
* content in case of future spec changes */
clusterlen = size_to_clusters(s, headerlen) * s->cluster_size;
+ assert(qcow2_pre_write_overlap_check(bs, 0, ret, clusterlen) == 0);
ret = bdrv_pwrite_zeroes(bs->file,
ret + headerlen,
clusterlen - headerlen, 0);
--
2.13.6
- [Qemu-devel] [PULL 00/20] Block patches for 2.11.0-rc1, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 01/20] qcow2: Prevent allocating refcount blocks at offset 0, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 02/20] qcow2: Prevent allocating L2 tables at offset 0, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 03/20] qcow2: Prevent allocating compressed clusters at offset 0, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 05/20] qcow2: Add iotest for an image with header.refcount_table_offset == 0, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 04/20] qcow2: Don't open images with header.refcount_table_clusters == 0, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 06/20] qcow2: Add iotest for an empty refcount table, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 07/20] qcow2: Assert that the crypto header does not overlap other metadata,
Max Reitz <=
- [Qemu-devel] [PULL 09/20] iotests: Add missing 'blkdebug::' in 040, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 08/20] iotests: Make 030 less flaky, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 10/20] iotests: Make 055 less flaky, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 11/20] iotests: Make 083 less flaky, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 12/20] iotests: Make 136 less flaky, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 13/20] iotests: Use new-style NBD connections, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 14/20] qcow2: Check that corrupted images can be repaired in iotest 060, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 15/20] block/snapshot: dirty all dirty bitmaps on snapshot-switch, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 17/20] block/vhdx.c: Don't blindly update the header, Max Reitz, 2017/11/14
- [Qemu-devel] [PULL 20/20] qemu-iotests: update unsupported image formats in 194, Max Reitz, 2017/11/14