All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Peter Zijlstra <peterz@infradead.org>
Cc: syzbot <syzbot+9afaf6749e3a7aa1bdf3@syzkaller.appspotmail.com>,
	andrealmeid@igalia.com, dave@stgolabs.net, dvhart@infradead.org,
	linux-kernel@vger.kernel.org, mingo@redhat.com,
	syzkaller-bugs@googlegroups.com, tglx@linutronix.de
Subject: Re: [syzbot] [kernel?] KASAN: wild-memory-access Read in get_futex_key
Date: Tue, 27 May 2025 17:31:06 +0200	[thread overview]
Message-ID: <20250527153106.WFmvR15N@linutronix.de> (raw)
In-Reply-To: <20250527142217.GA7747@noisy.programming.kicks-ass.net>

On 2025-05-27 16:22:17 [+0200], Peter Zijlstra wrote:
> >  get_futex_key+0x595/0x1540 kernel/futex/core.c:587
> 
> Does the this help?

it avoids boom but reject FUTEX_NO_NODE. What about

diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 19a2c65f3d373..d0f5645eac61c 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -583,8 +583,9 @@ int get_futex_key(u32 __user *uaddr, unsigned int flags, union futex_key *key,
 		if (futex_get_value(&node, naddr))
 			return -EFAULT;
 
-		if (node != FUTEX_NO_NODE &&
-		    (node >= MAX_NUMNODES || !node_possible(node)))
+		if ((node != FUTEX_NO_NODE) &&
+		    (node < 0 || node > nr_node_ids ||
+		     !node_possible(node)))
 			return -EINVAL;
 	}
 

Sebastian

  reply	other threads:[~2025-05-27 15:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-27 13:36 [syzbot] [kernel?] KASAN: wild-memory-access Read in get_futex_key syzbot
2025-05-27 14:22 ` Peter Zijlstra
2025-05-27 15:31   ` Sebastian Andrzej Siewior [this message]
2025-05-27 15:39     ` Sebastian Andrzej Siewior

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=20250527153106.WFmvR15N@linutronix.de \
    --to=bigeasy@linutronix.de \
    --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+9afaf6749e3a7aa1bdf3@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.