Re: [syzbot] [kernel?] KASAN: slab-out-of-bounds Read in __futex_pivot_hash

From: Edward Adam Davis
Date: Sun Jun 01 2025 - 23:25:32 EST


#syz test

diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 19a2c65f3d37..ea6b8266efb9 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1754,7 +1754,10 @@ int futex_hash_prctl(unsigned long arg2, unsigned long arg3, unsigned long arg4)
return -EINVAL;
if (arg4 & FH_FLAG_IMMUTABLE)
flags |= FH_IMMUTABLE;
+ static DEFINE_MUTEX(fha_syn);
+ mutex_lock(&fha_syn);
ret = futex_hash_allocate(arg3, flags);
+ mutex_unlock(&fha_syn);
break;

case PR_FUTEX_HASH_GET_SLOTS: