[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] qcow2: Assert that host cluster offsets fit in L2 table e
Re: [PATCH v2] qcow2: Assert that host cluster offsets fit in L2 table entries
Tue, 14 Jan 2020 12:32:45 +0100
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1
On 13.01.20 17:11, Alberto Garcia wrote:
> The standard cluster descriptor in L2 table entries has a field to
> store the host cluster offset. When we need to get that offset from an
> entry we use L2E_OFFSET_MASK to ensure that we only use the bits that
> belong to that field.
> But while that mask is used every time we read from an L2 entry, it
> is never used when we write to it. Due to the QCOW_MAX_CLUSTER_OFFSET
> limit set in the cluster allocation code QEMU can never produce
> offsets that don't fit in that field so any such offset would indicate
> a bug in QEMU.
> Compressed cluster descriptors contain two fields (host cluster offset
> and size of the compressed data) and the situation with them is
> similar. In this case the masks are not constant but are stored in the
> csize_mask and cluster_offset_mask fields of BDRVQcow2State.
> Signed-off-by: Alberto Garcia <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>
> v2: the previous version was sent months ago but fell through the
> cracks, so I'm resending it. I rebased it although the patch
> doesn't need any changes.
Thanks, applied to my block branch:
Description: OpenPGP digital signature