[CRIU] [PATCH] check: Make sure dirty tracking not used on unpatched kernel
Cyrill Gorcunov
gorcunov at openvz.org
Thu Jan 30 09:40:32 PST 2014
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
kerndat.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/kerndat.c b/kerndat.c
index 27acf0cc2ed1..04c937f1814f 100644
--- a/kerndat.c
+++ b/kerndat.c
@@ -88,6 +88,18 @@ int kerndat_get_dirty_track(void)
map[0] = '\0';
+ /*
+ * It's known some kernel versions may have a dirty
+ * page tracking bug which clears soft dirty bit if
+ * mprotect code is unpatched. So in such case don't
+ * allow to use dirty page tracking.
+ */
+ if (mprotect(map, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC)) {
+ pr_perror("Alter prot err!");
+ munmap(map, PAGE_SIZE);
+ return -1;
+ }
+
lseek(pm2, (unsigned long)map / PAGE_SIZE * sizeof(u64), SEEK_SET);
ret = read(pm2, &pmap, sizeof(pmap));
if (ret < 0)
--
1.8.3.1
More information about the CRIU
mailing list