summaryrefslogtreecommitdiffstats
path: root/kernel/futex/futex.h
diff options
context:
space:
mode:
authorpeterz@infradead.org <peterz@infradead.org>2023-09-21 12:45:11 +0200
committerPeter Zijlstra <peterz@infradead.org>2023-09-21 19:22:07 +0200
commit43adf844951084c266f172561f84c5f8120dd60b (patch)
tree6a506adc83de717d2c4bcaa2b3fdded724bba24f /kernel/futex/futex.h
parent9f6c532f59b20580acf8ede9409c9b8dce6e74e1 (diff)
downloadlinux-stable-43adf844951084c266f172561f84c5f8120dd60b.tar.gz
linux-stable-43adf844951084c266f172561f84c5f8120dd60b.tar.bz2
linux-stable-43adf844951084c266f172561f84c5f8120dd60b.zip
futex: FLAGS_STRICT
The current semantics for futex_wake() are a bit loose, specifically asking for 0 futexes to be woken actually gets you 1. Adding a !nr check to sys_futex_wake() makes that it would return 0 for unaligned futex words, because that check comes in the shared futex_wake() function. Adding the !nr check there, would affect the legacy sys_futex() semantics. Hence frob a flag :-( Suggested-by: André Almeida <andrealmeid@igalia.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20230921105248.048643656@noisy.programming.kicks-ass.net
Diffstat (limited to 'kernel/futex/futex.h')
-rw-r--r--kernel/futex/futex.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/kernel/futex/futex.h b/kernel/futex/futex.h
index a3f1fceafcbe..0e7821a944a2 100644
--- a/kernel/futex/futex.h
+++ b/kernel/futex/futex.h
@@ -17,25 +17,26 @@
* Futex flags used to encode options to functions and preserve them across
* restarts.
*/
-#define FLAGS_SIZE_8 0x00
-#define FLAGS_SIZE_16 0x01
-#define FLAGS_SIZE_32 0x02
-#define FLAGS_SIZE_64 0x03
+#define FLAGS_SIZE_8 0x0000
+#define FLAGS_SIZE_16 0x0001
+#define FLAGS_SIZE_32 0x0002
+#define FLAGS_SIZE_64 0x0003
-#define FLAGS_SIZE_MASK 0x03
+#define FLAGS_SIZE_MASK 0x0003
#ifdef CONFIG_MMU
-# define FLAGS_SHARED 0x10
+# define FLAGS_SHARED 0x0010
#else
/*
* NOMMU does not have per process address space. Let the compiler optimize
* code away.
*/
-# define FLAGS_SHARED 0x00
+# define FLAGS_SHARED 0x0000
#endif
-#define FLAGS_CLOCKRT 0x20
-#define FLAGS_HAS_TIMEOUT 0x40
-#define FLAGS_NUMA 0x80
+#define FLAGS_CLOCKRT 0x0020
+#define FLAGS_HAS_TIMEOUT 0x0040
+#define FLAGS_NUMA 0x0080
+#define FLAGS_STRICT 0x0100
/* FUTEX_ to FLAGS_ */
static inline unsigned int futex_to_flags(unsigned int op)