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, 11 Mar 2014 10:53:09 +0100
From:	Michal Kubecek <mkubecek@...e.cz>
To:	David Miller <davem@...emloft.net>
Cc:	hannes@...essinduktion.org, netdev@...r.kernel.org,
	kuznet@....inr.ac.ru, jmorris@...ei.org, yoshfuji@...ux-ipv6.org,
	kaber@...sh.net
Subject: Re: [PATCH net] ipv6: do not overwrite inetpeer metrics prematurely

On Mon, Mar 10, 2014 at 10:38:41PM -0400, David Miller wrote:
> 
> Does this version address everyone's concerns?  Michal can you test it
> for me?

There is still a problem:

12sp0:~ # ip route add fec0::1 dev eth0 rto_min 1000
12sp0:~ # ip -6 route show
fe80::/64 dev eth0  proto kernel  metric 256 
fec0::1 dev eth0  metric 1024  rto_min lock 1s
12sp0:~ # ip route change fec0::1 dev eth0 hoplimit 10
12sp0:~ # ip -6 route show
fe80::/64 dev eth0  proto kernel  metric 256 
fec0::1 dev eth0  metric 1024  hoplimit 10 rto_min lock 1s

IMHO this comes from the was_writable test in fib_commit_metrics():

> +static int fib_commit_metrics(struct dst_entry *dst, struct nlattr *mx, int mx_len)
> +{
> +	struct nlattr *nla;
> +	bool was_writable;
> +	int remaining;
> +	u32 *mp;
> +
> +	was_writable = !dst_metrics_read_only(dst);
> +	mp = dst_metrics_write_ptr(dst);
> +
> +	if (was_writable)
> +		memset(mp, 0, RTAX_MAX * sizeof(u32));
> +
> +	nla_for_each_attr(nla, mx, mx_len, remaining) {
> +		int type = nla_type(nla);
> +
> +		if (type) {
> +			if (type > RTAX_MAX)
> +				return -EINVAL;
> +
> +			mp[type - 1] = nla_get_u32(nla);
> +		}
> +	}
> +	return 0;
> +}

For DST_HOST, was_writable is always false as at this point,
dst->_metrics still points to the shared default. I believe what we want
to know is whether the _original_ dst_entry (the one we are replacing,
if any) has writable metrics. Because if it has, we are reusing them, if
not, we get new ones. For non-DST_HOST routes, we can always skip the
memset() as we never share (writeable) metrics between old and new in
the non-DST_HOST case.

I also believe the function should return immediately if mx is null so
that we don't call dst_metrics_write_ptr() if no metrics are to be set
for the new route.

I'll test these changes and send an updated patch if I find no problem
with it.

                                                         Michal Kubecek

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ