All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op
@ 2015-12-18 21:36 Darren Hart
  2015-12-19  0:49 ` Davidlohr Bueso
  2015-12-20 13:20 ` [tip:locking/core] " tip-bot for Darren Hart
  0 siblings, 2 replies; 3+ messages in thread
From: Darren Hart @ 2015-12-18 21:36 UTC (permalink / raw)
  To: Thomas Gleixner, Peter Zijlstra, Davidlohr Bueso, Michael Kerrisk
  Cc: Linux Kernel Mailing List

While reviewing Michael Kerrisk's recent futex manpage update, I noticed
that we allow the FUTEX_CLOCK_REALTIME flag for FUTEX_WAIT_BITSET but
not for FUTEX_WAIT.

FUTEX_WAIT is treated as a simple version for FUTEX_WAIT_BITSET
internally (with a bitmask of FUTEX_BITSET_MATCH_ANY). As such, I cannot
come up with a reason for this exclusion for FUTEX_WAIT.

This change does modify the behavior of the futex syscall, changing a
call with FUTEX_WAIT | FUTEX_CLOCK_REALTIME from returning -ENOSYS, to be
equivalent to FUTEX_WAIT_BITSET | FUTEX_CLOCK_REALTIME with a bitset of
FUTEX_BITSET_MATCH_ANY.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Reported-by: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
---
 kernel/futex.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 684d754..3c8c6d6 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -3046,7 +3046,8 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
 
 	if (op & FUTEX_CLOCK_REALTIME) {
 		flags |= FLAGS_CLOCKRT;
-		if (cmd != FUTEX_WAIT_BITSET && cmd != FUTEX_WAIT_REQUEUE_PI)
+		if (cmd != FUTEX_WAIT && cmd != FUTEX_WAIT_BITSET && \
+		    cmd != FUTEX_WAIT_REQUEUE_PI)
 			return -ENOSYS;
 	}
 
-- 
2.1.4


-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-20 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-18 21:36 [PATCH] futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op Darren Hart
2015-12-19  0:49 ` Davidlohr Bueso
2015-12-20 13:20 ` [tip:locking/core] " tip-bot for Darren Hart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.