block: qcow: Validate incompatible feature bits

Parse the feature name table header extension to provide descriptive
error messages when unsupported incompatible features are detected.
Currently only the compression bit (bit 3, zstd) is supported.

This prevents opening qcow2 images with features that would cause
incorrect behavior or data corruption (e.g., dirty bit, corrupt bit,
external data file, extended L2 entries).

Feature names are defined as follows:
1. The image's feature name table header extension (if present)
2. Hardcoded fallback names for known features
3. Generic "unknown feature bit N" for undefined features

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
Co-developed-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
This commit is contained in:
Anatol Belski
2026-01-19 10:43:16 +01:00
committed by Bo Chen
parent eaafe426a6
commit 7c99c169ba
3 changed files with 121 additions and 8 deletions

1
Cargo.lock generated
View File

@@ -322,6 +322,7 @@ checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
name = "block"
version = "0.1.0"
dependencies = [
"bitflags 2.10.0",
"byteorder",
"crc-any",
"flate2",