[CRIU] Re: Main kernel update up to 3.3-rc6
Cyrill Gorcunov
gorcunov at openvz.org
Thu Mar 8 12:32:47 EST 2012
On Thu, Mar 08, 2012 at 02:47:01AM +0400, Cyrill Gorcunov wrote:
> Hi guys,
>
> I've updated the kernel repo up to 3.3-rc6.
> At moment "selfexe00" fails simply because
> the crtools itself is note yet adopted for
> kernel changes (the interface get changed
> and not yet stabilized, neither it's picked
> up to -mm). So if one will be switching to
> this new kernel he needs to disable this
> test case.
>
> Anyway, just for your info. A safe path is
> to remain on crtools-v3.3-rc5 for a while.
>
For those who really needs being upstream -- here
is a patch for crtools (I've updated kernel
as well, so re-fetch the changes).
Cyrill
---
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Thu, 8 Mar 2012 21:09:44 +0400
Subject: [PATCH] restorer: Switch restoring of /proc/pid/exe symlink to new kernel interface
Note it requires crtools-v3.3-rc6 kernel to run.
Previous kernels wont work with it.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
restorer.c | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/restorer.c b/restorer.c
index 9f24e79..9ae798e 100644
--- a/restorer.c
+++ b/restorer.c
@@ -238,6 +238,7 @@ static long restore_self_exe_late(struct task_restore_core_args *args)
struct fdinfo_entry fe;
long ret = -1;
char *path;
+ int fd;
/*
* Path to exe file and its len is in image.
@@ -275,10 +276,20 @@ static long restore_self_exe_late(struct task_restore_core_args *args)
write_string(path);
write_string(")\n");
- ret = sys_prctl_safe(PR_SET_MM, PR_SET_MM_EXE_FILE, (long)path, fe.len + 1);
+ fd = sys_open(path, fe.flags, 0744);
+ if (fd >= 0) {
+ ret = sys_prctl_safe(PR_SET_MM, PR_SET_MM_EXE_FILE, fd, 0);
+ sys_close(fd);
+ } else {
+ write_string("sys_open failed\n");
+ write_num_n((long)fd);
+ ret = fd;
+ }
sys_munmap(path, fe.len + 1);
+ /* FIXME Once kernel side stabilized -- drop next line */
+ ret = 0;
return ret;
err:
@@ -513,13 +524,10 @@ long restore_task(struct task_restore_core_args *args)
goto core_restore_end;
/*
- * Restoring own /proc/pid/exe symlink is a bit
- * tricky -- we are to be sure no mmaps are
- * done over exec we're going to change, that's
- * why it's don that lately. Moreover, we are
- * to pass a path to new exec which means the
- * code should allocate memory enough for (maybe!)
- * pretty long file name.
+ * Because of requirements applied from kernel side
+ * we need to restore /proc/pid/exe symlink late,
+ * after old existing VMAs are superseded with
+ * new ones from image file.
*/
ret = restore_self_exe_late(args);
sys_close(args->fd_fdinfo);
--
1.7.7.6
More information about the CRIU
mailing list