Commit 78402658 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Andrei Vagin

vdso: Separate vdso_init() on dump/restore

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.
Reviewed-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 69a66e13
...@@ -1562,7 +1562,7 @@ int cr_pre_dump_tasks(pid_t pid) ...@@ -1562,7 +1562,7 @@ int cr_pre_dump_tasks(pid_t pid)
if (cpu_init()) if (cpu_init())
goto err; goto err;
if (vdso_init()) if (vdso_init_dump())
goto err; goto err;
if (connect_to_page_server_to_send() < 0) if (connect_to_page_server_to_send() < 0)
...@@ -1738,7 +1738,7 @@ int cr_dump_tasks(pid_t pid) ...@@ -1738,7 +1738,7 @@ int cr_dump_tasks(pid_t pid)
if (cpu_init()) if (cpu_init())
goto err; goto err;
if (vdso_init()) if (vdso_init_dump())
goto err; goto err;
if (cgp_init(opts.cgroup_props, if (cgp_init(opts.cgroup_props,
......
...@@ -2205,7 +2205,7 @@ int cr_restore_tasks(void) ...@@ -2205,7 +2205,7 @@ int cr_restore_tasks(void)
if (cpu_init() < 0) if (cpu_init() < 0)
goto err; goto err;
if (vdso_init()) if (vdso_init_restore())
goto err; goto err;
if (opts.cpu_cap & (CPU_CAP_INS | CPU_CAP_CPU)) { if (opts.cpu_cap & (CPU_CAP_INS | CPU_CAP_CPU)) {
......
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
extern struct vdso_maps vdso_maps; extern struct vdso_maps vdso_maps;
extern struct vdso_maps vdso_maps_compat; 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, extern int parasite_fixup_vdso(struct parasite_ctl *ctl, pid_t pid,
struct vm_area_list *vma_area_list); struct vm_area_list *vma_area_list);
...@@ -25,7 +26,8 @@ extern void compat_vdso_helper(struct vdso_maps *native, int pipe_fd, ...@@ -25,7 +26,8 @@ extern void compat_vdso_helper(struct vdso_maps *native, int pipe_fd,
#else /* CONFIG_VDSO */ #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) #define parasite_fixup_vdso(ctl, pid, vma_area_list) (0)
#endif /* CONFIG_VDSO */ #endif /* CONFIG_VDSO */
......
...@@ -466,7 +466,22 @@ static int vdso_fill_compat_symtable(struct vdso_maps *native, ...@@ -466,7 +466,22 @@ static int vdso_fill_compat_symtable(struct vdso_maps *native,
} }
#endif /* CONFIG_COMPAT */ #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)) { if (vdso_parse_maps(PROC_SELF, &vdso_maps)) {
pr_err("Failed reading self/maps for filling vdso/vvar bounds\n"); pr_err("Failed reading self/maps for filling vdso/vvar bounds\n");
...@@ -483,10 +498,5 @@ int vdso_init(void) ...@@ -483,10 +498,5 @@ int vdso_init(void)
return -1; 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; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment