[CRIU] [PATCH 2/2] sk-unix: queuer should be set for peer

Andrew Vagin avagin at gmail.com
Mon Aug 3 00:25:30 PDT 2015


On Sun, Aug 02, 2015 at 07:22:03PM +0200, Tycho Andersen wrote:
> On Sat, Aug 01, 2015 at 10:26:42PM +0300, Andrey Vagin wrote:
> > because we are going to restore data of peer.
> 
> Heh, whoops. I guess this just caused all the restoration to be a
> no-op? Anyway,

You can try a test which is in the first patch. It fails without this patch and
passes with it.  I really recommend you to write tests when you are fixing
something like this;).

> 
> Acked-by: Tycho Andersen <tycho.andersen at canonical.com>
> 
> > Anyway this is wrong, because we need to restore a message with a sender
> > address.
> 
> Can you elaborate?


A dgram socket is bound to an address and anyone can send messages to this
socket. A kernel allows to get a sender address for each messages. For this you
need to use recvmsg().

man 2 recvmsg
"""
The msg_name field points to a caller-allocated buffer that is used  to
return  the  source  address  if the socket is unconnected.  The caller
should set msg_namelen to the size of this  buffer  before  this  call;
upon return from a successful call, msg_name will contain the length of
the returned address.  If the application does not  need  to  know  the
source address, msg_name can be specified as NULL.
"""

Currently CRIU doesn't retore source addresses for messages.

> 
> Thanks,
> 
> Tycho
> 
> > Cc: Tycho Andersen <tycho.andersen at canonical.com>
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> >  sk-unix.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/sk-unix.c b/sk-unix.c
> > index 7a99728..d05eb1a 100644
> > --- a/sk-unix.c
> > +++ b/sk-unix.c
> > @@ -1267,8 +1267,8 @@ int resolve_unix_peers(void)
> >  		}
> >  
> >  		ui->peer = peer;
> > -		if (!ui->queuer)
> > -			ui->queuer = ui->ue->ino;
> > +		if (!peer->queuer)
> > +			peer->queuer = ui->ue->ino;
> >  		if (ui == peer)
> >  			/* socket connected to self %) */
> >  			continue;
> > -- 
> > 2.1.0
> > 


More information about the CRIU mailing list