All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Jakub Kicinski' <kuba@kernel.org>, Peter Collingbourne <pcc@google.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Colin Ian King <colin.king@canonical.com>,
	Cong Wang <cong.wang@bytedance.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Greg KH <gregkh@linuxfoundation.org>,
	"Arnd Bergmann" <arnd@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH v2] net: don't unconditionally copy_from_user a struct ifreq for socket ioctls
Date: Wed, 1 Sep 2021 08:22:42 +0000	[thread overview]
Message-ID: <bf0f47974d7141358d810d512d4b9a00@AcuMS.aculab.com> (raw)
In-Reply-To: <20210831093006.6db30672@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

From: Jakub Kicinski
> Sent: 31 August 2021 17:30
> 
> On Thu, 26 Aug 2021 12:46:01 -0700 Peter Collingbourne wrote:
> > @@ -3306,6 +3308,8 @@ static int compat_ifr_data_ioctl(struct net *net, unsigned int cmd,
> >  	struct ifreq ifreq;
> >  	u32 data32;
> >
> > +	if (!is_socket_ioctl_cmd(cmd))
> > +		return -ENOTTY;
> >  	if (copy_from_user(ifreq.ifr_name, u_ifreq32->ifr_name, IFNAMSIZ))
> >  		return -EFAULT;
> >  	if (get_user(data32, &u_ifreq32->ifr_data))
> 
> Hi Peter, when resolving the net -> net-next merge conflict I couldn't
> figure out why this chunk is needed. It seems all callers of
> compat_ifr_data_ioctl() already made sure it's a socket IOCTL.
> Please double check my resolution (tip of net-next) and if this is
> indeed unnecessary perhaps send a cleanup? Thanks!

To stop the copy_from_user() faulting when the user buffer
isn't long enough.
In particular for iasatty() on arm with tagged pointers.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2021-09-01  8:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-26 19:46 [PATCH v2] net: don't unconditionally copy_from_user a struct ifreq for socket ioctls Peter Collingbourne
2021-08-27  8:50 ` patchwork-bot+netdevbpf
2021-08-31 16:30 ` Jakub Kicinski
2021-09-01  8:22   ` David Laight [this message]
2021-09-01 14:03     ` Jakub Kicinski
2021-09-01 18:01       ` Peter Collingbourne
2021-09-01 23:20         ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf0f47974d7141358d810d512d4b9a00@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=arnd@kernel.org \
    --cc=colin.king@canonical.com \
    --cc=cong.wang@bytedance.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pcc@google.com \
    --cc=stable@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.