[CRIU] [PATCH 2/2] pie: x86 -- Do a real call for applying relocations
Cyrill Gorcunov
gorcunov at openvz.org
Tue May 12 05:42:15 PDT 2015
At moment both parasite and restorer do not have
any relocs because we support x86-64 only, but
this will be changed soon so do a call and apply
relocations.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
cr-restore.c | 4 ++++
parasite-syscall.c | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/cr-restore.c b/cr-restore.c
index bbbfd454df63..ac0fb6e6a9bb 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -2384,6 +2384,10 @@ static int remap_restorer_blob(void *addr)
return -1;
}
+#if defined(CONFIG_X86_64) || defined(CONFIG_X86_32)
+ elf_apply_relocs(addr, addr, sizeof(restorer_blob),
+ elf_relocs, ARRAY_SIZE(elf_relocs));
+#endif
return 0;
}
diff --git a/parasite-syscall.c b/parasite-syscall.c
index e3cf2f8e4cf6..e158c0385897 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -1223,6 +1223,11 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item,
pr_info("Putting parasite blob into %p->%p\n", ctl->local_map, ctl->remote_map);
memcpy(ctl->local_map, parasite_blob, sizeof(parasite_blob));
+#if defined(CONFIG_X86_64) || defined(CONFIG_X86_32)
+ elf_apply_relocs(ctl->local_map, ctl->remote_map, sizeof(parasite_blob),
+ elf_relocs, ARRAY_SIZE(elf_relocs));
+#endif
+
/* Setup the rest of a control block */
ctl->parasite_ip = (unsigned long)parasite_sym(ctl->remote_map, __export_parasite_head_start);
ctl->addr_cmd = parasite_sym(ctl->local_map, __export_parasite_cmd);
--
2.1.0
More information about the CRIU
mailing list