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-next>] [day] [month] [year] [list]
Message-ID: <87zk8fgsx9.fsf@devron.myhome.or.jp>
Date:	Thu, 07 Jun 2012 22:20:18 +0900
From:	OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To:	Ingo Molnar <mingo@...e.hu>, Masami Hiramatsu <mhiramat@...hat.com>
Cc:	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Steven Rostedt <rostedt@...dmis.org>
Subject: [PATCH] Use atomic_xchg() instead atomic_dec_and_test() for stop_machine


stop_machine_first is just to see if it is first one or not.  In this
usage, atomic_dec_and_test() makes value less than 0.

I think it is not desirable, because it only triggers
atomic_dec_and_test() less than 0 debug patch. (the patch tests result
of atomic_dec_and_test() is < 0)

So, this uses atomic_xchg() instead.

Signed-off-by: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
Acked-by: Steven Rostedt <rostedt@...dmis.org>
---

 arch/x86/kernel/alternative.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN arch/x86/kernel/alternative.c~stop_machine-use-atomic_xchg arch/x86/kernel/alternative.c
--- linux/arch/x86/kernel/alternative.c~stop_machine-use-atomic_xchg	2012-05-23 13:10:03.000000000 +0900
+++ linux-hirofumi/arch/x86/kernel/alternative.c	2012-05-23 13:10:03.000000000 +0900
@@ -664,7 +664,7 @@ static int __kprobes stop_machine_text_p
 	struct text_poke_param *p;
 	int i;
 
-	if (atomic_dec_and_test(&stop_machine_first)) {
+	if (atomic_xchg(&stop_machine_first, 0)) {
 		for (i = 0; i < tpp->nparams; i++) {
 			p = &tpp->params[i];
 			text_poke(p->addr, p->opcode, p->len);
_
-- 
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
--
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