[lxc-devel] [PATCH] Use actual length of socket's name for abstract sockets

Serge Hallyn serge.hallyn at ubuntu.com
Tue Oct 22 16:42:40 UTC 2013


Quoting S.Çağlar Onur (caglar at 10ur.org):
> Hi,
> 
> 
> On Mon, Oct 21, 2013 at 8:30 PM, Serge Hallyn <serge.hallyn at ubuntu.com>wrote:
> 
> > Quoting S.Çağlar Onur (caglar at 10ur.org):
> > > The addrlen parameter should be the actual length of socket's name for
> > abstract sockets. Otherwise socket gets padded with NULLs.
> > >
> > > cat /proc/net/unix | grep lxc
> > > [...]
> > > 0000000000000000: 00000003 00000000 00000000 0001 03 226548
> > @lxc/ad055575fe28ddd5//var/lib/lxc^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
> > > [...]
> > >
> > > with this patch;
> > >
> > > cat /proc/net/unix | grep lxc
> > > [...]
> > > 0000000000000000: 00000002 00000000 00010000 0001 01 109563
> > @lxc/ad055575fe28ddd5//var/lib/lxc
> > > [...]
> >
> > Yeah I've noticed that too :)  However, you can't just take the length
> > of the passed-in string, you need to make sure it's no larger
> > than sizeof(addr.sun_path)-1.  Is that being guaranteed somewhere else
> > that I'm glossing over?
> 
> 
> Hmm I think current code path also lacks that check. As long as I see we
> only control the length in lxc_af_unix_open for non-abstract case. I'll add
> the checks and iterate one more time sometime this week.

Thanks!




More information about the lxc-devel mailing list