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:   Tue, 8 Sep 2020 09:25:40 -0600
From:   David Ahern <dsahern@...il.com>
To:     Ido Schimmel <idosch@...sch.org>, netdev@...r.kernel.org
Cc:     davem@...emloft.net, kuba@...nel.org, roopa@...dia.com,
        mlxsw@...dia.com, Ido Schimmel <idosch@...dia.com>
Subject: Re: [RFC PATCH net-next 13/22] nexthop: Emit a notification when a
 single nexthop is replaced

On 9/8/20 3:10 AM, Ido Schimmel wrote:
> From: Ido Schimmel <idosch@...dia.com>
> 
> The notification is emitted after all the validation checks were
> performed, but before the new configuration (i.e., 'struct nh_info') is
> pointed at by the old shell (i.e., 'struct nexthop'). This prevents the
> need to perform rollback in case the notification is vetoed.
> 
> The next patch will also emit a replace notification for all the nexthop
> groups in which the nexthop is used.
> 
> Signed-off-by: Ido Schimmel <idosch@...dia.com>
> ---
>  net/ipv4/nexthop.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
> index a60a519a5462..b8a4abc00146 100644
> --- a/net/ipv4/nexthop.c
> +++ b/net/ipv4/nexthop.c
> @@ -1099,12 +1099,22 @@ static int replace_nexthop_single(struct net *net, struct nexthop *old,
>  				  struct netlink_ext_ack *extack)
>  {
>  	struct nh_info *oldi, *newi;
> +	int err;
>  
>  	if (new->is_group) {
>  		NL_SET_ERR_MSG(extack, "Can not replace a nexthop with a nexthop group.");
>  		return -EINVAL;
>  	}
>  
> +	err = call_nexthop_notifiers(net, NEXTHOP_EVENT_REPLACE, new, extack);
> +	if (err)
> +		return err;
> +
> +	/* Hardware flags were set on 'old' as 'new' is not in the red-black
> +	 * tree. Therefore, inherit the flags from 'old' to 'new'.
> +	 */
> +	new->nh_flags |= old->nh_flags & (RTNH_F_OFFLOAD | RTNH_F_TRAP);

Will that always be true? ie., has h/w seen 'new' and offloaded it yet?
vs the notifier telling hardware about the change, it does its thing and
sets the flags. But I guess that creates a race between the offload and
the new data being available.

> +
>  	oldi = rtnl_dereference(old->nh_info);
>  	newi = rtnl_dereference(new->nh_info);
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ