You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
openvmm: a chipset device whose add fails stays a target of its line sets #1387
When a chipset device's arc_mutex_device(..).add(..) fails because its state unit's name is already in use, the device stays a target of the line sets it asked for. If a caller goes on with the builder anyway, a later start of those line-set units drives the device, changing its state with no state unit to save or restore it. No caller does this: BaseChipsetBuilder::build and the microVM's load both return the add's error, so this is a latent lifecycle hazard off the microVM path, not a reachable failure.
Reproduction
Register a unit named ioapic, then add an IO-APIC device of the same name with add_line_target(IRQ_LINE_SET, 0..=23, 0). The add returns NameInUse and should leave nothing behind, but the IRQ line set's inspection still holds "ioapic:0-23":"0-23", and the PIT's line 2 still lists ioapic among its targets. The test a_failed_spawn_leaves_no_line_target that fix.patch adds fails at the pin.
Cause
ArcMutexChipsetServicesFinalize::finalize adds the device to its line sets before it spawns the device's unit:
When the spawn returns NameInUse, nothing removes the targets already added.
Fix
fix.patch keeps the coverage assert and the dependency_of edges before the spawn. It moves add_target into a second loop that runs only after the spawn succeeds, using the same line sets and the same order. On the success path the line sets are still stopped at build time, so the result is identical. Two tests are added in vmm_core/vmotherboard/src/chipset/builder/mod.rs: a_failed_spawn_leaves_no_line_target (it fails before the fix and passes after), and the control a_normal_build_keeps_its_line_sets (the PIT, PIC, IO-APIC and BSP LINT mappings and target order are unchanged). For the tests' inspections, the patch adds inspect with its initiate feature as a dev-dependency of vmotherboard.
Activity
tangruize commentedon Nov 8, 2026
Proposed patch
Patch against OpenVMM 3cf58a5234ed824435825c9f87187f5129219724. Save the contents below as
fix.patchand rungit apply fix.patch.fix.patch