From nobody Thu Apr 9 07:18:07 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91511430B91 for ; Tue, 10 Mar 2026 10:00:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773136806; cv=none; b=fgeTSArv1PsaQtdNGmQAwN9bF8e2AcDtFRRaNNYfARk1Tx12SaZBmA89ypABoARPD84VaFCo8IeiVQwZs8jCdDV5o8/Zd04e9DysVRJWhjRbRxl4PFthkIwSHdfwJ2cCeZ1ChcKzRXFuaP6PRTfZPgv3HTz7Bd/k2HqmkesSDZo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773136806; c=relaxed/simple; bh=Z3g1N6sf3bDlp1zF2VqM+eQ/mXEmXlRJzqFQA/N5JFo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=noWF8ydAqGPawevOhGP8Ta8KS11oaIAxunh9Aa2pmKS0wFMCU56q6Jnfs0hKgI5tMibkisk/dgAS+4LhS412mlEUyI/UfFFMLtejS8YvXUSIIm6QesekPXZ1MBgrTPnm1o1hJ23ygT/o6jI95ZGt8FXtj/C/dOiiBdsdXkh0Nw4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bB+A3wnb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bB+A3wnb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 086E4C19423; Tue, 10 Mar 2026 10:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773136806; bh=Z3g1N6sf3bDlp1zF2VqM+eQ/mXEmXlRJzqFQA/N5JFo=; h=From:To:Cc:Subject:Date:From; b=bB+A3wnbkljvfrg1H7+WpSiY7l1aBNaRqCwoqCgac/vjvTuYjrhEGuNGIiupOWHAM VA0cUl/Zl1f00R+rGL4+zHLVoZSgpmOO3qlImKrcxy5RdUuoJoTmp57cIcUWUvzuHE mGBz5WPmyfxF/24G3fuEbfynMes23JPQDIZERju0cQawckI+sUavP+Y4C3w5IDbzEB U8riW3sDoqC4V1aezoyFl8ZOqwKVaY4XXQcq08oCIBYXWYTprAgHUBsW2uNKU8ChCx DgZAgk0i1VbxafqGy3Yq7yTp36kFyNnt+3MkjUBLq+koFFJaRfIpa7i0HaVSj58KNu 2neSizNGNV4ow== From: "Christophe Leroy (CS GROUP)" To: Michael Ellerman , Nicholas Piggin , Madhavan Srinivasan Cc: "Christophe Leroy (CS GROUP)" , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] powerpc/futex: Use masked user access Date: Tue, 10 Mar 2026 10:59:58 +0100 Message-ID: X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1157; i=chleroy@kernel.org; h=from:subject:message-id; bh=Z3g1N6sf3bDlp1zF2VqM+eQ/mXEmXlRJzqFQA/N5JFo=; b=owGbwMvMwCV2d0KB2p7V54MZT6slMWSufz1f++0q7auiRYlPc3ctavfeverV+b3bnzXN+htl4 Vp85uGrbx2lLAxiXAyyYoosx/9z75rR9SU1f+oufZg5rEwgQxi4OAVgItpJDP9jmi55zA/jY+nt 2xin/uMVR/F9hh3TkgJLnpS3hOukH3Vh+F++PtZ0soySk8ChWvFlmTdsbRq3C87ZUNz4YIqMQt2 XaB4A X-Developer-Key: i=chleroy@kernel.org; a=openpgp; fpr=10FFE6F8B390DE17ACC2632368A92FEB01B8DD78 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Commit 861574d51bbd ("powerpc/uaccess: Implement masked user access") provides optimised user access by avoiding the cost of access_ok(). Use masked user access in arch_futex_atomic_op_inuser() Signed-off-by: Christophe Leroy (CS GROUP) --- arch/powerpc/include/asm/futex.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/futex.h b/arch/powerpc/include/asm/fu= tex.h index b3001f8b2c1e..8cf3b2e97e17 100644 --- a/arch/powerpc/include/asm/futex.h +++ b/arch/powerpc/include/asm/futex.h @@ -33,8 +33,7 @@ static inline int arch_futex_atomic_op_inuser(int op, int= oparg, int *oval, { int oldval =3D 0, ret; =20 - if (!user_access_begin(uaddr, sizeof(u32))) - return -EFAULT; + uaddr =3D masked_user_access_begin(uaddr); =20 switch (op) { case FUTEX_OP_SET: @@ -69,8 +68,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uadd= r, int ret =3D 0; u32 prev; =20 - if (!user_access_begin(uaddr, sizeof(u32))) - return -EFAULT; + uaddr =3D masked_user_access_begin(uaddr); =20 __asm__ __volatile__ ( PPC_ATOMIC_ENTRY_BARRIER --=20 2.49.0