Daniel Henrique Barboza <[email protected]> writes: > Maruks reported in [1] a problem with QMP introspection with > qemu-system-riscv64 that happens after querying a profile CPU. QEMU > crashes hitting an abort during satp_mode logic that, somehow, is being > triggered via profile code. > > For every profile CPU that goes through init we're setting an 'enabled' > flag in the static RISCVProfile object. This sounded like an okay idea > back when profiles were introduced, but now we've realized that QMP will > querying CPUs without exiting the QEMU process while also going multiple > times through cpu_init() and friends. The result is that we're in a > situation where we have runtime information being stored in static arrays > that persists between CPU definitions being introspected. > > A proper fix is to get rid of profile->enabled and turn profiles into > cpu->cfg flags like we do with every other extension. Unfortunately > we've been using profile->enabled for lots of things and a redesign > would be in order, one which I'm not comfortable doing right now - we're > too close to the QEMU 11.2 code freeze for such a change. > > For now let's silver tape a fix in cpu_init() to reset profile->enabled > for all available profiles. We'll do a proper redesign in the next > release cycle. > > [1] https://lore.kernel.org/qemu-devel/[email protected]/ > > Reported-by: Markus Armbruster <[email protected]> > Signed-off-by: Daniel Henrique Barboza <[email protected]>
That was quick, thank you! Tested-by: Markus Armbruster <[email protected]>
