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:	Fri, 22 May 2009 00:41:27 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	Joe Perches <joe@...ches.com>
Cc:	Randy Dunlap <randy.dunlap@...cle.com>,
	linux-kernel@...r.kernel.org, cpufreq@...r.kernel.org,
	Dave Jones <davej@...hat.com>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
	x86@...r.kernel.org, Len Brown <len.brown@...el.com>,
	Mike Travis <travis@....com>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Thomas Gleixner <tglx@...utronix.de>,
	Venkatesh Pallipadi <venkatesh.pallipadi@...el.com>
Subject: Re: [PATCH 1/3] kernel.h: Add DO_ONCE statement expression macro

> Add a DO_ONCE statement expression analogous to printk_once
> that executes any arbitrary statement exactly once.

Your implementation is racy. Its also hiding stuff in macro magic which
is asking for accidents to happen.

The natural kernel way to write this is

	if (!test_and_set_bit(....))

which is a lot more obvious than a magic macro, doesn't race and can use
other bits in an existing set of flags and be used as a
"do-once-for-this-object-instance" - which is almost always want you want.

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