From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796075980; b=uf9i8DYOw7enMpTDPaLW/qIxyNrvkFOcEPt5ma+THMqmyknHVNUIuozrzHihT3Vt0llg fsQIB9bObBbY0ErbGPwRqT/WhmnYsm9WGYqrqxHlGvkAJPvSssE9viYVGCc7+aIKsUXWf 7CDwqdhT2vNDOEYa+1+2gOPUKuLrTlgj/6wpQL+jUjkMFSUP/QNac6YNly96Jb5apFS+9 bdJ2UUlUvmnvgPptZAVn06MI6GJYxmJcJZDOnLqlfRQDlO+Xp9Sqh1LCcSG2wXPbOecgx AT9UokwitB0M1K4uUJO7usf+yJzqhWUBh5eoCgyg4Z/SJCwioty3yzHQcJW7bt3Q0oQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796075980; h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References: Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=WA3yv7sXo16Pio8pJOpGOquNv6+h8IDpyU9SU29/PfM=; b=lHcqWW07FCFhgoMRoYp+z+utOFmXs7/mTaN+xkFGVoxBmGBOS9b7/HSGGGRJPo7pzauW X7b2th8VtzXtk8vPzuxHslHtCTKPTBH39r/VgQHkg1uqvhmjFUCgAMb54KM4NrDeivgBY LCGrjlkqrHk1x1vA6Sn+uGAf8kWhMe8lKzYERHQVc4CD7hi8oFsIp4WY6JDpZDHyhXWqx JQ300yRgI0l0JdiHW/NdAWe0/Mf3CLuyDs7OkA5v8xLg9u7LxsfaMZemipA6N5hVfz8E+ nTL508hbjyU95Fb7up1xZszeuLxTrIHhLU8qWPoNeF2S0dkXC00AWMJEvwLt4Fv7LfA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ARPQM268; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E48F606A31A for ; Mon, 30 Nov 2026 21:59:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ARPQM268 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB22F1F00897; Mon, 30 Nov 2026 21:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796075979; bh=WA3yv7sXo16Pio8pJOpGOquNv6+h8IDpyU9SU29/PfM=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=ARPQM26893kpI/4YfVCU6qYtufVMg037l3OUONxZhZXvsrO+yJ2V73iRPthULsIto a361ugjNxEGl+Bb0Cjtop2akngAr+L4EzsbXxTBhGYSzsZok5PpTpI/AvoKuJbu3KV TnXiUJ4fak2LX5kcymnCPLhRaVH71nD36Q5fS68iNbyAYRPvwhxMJsce+t8/8EwyY0 l95c61BxJRbYYYI8DCELwRIYvJ6ua9SSzJpsMFsTnZ438Dt9Gp6RXchOep4G7DJ+8s T8X5vd+5RQTCsgYKS05C9OBFzGJRVJtpwcc8RJW94yD4ld5o4Ant4Gy/fcm/lBCavS 5xgSX1HH8/nrw== From: Thomas Gleixner To: =?utf-8?Q?Andr=C3=A9?= Almeida , Bradley Morgan Cc: Darren Hart , Peter Zijlstra , Davidlohr Bueso , linux-kernel@vger.kernel.org, Ingo Molnar Subject: Re: [PATCH 2/3] futex: reject the unused PR_FUTEX_HASH arguments In-Reply-To: References: <20261105003129.3130709-1-brads@mainlining.org> <20261105003129.3130709-3-brads@mainlining.org> Date: Mon, 30 Nov 2026 22:59:36 +0100 Message-ID: <875wxeq8tz.ffs@fw13> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, Nov 09 2026 at 18:32, Andr=C3=A9 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 =3D posixtimer_create_prctl(arg2); >> break; >> case PR_FUTEX_HASH: >> - error =3D futex_hash_prctl(arg2, arg3, arg4); >> + error =3D futex_hash_prctl(arg2, arg3, arg4, arg5); >> break; > > By reading kernel/sys.c, it seems like most of PR_ options check for=20 > (arg4 || arg5) here, not inside of the function. Any reason why you=20 > 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