Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:Update
qemu-linux-user
0280-migration-warn-about-inconsistent-s.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0280-migration-warn-about-inconsistent-s.patch of Package qemu-linux-user
From: Bruce Rogers <brogers@suse.com> Date: Wed, 21 Feb 2018 14:00:52 -0700 Subject: migration: warn about inconsistent spec_ctrl state As an attempt to help the user do the right thing, warn if we detect spec_ctrl data in the migration stream, but where the cpu defined doesn't have the feature. This would indicate the migration is from the quick and dirty qemu produced in January 2018 to handle Spectre v2. That qemu version exposed the IBRS cpu feature to all vcpu types, which helped in the short term but wasn't a well designed approach. Warn the user that the now migrated guest needs to be restarted as soon as possible, using the spec_ctrl cpu feature flag or a *-IBRS vcpu model specified as appropriate. Signed-off-by: Bruce Rogers <brogers@suse.com> --- cpus.c | 12 ++++++++++++ include/qemu/thread.h | 1 + migration/migration.c | 9 +++++++++ 3 files changed, 22 insertions(+) diff --git a/cpus.c b/cpus.c index 1421a35c49fe4e13ca02734451ff..5cf27b47263c6f3909ba8c8165d2 100644 --- a/cpus.c +++ b/cpus.c @@ -1689,6 +1689,18 @@ exit: fclose(f); } +bool spec_ctrl_is_inconsistent(void) +{ +#if defined(TARGET_I386) + X86CPU *x86_cpu = X86_CPU(current_cpu); + CPUX86State *env = x86_cpu != NULL ? &x86_cpu->env : NULL; + if (env && !(env->features[FEAT_7_0_EDX] & CPUID_7_0_EDX_SPEC_CTRL) && + env->spec_ctrl) + return true; +#endif + return false; +} + void qmp_inject_nmi(Error **errp) { #if defined(TARGET_I386) diff --git a/include/qemu/thread.h b/include/qemu/thread.h index bdae6dfdbe53f7c9c05340d0c957..d311aeddb66f52651f5055214899 100644 --- a/include/qemu/thread.h +++ b/include/qemu/thread.h @@ -60,4 +60,5 @@ struct Notifier; void qemu_thread_atexit_add(struct Notifier *notifier); void qemu_thread_atexit_remove(struct Notifier *notifier); +bool spec_ctrl_is_inconsistent(void); #endif diff --git a/migration/migration.c b/migration/migration.c index 4369e2782b9dc46227058d649221..2e2b9c01eee21a29839016630fa0 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1617,6 +1617,15 @@ static void migration_completion(MigrationState *s, int current_active_state, migrate_set_state(&s->state, current_active_state, MIGRATION_STATUS_COMPLETED); + + if (spec_ctrl_is_inconsistent()) { + fprintf(stderr, "WARNING! Migration from qemu with rudimentary " + "Spectre v2 support to newer qemu\ndetected! To " + "maintain proper protection, restart the guest as " + "soon as possible\nusing the spec_ctrl cpu feature " + "flag or a *-IBRS vcpu model specified\nas appropriate." + "\n"); + } return; fail_invalidate:
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor