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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1317735440.32543.4.camel@twins>
Date:	Tue, 04 Oct 2011 15:37:20 +0200
From:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
To:	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>
Cc:	"Rafael J. Wysocki" <rjw@...k.pl>, pavel@....cz,
	len.brown@...el.com, mingo@...e.hu, akpm@...ux-foundation.org,
	suresh.b.siddha@...el.com, lucas.demarchi@...fusion.mobi,
	linux-pm@...ts.linux-foundation.org, rusty@...tcorp.com.au,
	vatsa@...ux.vnet.ibm.com, ashok.raj@...el.com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] CPU hotplug, freezer: Fix bugs in CPU hotplug call
 path

On Tue, 2011-10-04 at 18:58 +0530, Srivatsa S. Bhat wrote:
> +static int tasks_frozen;
> +
> +void set_tasks_frozen_flag(void)
> +{
> +       tasks_frozen = 1;
> +       smp_mb();
> +}
> +
> +void clear_tasks_frozen_flag(void)
> +{
> +       tasks_frozen = 0;
> +       smp_mb();
> +}
> +
> +int tasks_are_frozen(void)
> +{
> +       return tasks_frozen;
> +} 

See Documentation/memory-barriers.txt, memory barriers always come in
pairs, furthermore memory barriers always should have a comment
explaining the ordering and referring to the pair match.

I think you want at least an smp_rmb() before reading tasks_frozen,
possible you also want to use ACCESS_ONCE() to force the compiler to
emit the read.

Furthermore, do you really need this? isn't it both set and read from
the same task context, all under pm_mutex?
--
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