[CRIU] [PATCH 10/11] vdso: Separate vdso_init() on dump/restore
Dmitry Safonov
dsafonov at virtuozzo.com
Thu Jun 15 19:36:14 MSK 2017
On dump we only need vdso_pfn to be filled,
on restore we need filled symtables.
That means, that we can omit filling symtables on dump,
which also means no need in calling compat_vdso_helper
process with fork(), pipe(), read(), write() and so on syscalls.
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
criu/cr-dump.c | 4 ++--
criu/cr-restore.c | 2 +-
criu/include/vdso.h | 6 ++++--
criu/vdso.c | 22 ++++++++++++++++------
4 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/criu/cr-dump.c b/criu/cr-dump.c
index 9132737432bf..47251b5d6025 100644
--- a/criu/cr-dump.c
+++ b/criu/cr-dump.c
@@ -1647,7 +1647,7 @@ int cr_pre_dump_tasks(pid_t pid)
if (cpu_init())
goto err;
- if (vdso_init())
+ if (vdso_init_dump())
goto err;
if (connect_to_page_server_to_send() < 0)
@@ -1840,7 +1840,7 @@ int cr_dump_tasks(pid_t pid)
if (cpu_init())
goto err;
- if (vdso_init())
+ if (vdso_init_dump())
goto err;
if (cgp_init(opts.cgroup_props,
diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 412f86aac9e1..fc8490c6fff3 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -2398,7 +2398,7 @@ int cr_restore_tasks(void)
if (cpu_init() < 0)
goto err;
- if (vdso_init())
+ if (vdso_init_restore())
goto err;
if (opts.cpu_cap & (CPU_CAP_INS | CPU_CAP_CPU)) {
diff --git a/criu/include/vdso.h b/criu/include/vdso.h
index 7317384256f5..6a9752bd1c0b 100644
--- a/criu/include/vdso.h
+++ b/criu/include/vdso.h
@@ -13,7 +13,8 @@
extern struct vdso_maps vdso_maps;
extern struct vdso_maps vdso_maps_compat;
-extern int vdso_init(void);
+extern int vdso_init_dump(void);
+extern int vdso_init_restore(void);
extern int parasite_fixup_vdso(struct parasite_ctl *ctl, pid_t pid,
struct vm_area_list *vma_area_list);
@@ -25,7 +26,8 @@ extern void compat_vdso_helper(struct vdso_maps *native, int pipe_fd,
#else /* CONFIG_VDSO */
-#define vdso_init() (0)
+#define vdso_init_dump() (0)
+#define vdso_init_restore() (0)
#define parasite_fixup_vdso(ctl, pid, vma_area_list) (0)
#endif /* CONFIG_VDSO */
diff --git a/criu/vdso.c b/criu/vdso.c
index f20703b1f00b..da3da69f4878 100644
--- a/criu/vdso.c
+++ b/criu/vdso.c
@@ -466,7 +466,22 @@ static int vdso_fill_compat_symtable(struct vdso_maps *native,
}
#endif /* CONFIG_COMPAT */
-int vdso_init(void)
+int vdso_init_dump(void)
+{
+ if (vdso_parse_maps(PROC_SELF, &vdso_maps)) {
+ pr_err("Failed reading self/maps for filling vdso/vvar bounds\n");
+ return -1;
+ }
+
+ if (kdat.pmap != PM_FULL)
+ pr_info("VDSO detection turned off\n");
+ else if (vaddr_to_pfn(vdso_maps.vdso_start, &vdso_pfn))
+ return -1;
+
+ return 0;
+}
+
+int vdso_init_restore(void)
{
if (vdso_parse_maps(PROC_SELF, &vdso_maps)) {
pr_err("Failed reading self/maps for filling vdso/vvar bounds\n");
@@ -483,10 +498,5 @@ int vdso_init(void)
return -1;
}
- if (kdat.pmap != PM_FULL)
- pr_info("VDSO detection turned off\n");
- else if (vaddr_to_pfn(vdso_maps.vdso_start, &vdso_pfn))
- return -1;
-
return 0;
}
--
2.12.2
More information about the CRIU
mailing list