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:	Thu, 7 Jun 2007 22:48:10 +0530
From:	"Satyam Sharma" <satyam.sharma@...il.com>
To:	"Heiko Carstens" <heiko.carstens@...ibm.com>
Cc:	"Jan Glauber" <jan.glauber@...ibm.com>,
	"David Miller" <davem@...emloft.net>, akpm@...l.org, mingo@...e.hu,
	ak@...e.de, schwidefsky@...ibm.com, linux-kernel@...r.kernel.org,
	"Alan Cox" <alan@...hat.com>, "Avi Kivity" <avi@...ranet.com>
Subject: Re: [patch] i386/x86_64: smp_call_function locking inconsistency

> On 6/7/07, Heiko Carstens <heiko.carstens@...ibm.com> wrote:
> [...]
> > Avi Kivity has already a patch which introduces an on_cpu() function which
> > looks quite like on_each_cpu(). That way you don't have to open code this
> > stuff over and over again:
> >
> > preempt_disable();
> > if (cpu == smp_processor_id())
> >         func();
> > else
> >         smp_call_function_single(...);
> > preempt_enable();
> >
> > There are already quite a few of these around.
>
> Indeed -- this was doubly problematic because the un-safeness
> was because of smp_processor_id() as well as the (eventual)
> access of cpu_online_map (via smp_call_function() ->
> num_online_cpus()) ... thanks for letting me know about this.

Oh wait, the on_one_cpu() patch proposes on UP:

+static inline int on_one_cpu(int cpu, void (*func)(void *info), void *info,
+			     int retry, int wait)
+{

/* this needs a if (cpu == 0) check here, IMO */

+	local_irq_disable();
+	func(info);
+	local_irq_enable();
+	return 0;

/* else WARN and return -EINVAL; */

+}

which is broken without the suggested additions, IMHO
(this is what got me into this in the first place). There
_is_ a difference between on_each_cpu() and the
smp_call_function* semantics (as discussed on the other
thread -- gargh! my mistake for opening this discussion up
on so many threads), and in its current form on_one_cpu()
has quite confused semantics, trying to mix the two. I guess
on_one_cpu() would be better off simply being just an
atomic wrapper over smp_processor_id() and
smp_call_function_single() (which is the *real* issue that
needs solving in the first place), and do it well.

Satyam
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ