[CRIU] [PATCH 1/2] remap: don't try to remap other files in /proc

Pavel Emelyanov xemul at parallels.com
Mon Sep 22 00:57:16 PDT 2014


On 09/19/2014 08:34 PM, Tycho Andersen wrote:
> We can't remap these files correctly anyway, so we should just return success
> if we find one of these files to remap.
> 
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> ---
>  files-reg.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/files-reg.c b/files-reg.c
> index 508263a..f788290 100644
> --- a/files-reg.c
> +++ b/files-reg.c
> @@ -634,7 +634,8 @@ static int check_path_remap(char *rpath, int plen, const struct fd_parms *parms,
>  				pr_info("Dumping dead process remap of %d\n", pid);
>  				return dump_dead_process_remap(pid, rpath + 1, plen - 1, ost, lfd, id, nsid);
>  			}

This } is also a closure of some if (). When this one fail we would also
flow into the unwanted code execution.

> -		}
> +		} else
> +			return 0;

I suggest just to leave the return 0 here, without any else-s.

>  	}
>  
>  	if (ost->st_nlink == 0)
> 

Thanks,
Pavel



More information about the CRIU mailing list