netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail.net>
To: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net 08/12] ipv6: advertise IFLA_LINK_NETNSID when dumping ipv6 addresses
Date: Fri, 2 Oct 2020 11:03:23 +0200	[thread overview]
Message-ID: <20201002090323.GC3565727@bistromath.localdomain> (raw)
In-Reply-To: <40925424-06ff-c0c5-0456-c7a9d58dff91@6wind.com>

2020-10-01, 17:58:40 +0200, Nicolas Dichtel wrote:
> Le 01/10/2020 à 09:59, Sabrina Dubroca a écrit :
> > Currently, we're not advertising link-netnsid when dumping IPv6
> > addresses, so the "ip -6 addr" command will not correctly interpret
> > the value of the IFLA_LINK attribute.
> > 
> > For example, we'll get:
> >     9: macvlan0@macvlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
> >         <snip>
> > 
> > Instead of:
> >     9: macvlan0@if9: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000 link-netns main
> >         <snip>
> > 
> > ndisc_ifinfo_sysctl_change calls inet6_fill_ifinfo without rcu or
> > rtnl, so I'm adding rcu_read_lock around rtnl_fill_link_netnsid.
> I don't think this is needed.
> ndisc_ifinfo_sysctl_change() takes a reference on the idev (with in6_dev_get(dev)).

The problem is veth's get_link_net implementation, even after my change in patch 6:

    static struct net *veth_get_link_net(const struct net_device *dev)
    {
    	struct veth_priv *priv = netdev_priv(dev);
    	struct net_device *peer = rcu_dereference_rtnl(priv->peer);
    
    	return peer ? dev_net(peer) : dev_net(dev);
    }


These commands:

    ip link add type veth
    sysctl net.ipv6.neigh.veth0.retrans_time_ms=2000

cause this splat:

[   91.426764] =============================
[   91.427445] WARNING: suspicious RCU usage
[   91.428129] 5.9.0-rc6-net-00331-gae48bef8808b-dirty #266 Not tainted
[   91.429209] -----------------------------
[   91.433898] drivers/net/veth.c:1436 suspicious rcu_dereference_check() usage!
[   91.435127] 
               other info that might help us debug this:

[   91.436515] 
               rcu_scheduler_active = 2, debug_locks = 1
[   91.437636] 1 lock held by sysctl/3718:
[   91.438310]  #0: ffff88806488c430 (sb_writers#5){.+.+}-{0:0}, at: vfs_write+0x2a7/0x350
[   91.439769] 
               stack backtrace:
[   91.440552] CPU: 2 PID: 3718 Comm: sysctl Not tainted 5.9.0-rc6-net-00331-gae48bef8808b-dirty #266
[   91.442132] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ArchLinux 1.14.0-1 04/01/2014
[   91.443742] Call Trace:
[   91.444204]  dump_stack+0x9a/0xd0
[   91.444810]  veth_get_link_net+0xa6/0xb0
[   91.445534]  rtnl_fill_link_netnsid+0xa2/0x130
[   91.446330]  ? rtnl_put_cacheinfo+0x190/0x190
[   91.447120]  ? memcpy+0x39/0x60
[   91.447717]  inet6_fill_ifinfo+0x2f7/0x480



I guess I could push the rcu_read_lock down into veth and vxcan's
handlers instead of the rcu_dereference_rtnl change in patch 6 and
adding this rcu_read_lock.

-- 
Sabrina


  reply	other threads:[~2020-10-02  9:03 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  7:59 [PATCH net 00/12] net: iflink and link-netnsid fixes Sabrina Dubroca
2020-10-01  7:59 ` [PATCH net 01/12] ipvlan: add get_link_net Sabrina Dubroca
2020-10-01  8:19   ` Eric Dumazet
2020-10-01  7:59 ` [PATCH net 02/12] geneve: " Sabrina Dubroca
2020-10-01  7:59 ` [PATCH net 03/12] Revert "rtnetlink: always put IFLA_LINK for links with a link-netnsid" Sabrina Dubroca
2020-10-01  7:59 ` [PATCH net 04/12] rtnetlink: always put IFLA_LINK for links with ndo_get_iflink Sabrina Dubroca
2020-10-01  7:59 ` [PATCH net 05/12] bridge: always put IFLA_LINK for ports " Sabrina Dubroca
2020-10-01  7:59 ` [PATCH net 06/12] bridge: advertise IFLA_LINK_NETNSID when dumping bridge ports Sabrina Dubroca
2020-10-01  7:59 ` [PATCH net 07/12] ipv6: always put IFLA_LINK for devices with ndo_get_iflink Sabrina Dubroca
2020-10-01  7:59 ` [PATCH net 08/12] ipv6: advertise IFLA_LINK_NETNSID when dumping ipv6 addresses Sabrina Dubroca
2020-10-01 15:58   ` Nicolas Dichtel
2020-10-02  9:03     ` Sabrina Dubroca [this message]
2020-10-05 15:16       ` Nicolas Dichtel
2020-10-01  7:59 ` [PATCH net 09/12] net: link_watch: fix operstate when the link has the same index as the device Sabrina Dubroca
2020-10-01 11:00   ` Taehee Yoo
2020-10-01  7:59 ` [PATCH net 10/12] net: link_watch: fix detection of urgent events Sabrina Dubroca
2020-10-01  7:59 ` [PATCH net 11/12] batman-adv: fix iflink detection in batadv_is_on_batman_iface Sabrina Dubroca
2022-05-14 10:21   ` Sven Eckelmann
2020-10-01  7:59 ` [PATCH net 12/12] batman-adv: fix detection of lower link in batadv_get_real_netdevice Sabrina Dubroca
2020-10-01 21:25 ` [PATCH net 00/12] net: iflink and link-netnsid fixes Stephen Hemminger
2020-10-02  9:07   ` Sabrina Dubroca

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=20201002090323.GC3565727@bistromath.localdomain \
    --to=sd@queasysnail.net \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    /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).