Thread (60 messages) 60 messages, 8 authors, 2024-10-28

Re: [PATCH v1 02/14] futex: Extend the FUTEX2 flags

From: "Arnd Bergmann" <arnd@arndb.de>
Date: 2023-07-21 15:48:04
Also in: linux-arch, linux-mm, lkml

On Fri, Jul 21, 2023, at 12:22, Peter Zijlstra wrote:
quoted hunk ↗ jump to hunk
  * futex_parse_waitv - Parse a waitv array from userspace
@@ -207,7 +207,12 @@ static int futex_parse_waitv(struct fute
 		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;
This looks slightly confusing, how about defining another
FUTEX2_SIZEMASK (or similar) macro to clarify that
"aux.flags & FUTEX2_64" is a mask operation that can
match the FUTEX2_{8,16,32,64} values?

       Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help