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>] [day] [month] [year] [list]
Date:	Wed, 2 Aug 2006 20:35:25 -0700
From:	Darren Hart <dvhltc@...ibm.com>
To:	lkml <linux-kernel@...r.kernel.org>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Steven Rostedt <rostedt@...dmis.org>,
	Ingo Molnar <mingo@...e.hu>,
	Esben Nielsen <nielsen.esben@...glemail.com>
Subject: [RFC, PATCH -rt] futex_atomic_cmpxchg_inatomic usage

While reviewing futex.c re Esben's rt_mutex_next_owner() serialization
posting, I had a question regarding the use of

futex_atomic_cmpxchg_inatomic()

In all but two places in futex.c we wrap that call with 
(inc|dec)_preempt_count() calls.  Nothing stood out to me that would
account for the difference.  Can some comment on why we don't have to
wrap the call in those two places (see patch for locations).  Just in 
case this happens to be a bug, I've included a patch to fix it.


Index: 2.6.17-rt8/kernel/futex.c
===================================================================
--- 2.6.17-rt8.orig/kernel/futex.c	2006-08-02 20:29:08.000000000 -0700
+++ 2.6.17-rt8/kernel/futex.c	2006-08-02 20:29:42.000000000 -0700
@@ -1303,8 +1303,10 @@
 		ret = get_user(uval, uaddr);
 		while (!ret) {
 			newval = (uval & FUTEX_OWNER_DIED) | newtid;
+			inc_preempt_count();
 			curval = futex_atomic_cmpxchg_inatomic(uaddr,
 							       uval, newval);
+			dec_preempt_count();
 			if (curval == -EFAULT)
 				ret = -EFAULT;
 			if (curval == uval)
@@ -1684,8 +1686,11 @@
 		 * thread-death.) The rest of the cleanup is done in
 		 * userspace.
 		 */
+		inc_preempt_count();
 		nval = futex_atomic_cmpxchg_inatomic(uaddr, uval,
 						     uval | FUTEX_OWNER_DIED);
+		dec_preempt_count();
+
 		if (nval == -EFAULT)
 			return -1;
-- 
Thanks,
 
Darren Hart
IBM Linux Technology Center
Realtime Linux Team
-
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