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] [thread-next>] [day] [month] [year] [list]
Date: Thu, 25 May 2023 16:54:27 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: Breno Leitao <leitao@...ian.org>, dsahern@...nel.org,
	willemdebruijn.kernel@...il.com,
	Remi Denis-Courmont <courmisch@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Alexander Aring <alex.aring@...il.com>,
	Stefan Schmidt <stefan@...enfreihafen.org>,
	Miquel Raynal <miquel.raynal@...tlin.com>,
	Matthieu Baerts <matthieu.baerts@...sares.net>,
	Mat Martineau <martineau@...nel.org>,
	Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
	Xin Long <lucien.xin@...il.com>, leit@...com, axboe@...nel.dk,
	asml.silence@...il.com, linux-kernel@...r.kernel.org,
	netdev@...r.kernel.org, dccp@...r.kernel.org,
	linux-wpan@...r.kernel.org, mptcp@...ts.linux.dev,
	linux-sctp@...r.kernel.org
Subject: Re: [PATCH net-next v3] net: ioctl: Use kernel memory on protocol
 ioctl callbacks

On Thu, May 25, 2023 at 04:19:32PM +0200, Eric Dumazet wrote:
> On Thu, May 25, 2023 at 2:55 PM Breno Leitao <leitao@...ian.org> wrote:
> >
> > Most of the ioctls to net protocols operates directly on userspace
> > argument (arg). Usually doing get_user()/put_user() directly in the
> > ioctl callback.  This is not flexible, because it is hard to reuse these
> > functions without passing userspace buffers.
> >
> > Change the "struct proto" ioctls to avoid touching userspace memory and
> > operate on kernel buffers, i.e., all protocol's ioctl callbacks is
> > adapted to operate on a kernel memory other than on userspace (so, no
> > more {put,get}_user() and friends being called in the ioctl callback).
> >
> 
>  diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
> > index 862f1719b523..93705d99f862 100644
> > --- a/include/net/phonet/phonet.h
> > +++ b/include/net/phonet/phonet.h
> > @@ -109,4 +109,23 @@ void phonet_sysctl_exit(void);
> >  int isi_register(void);
> >  void isi_unregister(void);
> >
> > +#ifdef CONFIG_PHONET
> > +int phonet_sk_ioctl(struct sock *sk, unsigned int cmd, void __user *arg);
> > +
> > +static inline bool phonet_is_sk(struct sock *sk)
> > +{
> > +       return sk->sk_family == PF_PHONET && sk->sk_protocol == PN_PROTO_PHONET;
> > +}
> > +#else
> > +static inline bool phonet_is_sk(struct sock *sk)
> > +{
> > +       return 0;
> > +}
> > +
> > +static inline int phonet_sk_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)
> > +{
> > +       return 1;
> > +}
> > +#endif
> > +
> >
> 
> PHONET can be built as a module, so I guess the compiler would
> complain if "CONFIG_PHONET=m" ???

Yes, indeed it does.

-- 
pw-bot: cr


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ