[CRIU] [PATCH 07/11] x86: cpu -- Report when unsupported compact xsave frame detected

Cyrill Gorcunov gorcunov at gmail.com
Thu Jun 14 20:27:26 MSK 2018


We don't have yet support of compacted xsave frames so report
error on cpu-check, checkpoint, restore actions. Basically
it is done in cpu_init routine which is called in the sites
we're interested in.

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 criu/arch/x86/cpu.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/criu/arch/x86/cpu.c b/criu/arch/x86/cpu.c
index 375a77550811..c7def88834c3 100644
--- a/criu/arch/x86/cpu.c
+++ b/criu/arch/x86/cpu.c
@@ -29,6 +29,20 @@
 
 static compel_cpuinfo_t rt_cpu_info;
 
+static int cpu_has_unsupported_features(void)
+{
+	/*
+	 * We don't support yet compacted xsave format so
+	 * exit early if present.
+	 */
+	if (compel_cpu_has_feature(X86_FEATURE_XSAVES)) {
+		pr_err("Unsupported compact xsave frame on runtime cpu present\n");
+		return 1;
+	}
+
+	return 0;
+}
+
 int cpu_init(void)
 {
 	if (compel_cpuid(&rt_cpu_info))
@@ -57,7 +71,7 @@ int cpu_init(void)
 		 !!compel_cpu_has_feature(X86_FEATURE_XGETBV1),
 		 !!compel_cpu_has_feature(X86_FEATURE_XSAVES));
 
-	return 0;
+	return cpu_has_unsupported_features() ? -1 : 0;
 }
 
 int cpu_dump_cpuinfo(void)
@@ -219,6 +233,9 @@ static int cpu_validate_ins_features(compel_cpuinfo_t *cpu_info)
 
 static int cpu_validate_features(compel_cpuinfo_t *cpu_info)
 {
+	if (cpu_has_unsupported_features())
+		return -1;
+
 	if (opts.cpu_cap == CPU_CAP_FPU) {
 		/*
 		 * If we're requested to check FPU only ignore
-- 
2.14.4



More information about the CRIU mailing list