block: vhdx: Use zerocopy for structs

Replace the use of unsafe struct casting with zerocopy trait derivation.
This fixes a Rust UB where the struct was being filled with a slice of
length greater than the size of the struct.

As a compromise the guid handling was changed to handle the uuids as
opaque bytes as they are mixed endian. This has no impact on the
functionality as they are only used for comparison and has the positive
impact of reducing some of the uuid handling complexity.

Assisted-by: Claude:Opus-4.8
Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
Rob Bradford
2026-07-01 09:45:08 +01:00
parent f5f7b092e1
commit f62e2615a9
5 changed files with 140 additions and 122 deletions
Generated
+1
View File
@@ -358,6 +358,7 @@ dependencies = [
"vm-memory",
"vm-virtio",
"vmm-sys-util",
"zerocopy",
"zstd",
]