From: Zhao Liu Date: Thu, 13 Nov 2025 05:19:17 +0000 (+0800) Subject: rust/migration: Fix missing name in the VMSD of Migratable<> X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb6e3e743a49642b9e06fdd5ca048ec6b449d9f7;p=thirdparty%2Fqemu.git rust/migration: Fix missing name in the VMSD of Migratable<> The VMStateDescription of Migratable missed the name field, and this casused segmentation fault in vmstate_save_state_v() when it tries to write name field by json_writer_str(). Due to the limitation of const, a custom name based on type would be more difficult. Instead, a straightforward and simple approach is to have all Migratable instances use the same VMSD name - "migratable-wrapper". This is availiable because Migratable is always a field within a VMSD, and its parent VMSD should have a distinct name. Signed-off-by: Zhao Liu Link: https://lore.kernel.org/r/20251113051937.4017675-3-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini --- diff --git a/rust/migration/src/migratable.rs b/rust/migration/src/migratable.rs index 5700554f7e..02efe31d72 100644 --- a/rust/migration/src/migratable.rs +++ b/rust/migration/src/migratable.rs @@ -421,7 +421,11 @@ impl Migratable { Migratable::::FIELD }; + // All Migratable instances share the same name. This is fine because + // Migratable is always a field within a VMSD. The parent VMSD has the + // different name to distinguish child Migratable. const VMSD: &'static bindings::VMStateDescription = VMStateDescriptionBuilder::::new() + .name(c"migratable-wrapper") .version_id(1) .minimum_version_id(1) .pre_save(&Self::pre_save)