[CRIU] [PATCH 2/2] cr-check: add compat_restore check

Dmitry Safonov dsafonov at virtuozzo.com
Mon Jan 9 08:59:24 PST 2017


Initialy, I thought to name it "compat_restore", but after I've dropped
the second 32-bit parasite (which surely made compat code lesser and
easier), our parasite works in 64-bit in 32-bit task and ptrace()
for setting registers in this long-jumped situation will work correctly
only after v4.9 kernel. Maybe it can be work-arounded if needed,
but yet no compatible dump for pre-v4.9 kernels.

Requested-by: Andrei Vagin <avagin at virtuozzo.com>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/cr-check.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/criu/cr-check.c b/criu/cr-check.c
index 60279e135dfa..94c5074557ce 100644
--- a/criu/cr-check.c
+++ b/criu/cr-check.c
@@ -48,6 +48,7 @@
 #include "libnetlink.h"
 #include "net.h"
 #include "linux/userfaultfd.h"
+#include "restorer.h"
 
 static char *feature_name(int (*func)());
 
@@ -1134,6 +1135,14 @@ static int check_loginuid(void)
 	return 0;
 }
 
+static int check_compat_cr(void)
+{
+	if (kdat_compat_sigreturn_test())
+		return 0;
+	pr_err("compat_cr is not supported. Requires kernel >= v4.9\n");
+	return -1;
+}
+
 struct feature_list {
 	char *name;
 	int (*func)();
@@ -1154,6 +1163,7 @@ static struct feature_list feature_list[] = {
 	{ "autofs", check_autofs },
 	{ "tcp_half_closed", check_tcp_halt_closed },
 	{ "lazy_pages", check_uffd },
+	{ "compat_cr", check_compat_cr },
 	{ NULL, NULL },
 };
 
-- 
2.11.0



More information about the CRIU mailing list