[CRIU] [PATCH 02/10] dump: Dont read prohibited kernel files
Cyrill Gorcunov
gorcunov at openvz.org
Mon Sep 28 12:01:34 PDT 2015
From: Pavel Emelyanov <xemul at parallels.com>
In particular, we won't be able to do memory tracking,
zero page detection and vdso fixup (need help from Cyrill
on the latter thing).
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
kerndat.c | 11 ++++++++---
mem.c | 2 --
vdso.c | 13 +++++++++++--
3 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/kerndat.c b/kerndat.c
index 8eebe88e108b..fec2598e13ec 100644
--- a/kerndat.c
+++ b/kerndat.c
@@ -222,7 +222,9 @@ int kerndat_get_dirty_track(void)
* was at least once re-set. (this is to be removed in
* a couple of kernel releases)
*/
- do_task_reset_dirty_track(getpid());
+ if (do_task_reset_dirty_track(getpid()) < 0)
+ goto no_dt;
+
pm2 = open("/proc/self/pagemap", O_RDONLY);
if (pm2 < 0) {
pr_perror("Can't open pagemap file");
@@ -244,6 +246,7 @@ int kerndat_get_dirty_track(void)
pr_info("Dirty track supported on kernel\n");
kdat.has_dirty_track = true;
} else {
+no_dt:
pr_info("Dirty tracking support is OFF\n");
if (opts.track_mem) {
pr_err("Tracking memory is not available\n");
@@ -312,8 +315,10 @@ static int init_zero_page_pfn()
ret = vaddr_to_pfn((unsigned long)addr, &kdat.zero_page_pfn);
munmap(addr, PAGE_SIZE);
- if (kdat.zero_page_pfn == 0)
- ret = -1;
+ if (ret < 0 || kdat.zero_page_pfn == 0) {
+ pr_info("Zero page detection failed, optimization turns off.\n");
+ ret = 0;
+ }
return ret;
}
diff --git a/mem.c b/mem.c
index 989efc3a7d21..4b0d998ba99b 100644
--- a/mem.c
+++ b/mem.c
@@ -251,8 +251,6 @@ static int __parasite_dump_pages_seized(struct parasite_ctl *ctl,
pr_info("Dumping pages (type: %d pid: %d)\n", CR_FD_PAGES, ctl->pid.real);
pr_info("----------------------------------------\n");
- BUG_ON(kdat.zero_page_pfn == 0);
-
timing_start(TIME_MEMDUMP);
pr_debug(" Private vmas %lu/%lu pages\n",
diff --git a/vdso.c b/vdso.c
index 1524d475cb01..a7cfc8027869 100644
--- a/vdso.c
+++ b/vdso.c
@@ -50,8 +50,14 @@ int parasite_fixup_vdso(struct parasite_ctl *ctl, pid_t pid,
args = parasite_args(ctl, struct parasite_vdso_vma_entry);
fd = open_proc(pid, "pagemap");
- if (fd < 0)
+ if (fd < 0) {
+ if (errno == EPERM) {
+ pr_info("No VDSO fixup possible :(\n");
+ return 0;
+ }
+
return -1;
+ }
list_for_each_entry(vma, &vma_area_list->h, list) {
if (!vma_area_is(vma, VMA_AREA_REGULAR))
@@ -290,5 +296,8 @@ int vdso_init(void)
{
if (vdso_fill_self_symtable(&vdso_sym_rt))
return -1;
- return vaddr_to_pfn(vdso_sym_rt.vma_start, &vdso_pfn);
+ if (vaddr_to_pfn(vdso_sym_rt.vma_start, &vdso_pfn) < 0)
+ pr_info("VDSO detection turned off\n");
+
+ return 0;
}
--
2.4.3
More information about the CRIU
mailing list