selftests/bpf: fix bpf_loop_bench for new callback verification scheme
[platform/kernel/linux-starfive.git] / kernel / futex / core.c
index f10587d..f30a93e 100644 (file)
@@ -248,7 +248,17 @@ int get_futex_key(u32 __user *uaddr, bool fshared, union futex_key *key,
         *        but access_ok() should be faster than find_vma()
         */
        if (!fshared) {
-               key->private.mm = mm;
+               /*
+                * On no-MMU, shared futexes are treated as private, therefore
+                * we must not include the current process in the key. Since
+                * there is only one address space, the address is a unique key
+                * on its own.
+                */
+               if (IS_ENABLED(CONFIG_MMU))
+                       key->private.mm = mm;
+               else
+                       key->private.mm = NULL;
+
                key->private.address = address;
                return 0;
        }