[CRIU] Re: [PATCH] Add checkpoint/restore for /proc/pid/exe symlink

Cyrill Gorcunov gorcunov at openvz.org
Mon Feb 6 10:49:21 EST 2012


On Mon, Feb 06, 2012 at 07:41:36PM +0400, Cyrill Gorcunov wrote:
> This patch adds ability to checkpoint/restore
> /proc/pid/exe symlink, so if a process we've just
> checkpointed has been say /path/to/exe, then at restore
> time we bring this path back.
> 
> A few notes
> 
>  - If the file which symlink we're about to restore
>    has been deleted after checkpoint procedure and
>    no longer exist -- we print error message but do
>    not interrupt restore procedure because it's not
>    that critical
> 
>  - Also there some restiction from kernel side: if
>    existing /proc/pid/exe already mapped more than
>    once, the kernel will refuse to change the symlink,
>    so we need to restore it lately when mmaps of crtools
>    itself already unmapped (ie via late call in
>    restorer.c).
> 
> In any case -- we don't treat inability to restore
> /proc/pid/exe symlink as a critical error.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---

Note, tis requires the patch

commit 941438a4734ea365b47c58ca30cb44a057ecdf38
Author: Cyrill Gorcunov <gorcunov at openvz.org>
Date:   Mon Feb 6 19:25:15 2012 +0400

    c/r: prctl: Add ability to set new mm_struct::exe_file
    
    When we do restore we would like to have a way to setup
    a former mm_struct::exe_file so that /proc/pid/exe would
    point to the original executable file a process had at
    checkpoint time.
    
    For this sake PR_SET_MM_EXE_FILE code is introduced.
    
    Note, if mm_struct::exe_file already mapped more than once
    we refuse to change anything (which prevents kernel from
    potential problems).
    
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>

to be present in kernel. At moment I've it in -testing branch,
so main crtools-3.3-rc2 kernel will not be able to restore exe
yet, but even without kernel support crtools continue working
simply printing out that prctl call failed with some error,
nothing critical.

	Cyrill


More information about the CRIU mailing list