lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <200906161636.10522.paul.moore@hp.com>
Date:	Tue, 16 Jun 2009 16:36:10 -0400
From:	Paul Moore <paul.moore@...com>
To:	Arnaldo Carvalho de Melo <acme@...hat.com>
Cc:	David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
	Chris Van Hoof <vanhoof@...hat.com>,
	Clark Williams <williams@...hat.com>,
	Caitlin Bestler <caitlin.bestler@...il.com>,
	Steven Whitehouse <steve@...gwyn.com>,
	" RĂ©mi Denis-Courmont" 
	<remi.denis-courmont@...ia.com>,
	Neil Horman <nhorman@...driver.com>,
	Nivedita Singhvi <niv@...ibm.com>
Subject: Re: [RFC v2] net: Introduce recvmmsg socket syscall

On Thursday 11 June 2009 05:53:42 pm Arnaldo Carvalho de Melo wrote:
> Em Thu, Jun 11, 2009 at 02:09:22PM -0400, Paul Moore escreveu:
> > On Wednesday 10 June 2009 11:40:22 pm Arnaldo Carvalho de Melo wrote:
> > > diff --git a/net/socket.c b/net/socket.c
> > > index 791d71a..f9f1e20 100644
> > > --- a/net/socket.c
> > > +++ b/net/socket.c
> > > @@ -702,6 +702,28 @@ int sock_recvmsg(struct socket *sock, struct
> > > msghdr *msg, return ret;
> > >  }
> > >
> > > +static int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg,
> > > +			      size_t size, int flags)
> > > +{
> > > +	struct kiocb iocb;
> > > +	struct sock_iocb siocb;
> > > +	int ret;
> > > +
> > > +	init_sync_kiocb(&iocb, NULL);
> > > +	iocb.private = &siocb;
> > > +
> > > +	siocb.sock = sock;
> > > +	siocb.scm = NULL;
> > > +	siocb.msg = msg;
> > > +	siocb.size = size;
> > > +	siocb.flags = flags;
> > > +
> > > +	ret = sock->ops->recvmsg(&iocb, sock, msg, size, flags);
> > > +	if (-EIOCBQUEUED == ret)
> > > +		ret = wait_on_sync_kiocb(&iocb);
> > > +	return ret;
> > > +}
> >
> > Hmmm, in an effort to reduce duplicated code how about updating
> > __sock_recvmsg() to something like the following:
> >
> > static inline int __sock_recvmsg(struct kiocb *iocb, struct socket *sock,
> >                                  struct msghdr *msg, size_t size, int
> > flags) {
> >         int err;
> >
> >         err = security_socket_recvmsg(...);
> >         if (err)
> >                 return err;
> >
> >         return sock_recvmsg_nosec(...);
> > }
> >
> > The only real difference is that now the *_kiocb() functions get called
> > and I have no clue if that is good or bad but it is different :)
>
> Yeah, gets clearer, like this:
>
> static inline int __sock_recvmsg_nosec(struct kiocb *iocb, struct socket
> *sock, struct msghdr *msg, size_t size, int flags)
> {
> 	struct sock_iocb *si = kiocb_to_siocb(iocb);
>
> 	si->sock = sock;
> 	si->scm = NULL;
> 	si->msg = msg;
> 	si->size = size;
> 	si->flags = flags;
>
> 	return sock->ops->recvmsg(iocb, sock, msg, size, flags);
> }
>
> static inline int __sock_recvmsg(struct kiocb *iocb, struct socket *sock,
> 				 struct msghdr *msg, size_t size, int flags)
> {
> 	int err = security_socket_recvmsg(sock, msg, size, flags);
>
> 	return err ?: __sock_recvmsg_nosec(iocb, sock, msg, size, flags);
> }
>
> static int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg,
> 			      size_t size, int flags)
> {
> 	struct kiocb iocb;
> 	struct sock_iocb siocb;
> 	int ret;
>
> 	init_sync_kiocb(&iocb, NULL);
> 	iocb.private = &siocb;
> 	ret = __sock_recvmsg_nosec(&iocb, sock, msg, size, flags);
> 	if (-EIOCBQUEUED == ret)
> 		ret = wait_on_sync_kiocb(&iocb);
> 	return ret;
> }
>
> Better now? :-)

Sorry for the delay, I was away for a few days and just got back to email this 
morning ... but yes, much better now, thanks :)

-- 
paul moore
linux @ hp

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ