Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965687AbbLRVgx (ORCPT ); Fri, 18 Dec 2015 16:36:53 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:33568 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965398AbbLRVgm (ORCPT ); Fri, 18 Dec 2015 16:36:42 -0500 Date: Fri, 18 Dec 2015 13:36:37 -0800 From: Darren Hart To: Thomas Gleixner , Peter Zijlstra , Davidlohr Bueso , Michael Kerrisk Cc: Linux Kernel Mailing List Subject: [PATCH] futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op Message-ID: <9f3bdc116d79d23f5ee72ceb9a2a857f5ff8fa29.1450474525.git.dvhart@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1672 Lines: 48 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 Cc: Peter Zijlstra Cc: Davidlohr Bueso Reported-by: Michael Kerrisk Signed-off-by: Darren Hart --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/