[CRIU] [PATCHv2 2/2] cr-check: add compat_cr check

Dmitry Safonov dsafonov at virtuozzo.com
Tue Jan 10 06:32:06 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>
---
v2: fix patch's subject (compat_restore => compat_cr)
    add compat check to `criu check` (and thou change loglevel to warn)

 criu/cr-check.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/criu/cr-check.c b/criu/cr-check.c
index 852f3b746cb8..03ee1e9bc4b6 100644
--- a/criu/cr-check.c
+++ b/criu/cr-check.c
@@ -50,6 +50,7 @@
 #include "libnetlink.h"
 #include "net.h"
 #include "linux/userfaultfd.h"
+#include "restorer.h"
 
 static char *feature_name(int (*func)());
 
@@ -1043,6 +1044,14 @@ static int check_uffd(void)
 	return 0;
 }
 
+static int check_compat_cr(void)
+{
+	if (kdat_compat_sigreturn_test())
+		return 0;
+	pr_warn("compat_cr is not supported. Requires kernel >= v4.9\n");
+	return -1;
+}
+
 static int (*chk_feature)(void);
 
 /*
@@ -1152,6 +1161,7 @@ int cr_check(void)
 	if (opts.check_experimental_features) {
 		ret |= check_autofs();
 		ret |= check_uffd();
+		ret |= check_compat_cr();
 	}
 
 	print_on_level(DEFAULT_LOGLEVEL, "%s\n", ret ? CHECK_MAYBE : CHECK_GOOD);
@@ -1226,6 +1236,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