public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], [email protected], [email protected],
	Jens Axboe <[email protected]>
Subject: [PATCH 02/12] futex: Extend the FUTEX2 flags
Date: Fri, 28 Jul 2023 10:42:25 -0600	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

From: Peter Zijlstra <[email protected]>

Add the definition for the missing but always intended extra sizes,
and add a NUMA flag for the planned numa extention.

Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
---
 include/uapi/linux/futex.h | 7 ++++---
 kernel/futex/syscalls.c    | 9 +++++++--
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/include/uapi/linux/futex.h b/include/uapi/linux/futex.h
index 0c5abb6aa8f8..0ed021acc1d9 100644
--- a/include/uapi/linux/futex.h
+++ b/include/uapi/linux/futex.h
@@ -46,10 +46,11 @@
 /*
  * Flags for futex2 syscalls.
  */
-			/*	0x00 */
-			/*	0x01 */
+#define FUTEX2_8		0x00
+#define FUTEX2_16		0x01
 #define FUTEX2_32		0x02
-			/*	0x04 */
+#define FUTEX2_64		0x03
+#define FUTEX2_NUMA		0x04
 			/*	0x08 */
 			/*	0x10 */
 			/*	0x20 */
diff --git a/kernel/futex/syscalls.c b/kernel/futex/syscalls.c
index 42b6c2fac7db..cfc8001e88ea 100644
--- a/kernel/futex/syscalls.c
+++ b/kernel/futex/syscalls.c
@@ -183,7 +183,7 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
 	return do_futex(uaddr, op, val, tp, uaddr2, (unsigned long)utime, val3);
 }
 
-#define FUTEX2_MASK (FUTEX2_32 | FUTEX2_PRIVATE)
+#define FUTEX2_MASK (FUTEX2_64 | FUTEX2_PRIVATE)
 
 /**
  * futex_parse_waitv - Parse a waitv array from userspace
@@ -207,7 +207,12 @@ static int futex_parse_waitv(struct futex_vector *futexv,
 		if ((aux.flags & ~FUTEX2_MASK) || aux.__reserved)
 			return -EINVAL;
 
-		if (!(aux.flags & FUTEX2_32))
+		if (!IS_ENABLED(CONFIG_64BIT) || in_compat_syscall()) {
+			if ((aux.flags & FUTEX2_64) == FUTEX2_64)
+				return -EINVAL;
+		}
+
+		if ((aux.flags & FUTEX2_64) != FUTEX2_32)
 			return -EINVAL;
 
 		futexv[i].w.flags = aux.flags;
-- 
2.40.1


  parent reply	other threads:[~2023-07-28 16:42 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-28 16:42 [PATCHSET v4] Add io_uring futex/futexv support Jens Axboe
2023-07-28 16:42 ` [PATCH 01/12] futex: Clarify FUTEX2 flags Jens Axboe
2023-07-28 16:42 ` Jens Axboe [this message]
2023-07-28 16:42 ` [PATCH 03/12] futex: Flag conversion Jens Axboe
2023-08-09 18:04   ` Gabriel Krisman Bertazi
2023-07-28 16:42 ` [PATCH 04/12] futex: Validate futex value against futex size Jens Axboe
2023-07-28 16:42 ` [PATCH 05/12] futex: move FUTEX2_MASK to futex.h Jens Axboe
2023-07-28 16:42 ` [PATCH 06/12] futex: factor out the futex wake handling Jens Axboe
2023-07-28 16:42 ` [PATCH 07/12] futex: abstract out a __futex_wake_mark() helper Jens Axboe
2023-07-28 16:42 ` [PATCH 08/12] io_uring: add support for futex wake and wait Jens Axboe
2023-07-28 16:42 ` [PATCH 09/12] futex: add wake_data to struct futex_q Jens Axboe
2023-07-28 16:42 ` [PATCH 10/12] futex: make futex_parse_waitv() available as a helper Jens Axboe
2023-07-28 16:42 ` [PATCH 11/12] futex: make the vectored futex operations available Jens Axboe
2023-07-28 16:42 ` [PATCH 12/12] io_uring: add support for vectored futex waits Jens Axboe
2023-07-31 16:06 ` [PATCHSET v4] Add io_uring futex/futexv support Thomas Gleixner
2023-08-06 16:44   ` Jens Axboe
2023-08-07  1:23     ` Thomas Gleixner
2023-08-07 18:23       ` Jens Axboe
2023-08-15  0:12         ` Thomas Gleixner
2023-08-15  0:18           ` Jens Axboe
2023-08-15  0:47             ` Thomas Gleixner
2023-08-15  1:51               ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox