netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: vdronov@redhat.com
Cc: kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org,
	netdev@vger.kernel.org, syzkaller@googlegroups.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: arp, ipv6: handle special case of tap device
Date: Sat, 29 Sep 2018 11:40:23 -0700 (PDT)	[thread overview]
Message-ID: <20180929.114023.1370133506922372520.davem@davemloft.net> (raw)
In-Reply-To: <20180926093018.6646-1-vdronov@redhat.com>

From: Vladis Dronov <vdronov@redhat.com>
Date: Wed, 26 Sep 2018 11:30:18 +0200

> @@ -187,7 +187,14 @@ EXPORT_SYMBOL(arp_tbl);
>  
>  int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir)
>  {
> -	switch (dev->type) {
> +	unsigned short type = dev->type;
> +
> +#if IS_ENABLED(CONFIG_TAP)
> +	if (dev->rtnl_link_ops && !strcmp(dev->rtnl_link_ops->kind, "tun"))
> +		type = ARPHRD_ETHER;
> +#endif /* CONFIG_TAP */

This is insanely ugly.

dev->type determines the link layer header layout and size.

You can fix the kernel, but userspace AF_PACKET applications are still
going to be broken by this behavior.  And that is just the tip of the
iceberg.

I'm not applying this, sorry.  I think tun/tap should be prevented from
allowing the dev->type to be changed, unless it will make those changes
adjust the link layer headers properly as well.

Sorry.

  reply	other threads:[~2018-09-29 18:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-26  9:30 [PATCH] net: arp, ipv6: handle special case of tap device Vladis Dronov
2018-09-29 18:40 ` David Miller [this message]
2018-10-01 11:32   ` Vladis Dronov
2018-10-03  5:25     ` David Miller
2018-10-03 13:25       ` Vladis Dronov
2018-10-03 16:37         ` David Miller
2018-10-04  9:53         ` Kalle Valo

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=20180929.114023.1370133506922372520.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=syzkaller@googlegroups.com \
    --cc=vdronov@redhat.com \
    --cc=yoshfuji@linux-ipv6.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).