[CRIU] Re: [PATCH 3/4] pipes: Set fowners for both pipe ends

Cyrill Gorcunov gorcunov at openvz.org
Thu Apr 12 06:29:50 EDT 2012


On Thu, Apr 12, 2012 at 02:18:42PM +0400, Pavel Emelyanov wrote:
> On 04/12/2012 01:45 PM, Cyrill Gorcunov wrote:
> > Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> > ---
> >  pipes.c |    7 ++++---
> >  1 files changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/pipes.c b/pipes.c
> > index 3ebad92..99672d1 100644
> > --- a/pipes.c
> > +++ b/pipes.c
> > @@ -261,6 +261,10 @@ static int open_pipe(struct file_desc *d)
> >  		return -1;
> >  	}
> >  
> > +	if (restore_fown(pfd[0], &pi->pe.fown) ||
> > +	    restore_fown(pfd[1], &pi->pe.fown))
> > +		return -1;
> > +
> 
> No, this is wrong. The restore_fown for the other end should
> occur in recv fn, since it reopens the struct file.

Updated below, use it instead of this patch.

	Cyrill
-------------- next part --------------
>From 79a10b83b68ab5227d33b054690b373fa94161e9 Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Thu, 12 Apr 2012 14:28:40 +0400
Subject: [PATCH] pipes: Restore fowner for second pipe end

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 pipes.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/pipes.c b/pipes.c
index d494751..7cc2770 100644
--- a/pipes.c
+++ b/pipes.c
@@ -214,6 +214,9 @@ static int recv_pipe_fd(struct pipe_info *pi)
 	fd = open(path, pi->pe.flags);
 	close(tmp);
 
+	if (restore_fown(fd, &pi->pe.fown))
+		return -1;
+
 	return fd;
 }
 
-- 
1.7.7.6



More information about the CRIU mailing list