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: <20140306222441.GA17512@mtl-eit-vdi-22.mtl.labs.mlnx>
Date:	Fri, 7 Mar 2014 00:24:43 +0200
From:	Amir Vadai <amirv@...lanox.com>
To:	David Miller <davem@...emloft.net>
Cc:	netdev@...r.kernel.org, yevgenyp@...lanox.com,
	ogerlitz@...lanox.com, prarit@...hat.com, gvaradar@...co.com
Subject: Re: net: Utility function to get affinity_hint by policy

On 06/03/14 15:38 -0500, David Miller wrote:
> From: Amir Vadai <amirv@...lanox.com>
> Date: Thu,  6 Mar 2014 19:18:51 +0200
> 
> > +	rxq %= num_online_cpus();
> > +
> > +	p_numa_cores_mask = cpumask_of_node(numa_node);
> > +	if (!p_numa_cores_mask)
> > +		p_numa_cores_mask = cpu_online_mask;
> > +
> > +	for_each_cpu(affinity_cpu, p_numa_cores_mask) {
> > +		if (--rxq < 0)
> > +			goto out;
> > +	}
> > +
> > +	if (!zalloc_cpumask_var(&non_numa_cores_mask, GFP_KERNEL)) {
> > +		ret = -ENOMEM;
> > +		goto err;
> > +	}
> > +
> > +	cpumask_xor(non_numa_cores_mask, cpu_online_mask, p_numa_cores_mask);
> > +
> > +	for_each_cpu(affinity_cpu, non_numa_cores_mask) {
> > +		if (--rxq < 0)
> > +			goto out;
> > +	}
> > +
> > +	ret = -EINVAL;
> > +	goto err;
> 
> The NUMA core mask and the non-NUMA core mask must together provide
> at least num_online_cpus() bits.
> 
> Said another way, since rxq is limited to num_online_cpus() it should
> never exceed local + non-local cores.
> 
> Therefore this -EINVAL path seems like it should not be possible, and
> therefore perhaps a WARN_ON() or similar would be appropriate.

All these could be changed dynamically, and since there is no
protection on this block of code, it is possible that local + non-local
at point of time t1 will exceed num_online_cpus() at t2.
Since this is very rare and the fix for that is very complicated, I
decided not set affinity hint in this scenario, and only return an
error code.

Amir
--
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