[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tencent_6B2EF84C8DE7C286F312E5C64889B9EEE806@qq.com>
Date: Mon, 2 Jun 2025 12:37:09 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+0a5079ee014f4b907817@...kaller.appspotmail.com
Cc: andrealmeid@...lia.com,
dave@...olabs.net,
dvhart@...radead.org,
linux-kernel@...r.kernel.org,
mingo@...hat.com,
peterz@...radead.org,
syzkaller-bugs@...glegroups.com,
tglx@...utronix.de
Subject: [PATCH] futex: sync set the hash table slot
Prevent different processes from setting the hash table at the same
time to avoid hash table damage.
Reported-by: syzbot+0a5079ee014f4b907817@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0a5079ee014f4b907817
Tested-by: syzbot+0a5079ee014f4b907817@...kaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
kernel/futex/core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 19a2c65f3d37..818dc082670f 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1754,7 +1754,12 @@ 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:
--
2.43.0
Powered by blists - more mailing lists