diff options
author | peterz@infradead.org <peterz@infradead.org> | 2023-09-21 12:45:11 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2023-09-21 19:22:07 +0200 |
commit | 43adf844951084c266f172561f84c5f8120dd60b (patch) | |
tree | 6a506adc83de717d2c4bcaa2b3fdded724bba24f /kernel/futex/syscalls.c | |
parent | futex: Add sys_futex_wake() (diff) | |
download | linux-43adf844951084c266f172561f84c5f8120dd60b.tar.xz linux-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/syscalls.c')
-rw-r--r-- | kernel/futex/syscalls.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/futex/syscalls.c b/kernel/futex/syscalls.c index 7049a52ef68e..47398926765e 100644 --- a/kernel/futex/syscalls.c +++ b/kernel/futex/syscalls.c @@ -333,7 +333,7 @@ SYSCALL_DEFINE4(futex_wake, if (!futex_validate_input(flags, mask)) return -EINVAL; - return futex_wake(uaddr, flags, nr, mask); + return futex_wake(uaddr, FLAGS_STRICT | flags, nr, mask); } #ifdef CONFIG_COMPAT |