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]
Message-ID: <YzUMrAgm5eieW1hS@Laptop-X1>
Date:   Thu, 29 Sep 2022 11:10:36 +0800
From:   Hangbin Liu <liuhangbin@...il.com>
To:     Guillaume Nault <gnault@...hat.com>
Cc:     Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Paolo Abeni <pabeni@...hat.com>,
        Ido Schimmel <idosch@...dia.com>,
        Petr Machata <petrm@...dia.com>,
        Florent Fourcot <florent.fourcot@...irst.fr>,
        Nikolay Aleksandrov <razor@...ckwall.org>,
        Nicolas Dichtel <nicolas.dichtel@...nd.com>,
        David Ahern <dsahern@...nel.org>
Subject: Re: [PATCHv3 net-next] rtnetlink: Honour NLM_F_ECHO flag in
 rtnl_{new, set, del}link

On Wed, Sep 28, 2022 at 11:47:57AM +0200, Guillaume Nault wrote:
> On Wed, Sep 28, 2022 at 10:39:49AM +0800, Hangbin Liu wrote:
> > On Tue, Sep 27, 2022 at 07:21:30AM -0700, Jakub Kicinski wrote:
> > > On Tue, 27 Sep 2022 12:13:03 +0800 Hangbin Liu wrote:
> > > > @@ -3382,6 +3401,12 @@ static int rtnl_newlink_create(struct sk_buff *skb, struct ifinfomsg *ifm,
> > > >  		if (err)
> > > >  			goto out_unregister;
> > > >  	}
> > > > +
> > > > +	nskb = rtmsg_ifinfo_build_skb(RTM_NEWLINK, dev, 0, 0, GFP_KERNEL, NULL,
> > > > +				      0, pid, nlh->nlmsg_seq);
> > > > +	if (nskb)
> > > > +		rtnl_notify(nskb, dev_net(dev), pid, RTNLGRP_LINK, nlh, GFP_KERNEL);
> > > > +
> > > >  out:
> > > >  	if (link_net)
> > > >  		put_net(link_net);
> > > 
> > > I'm surprised you're adding new notifications. Does the kernel not
> > > already notify about new links? I thought rtnl_newlink_create() ->
> > > rtnl_configure_link() -> __dev_notify_flags() sends a notification,
> > > already.
> > 
> > I think __dev_notify_flags() only sends notification when dev flag changed.
> > On the other hand, the notification is sent via multicast, while this patch
> > is intend to unicast the notification to the user space.
> 
> In rntl_configure_link(), dev->rtnl_link_state is RTNL_LINK_INITIALIZING
> on device cretation, so __dev_notify_flags() is called with gchanges=~0
> and notification should be always sent. It's just a matter of passing the
> portid and the nlmsghdr down the call chain to make rtnl_notify() send
> the unicast message together with the multicast ones.

To update __dev_notify_flags() with nlmsghdr, we also need to update
rtnl_configure_link(), which is called by some drivers.

> 
> Now for device modification, I'm not sure there's a use case for
> unicast notifications. The caller already knows which values it asked
> to modify, so ECHO doesn't bring much value compared to a simple ACK.

And the __dev_notify_flags() is only used when the dev flag changed.

It looks no much change if we call it when create new link:
rtnl_newlink_create() -> rtnl_configure_link() -> __dev_notify_flags()

But when set link, it is only called when flag changed
do_setlink() -> dev_change_flags() -> __dev_notify_flags().

Unless you want to omit the ECHO message when setting link.

At latest, when call rtnl_delete_link(), there is no way to call
__dev_notify_flags(). So we still need to use the current way.

As a summarize, we need to change a lot of code if we use __dev_notify_flags()
to notify user, while we can only use it in one place. This looks not worth.

WDYT?

Thanks
Hangbin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ