From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+0a5079ee014f4b907817@syzkaller.appspotmail.com
Cc: andrealmeid@igalia.com, dave@stgolabs.net, dvhart@infradead.org,
linux-kernel@vger.kernel.org, mingo@redhat.com,
peterz@infradead.org, syzkaller-bugs@googlegroups.com,
tglx@linutronix.de
Subject: [PATCH] futex: sync set the hash table slot
Date: Mon, 2 Jun 2025 12:37:09 +0800 [thread overview]
Message-ID: <tencent_6B2EF84C8DE7C286F312E5C64889B9EEE806@qq.com> (raw)
In-Reply-To: <683ca389.a00a0220.d8eae.0035.GAE@google.com>
Prevent different processes from setting the hash table at the same
time to avoid hash table damage.
Reported-by: syzbot+0a5079ee014f4b907817@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=0a5079ee014f4b907817
Tested-by: syzbot+0a5079ee014f4b907817@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.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
prev parent reply other threads:[~2025-06-02 4:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-01 19:01 [syzbot] [kernel?] KASAN: slab-out-of-bounds Read in __futex_pivot_hash syzbot
2025-06-02 2:59 ` Edward Adam Davis
2025-06-02 3:15 ` syzbot
2025-06-02 3:19 ` Edward Adam Davis
2025-06-02 3:40 ` syzbot
2025-06-02 4:37 ` Edward Adam Davis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_6B2EF84C8DE7C286F312E5C64889B9EEE806@qq.com \
--to=eadavis@qq.com \
--cc=andrealmeid@igalia.com \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=syzbot+0a5079ee014f4b907817@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®