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

Tycho Andersen tycho.andersen at canonical.com
Mon Sep 22 07:37:14 PDT 2014


On Mon, Sep 22, 2014 at 11:57:16AM +0400, Pavel Emelyanov wrote:
> 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.

Sounds good,



We can't remap these files correctly anyway, so we should just return success
if we find one of these files to remap.

v2: don't try to remap accessible files in /proc

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 files-reg.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/files-reg.c b/files-reg.c
index 508263a..9d7ed92 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -635,6 +635,8 @@ static int check_path_remap(char *rpath, int plen, const struct fd_parms *parms,
 				return dump_dead_process_remap(pid, rpath + 1, plen - 1, ost, lfd, id, nsid);
 			}
 		}
+
+		return 0;
 	}
 
 	if (ost->st_nlink == 0)
-- 
1.9.1



More information about the CRIU mailing list