[CRIU] [PATCH] uffd.c: create lazy-pages socket in image directory
Pavel Emelyanov
xemul at virtuozzo.com
Fri Jan 13 07:31:15 PST 2017
On 01/13/2017 01:47 PM, Adrian Reber wrote:
> From: Adrian Reber <areber at redhat.com>
>
> runc uses the work-dir and image-dir option to control where
> criu is running. This means that criu chdir()-s to work-dir
> and the lazy-pages socket cannot be found as it is in the image
> directory.
Bu the socket __should__ be in work directory, is it really there? If no,
then that's the bug, we should bind() socket in proper place.
Cc Mike
> I think there was a problem with too long socket names which make it
> impossible to include the full path. Therefore this change tries to
> fchdir() to the image directory before accessing the lazy-pages socket
> and chdir()-s back to the work-dir after that.
>
> Signed-off-by: Adrian Reber <areber at redhat.com>
> ---
> criu/uffd.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/criu/uffd.c b/criu/uffd.c
> index 516b800..fcedb65 100644
> --- a/criu/uffd.c
> +++ b/criu/uffd.c
> @@ -247,12 +247,16 @@ int prepare_lazy_pages_socket(void)
> return -1;
>
> len = offsetof(struct sockaddr_un, sun_path) + strlen(sun.sun_path);
> + /* change to image dir in case work dir has changed */
> + fchdir(criu_get_image_dir());
> if (connect(new_fd, (struct sockaddr *) &sun, len) < 0) {
> pr_perror("connect to %s failed", sun.sun_path);
> close(new_fd);
> + chdir(opts.work_dir);
> return -1;
> }
>
> + chdir(opts.work_dir);
> return 0;
> }
>
>
More information about the CRIU
mailing list