From: Thomas Gleixner <tglx@kernel.org>
To: "André Almeida" <andrealmeid@igalia.com>,
"Bradley Morgan" <brads@mainlining.org>
Cc: Darren Hart <dvhart@infradead.org>,
Peter Zijlstra <peterz@infradead.org>,
Davidlohr Bueso <dave@stgolabs.net>,
linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH 2/3] futex: reject the unused PR_FUTEX_HASH arguments
Date: Mon, 30 Nov 2026 22:59:36 +0100 [thread overview]
Message-ID: <875wxeq8tz.ffs@fw13> (raw)
In-Reply-To: <c9077b39-b7d9-45c7-968a-6bd1b3ab5572@igalia.com>
On Mon, Nov 09 2026 at 18:32, André Almeida wrote:
>> diff --git a/kernel/sys.c b/kernel/sys.c
>> index 755bfa5ccd92c..c4839c986f5e0 100644
>> --- a/kernel/sys.c
>> +++ b/kernel/sys.c
>> @@ -2885,7 +2885,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
>> error = posixtimer_create_prctl(arg2);
>> break;
>> case PR_FUTEX_HASH:
>> - error = futex_hash_prctl(arg2, arg3, arg4);
>> + error = futex_hash_prctl(arg2, arg3, arg4, arg5);
>> break;
>
> By reading kernel/sys.c, it seems like most of PR_ options check for
> (arg4 || arg5) here, not inside of the function. Any reason why you
> didn't follow the current pattern?
Well, the two prctls have different number of used arguments.
But all of this is moot because that's a user visible change, which will
result in regressions.
So far the prctl() accepts random values for arg3/arg4/arg5 with GET and
for arg5 with SET.
Which means if there is user space handing in crap it will fail
after this hits the tree as the updates to the selftests show.
The man pages even document that the extra arguments are not required to
be cleared:
int prctl(PR_FUTEX_HASH, PR_FUTEX_HASH_GET_SLOTS);
int prctl(PR_FUTEX_HASH, PR_FUTEX_HASH_SET_SLOTS, flags);
I agree that glibc's implementation of prctl() which reads
unconditionally all five arguments is actually undefined behavior, but
that's a different tree to bark up.
This ship has sailed when the futex hash prctl() was merged and we are
not going to apply this because a revert due to regressions is pretty
much guaranteed.
That obviously means that the unchecked arguments cannot be used to
extend the existing GET/SET subfunctions, but that's fine.
Thanks,
tglx
next prev parent reply other threads:[~2026-11-30 21:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 0:31 [PATCH 0/3] two small fixes out of kernel/sys.c Bradley Morgan
2026-11-05 0:31 ` [PATCH 1/3] tools: pass the unused prctl() args explicitly for PR_FUTEX_HASH Bradley Morgan
2026-11-05 0:31 ` [PATCH 2/3] futex: reject the unused PR_FUTEX_HASH arguments Bradley Morgan
2026-11-09 21:32 ` André Almeida
2026-11-30 21:59 ` Thomas Gleixner [this message]
2026-11-05 0:31 ` [PATCH 3/3] compat: make compat_sysinfo() scale far enough to actually fit Bradley Morgan
2026-11-05 7:25 ` Arnd Bergmann
2026-11-05 16:47 ` Bradley Morgan
2026-11-05 16:52 ` Arnd Bergmann
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=875wxeq8tz.ffs@fw13 \
--to=tglx@kernel.org \
--cc=andrealmeid@igalia.com \
--cc=brads@mainlining.org \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/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®