If this flag is unset and exta data present the bitmap should be read-only. For now just return error for this case.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> --- block/qcow2-dirty-bitmap.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/qcow2-dirty-bitmap.c b/block/qcow2-dirty-bitmap.c index 159e935..95c166c 100644 --- a/block/qcow2-dirty-bitmap.c +++ b/block/qcow2-dirty-bitmap.c @@ -45,6 +45,7 @@ #define BME_RESERVED_FLAGS 0xfffffffc #define BME_FLAG_IN_USE 1 #define BME_FLAG_AUTO (1U << 1) +#define BME_FLAG_EXTRA_DATA_COMPATIBLE (1U << 1) /* bits [1, 8] U [56, 63] are reserved */ #define BME_TABLE_ENTRY_RESERVED_MASK 0xff000000000001fe @@ -333,6 +334,13 @@ static BdrvDirtyBitmap *load_bitmap(BlockDriverState *bs, QCow2Bitmap *bm, return NULL; } + if (!(bmh->flags & BME_FLAG_EXTRA_DATA_COMPATIBLE) && + bmh->extra_data_size != 0) { + error_setg(errp, "Uncompatible extra data found for bitmap '%s'", + bm->name); + return NULL; + } + bitmap_table = g_try_malloc(bmh->bitmap_table_size * sizeof(uint64_t)); if (bitmap_table == NULL) { error_setg_errno(errp, -ENOMEM, -- 1.8.3.1