qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/2] net/tap: fix FreeBSD portability problem receiving TA


From: Daniel P . Berrangé
Subject: Re: [PATCH v2 1/2] net/tap: fix FreeBSD portability problem receiving TAP FD
Date: Fri, 14 May 2021 13:05:29 +0100
User-agent: Mutt/2.0.6 (2021-03-06)

On Wed, May 12, 2021 at 06:35:57PM +0200, Philippe Mathieu-Daudé wrote:
> On 5/12/21 5:36 PM, Daniel P. Berrangé wrote:
> > The CMSG_LEN and CMSG_SPACE macros must not be assumed to return the
> > same value. The msg_controllen field must be initialized using
> > CMSG_SPACE when using SCM_RIGHTS.
> > 
> > This ought to fix any FD receive issues users might be hitting on
> > 64-bit FeeBSD / NetBSD platforms. The flaw was noticed first in
> > GNULIB
> > 
> >    https://lists.gnu.org/archive/html/bug-gnulib/2021-02/msg00066.html
> > 
> > and QEMU's code has the same logic bug.
> > 
> > Reviewed-by: Connor Kuehl <ckuehl@redhat.com>
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> >  net/tap.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/net/tap.c b/net/tap.c
> > index bae895e287..276a9077fc 100644
> > --- a/net/tap.c
> > +++ b/net/tap.c
> > @@ -467,7 +467,7 @@ static int recv_fd(int c)
> >      cmsg->cmsg_level = SOL_SOCKET;
> >      cmsg->cmsg_type = SCM_RIGHTS;
> >      cmsg->cmsg_len = CMSG_LEN(sizeof(fd));
> > -    msg.msg_controllen = cmsg->cmsg_len;
> > +    msg.msg_controllen = CMSG_SPACE(sizeof(fd));
> >  
> >      iov.iov_base = req;
> >      iov.iov_len = sizeof(req);
> > 
> 
> Possibly more:

Ewwwww, yes :-(



Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]