From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.71.212.29 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796234514; b=V8inDmfGqmSKG6WCnfvOoYTLpB6ckjGtxXPSAEg9pk7uAraIIdA0x8vyei0eGjlJyfQv 1fAeeXFkTc9ymV0rdT3pTnvgPxNXUtbAlQ3F20Wb65pA481QxhV1dIxIDfCx9Sr8Fc06W vcFabT8Bel1x7mwBrJYFcRmfEAb/3FPRtJ6qOSSHnZQORWXLQ5w+9+YxXx4MKkjab1iby xZB0Swunb+ML2XulJ1hZ/VCDpCjgh+2Oew2sF5CB7ANdhFBC8iv9qW+ohBM332GyKkbW8 ZrB83VgqWM6PYjahpJBGxhv2ylFFanDv0snLGQrbJjdiBKPAuBBLn+ZfIjw9wxfgXEg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796234514; h=DMARC-Filter:DKIM-Signature:X-RG-SOPHOS:X-RG-VADE-SC:X-RG-VADE: X-Originating-IP:X-RG-Env-Sender:X-RG-Rigid:X-RazorGate-Vade: X-RazorGate-Vade-Verdict:X-RazorGate-Vade-Classification:Received: Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; bh=6QOsff+CWZdpyjK+7ck5TVSIuIFkzG7cyXTAdD6N8IA=; b=D8d4h43YvOyIBluk7+Nj5+MvZUXan8JxeCP3XoN6KezQTIU5hZtyQ3Btf+5ZXZZ1hgE+ BxaRZ19UoKuem5gRTr2zpXZq3hKig42yxqYOi3TkEMbCC/d+OdKAT0Bly2LO6YPbI82Jc XSniyTXX7wzGjsT2hICKxbTbcZi3QlGxPeO3kVLt9k51E89lAms4vv6YVLxE4KRYfk7OI CFkt2LbZpn3BAwB8bljMsUblzOTmidgy/nneoaQFSjlFtWrC16P5KBBNI7Fp/ar0cAxHG QbVM8eTf0XHeDKS4eudHMNxtQYz6wByG6b/9zyQBddqOjzolXrUYkuKz8QEi1hSOLJw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bell.net; spf=pass smtp.mailfrom=bell.net; dkim=pass header.d=bell.net header.i=@bell.net header.a=rsa-sha256 header.s=selector1 header.b=SgvYnaXP; arc=none smtp.remote-ip=209.71.212.29 Received: from cmx-torrgo001.bell.net (mta-tor-002.bell.net [209.71.212.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 65620606A322 for ; Wed, 2 Dec 2026 18:01:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 65620606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bell.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bell.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=bell.net header.i=@bell.net header.a=rsa-sha256 header.s=selector1 header.b=SgvYnaXP DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bell.net; s=selector1; t=1796234513; bh=6QOsff+CWZdpyjK+7ck5TVSIuIFkzG7cyXTAdD6N8IA=; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type; b=SgvYnaXPKLaswDQiq8KYur0JLEwSCGqjzV7mfHvTUJwpCj8WHxdOgQtqeegfRhesVCSJymMTM+AVcyQqSaD3fx8o9P4TMZY5NHDzB2f2U+fEcJLBRdCjSFV1/d3QGOxc2NEG4vbunA6/pv3H/TIcF7hamNEI8SYFp+xuJMEff1E9ZyXzUK0IEwUKr5PysSUDRpzpJpY9yXWETdbmKfjqQQjpZlbmlYDIfli05WQ9VsNCDo8GKq/iZ4QyaAMEjtmYmHclK1XrgquHE9T2zOieRLbwG5k2dBuGogSvkT9SB5d5DBnd07EZYXC4hFDJotZkcetVl8w6wTLdy6fJvUD/dA== X-RG-SOPHOS: Clean X-RG-VADE-SC: 0 X-RG-VADE: Clean X-RG-Env-Sender: dave.anglin@bell.net X-RG-Rigid: 6AE76339035B064A X-RazorGate-Vade: dmFkZTFhEnwQrpyY9oEhumx7F8lCYuRPoezk/SKgds0lUUCSeOpWNnx9ncoJyiALySbNR3sdPr8xbizJUDDRqGpVKVwD73W1/e1J4k2xv/ZvR9aFfGHqwoyQapzOgHO1rjDHjqEaPzL/vhFu5NgGO62ZjZVJsOP7RDZ5fjAWVarzxtyB/J5uuNoIU9D68YNxRCrIttzUr3zOvKR7NVwEhoD/I9/tZ4r6Ey8Tl3l0PmzupCTj9CW+yR+1YuUJkRWTF8KCwoIsmshN3hQsWOmGhTfc3QuyKUZ865A44mZX0itabkgbIAgzWC2MGzY9x35v7Glp6ZpXewC1dtZnSsulofhOmFh9oAcxvvqwltpTvKssjEJquZA3H4FMxC2CPVIg465Rdb2vj1gZVwdWelvlxDUquB0N3OduGr0aKMrSFpHkwRMkasxCZKp69ErT07UoNktUHNkHBDzBIzO7NqFF1AqAoaBUf3CmfCGMb6fhXBK8vNV4/3XqZg6Rq7G6ByHPMo/3yc1LIn3g5e+9AqPLHntGHzK99ulO+L6Hwt6CnEmbkbIskLxOM+CQImpxOJgmNiOdvFiqxSQ8+lC4M70tHBcQSys1gg2Zf+h6mA8qvqMsKw6gQkZuKGD9t0SdEVTV7Xjys0QSqf1fycL8PbOPm9Gu101kmyKl2SHUDBnKLoTZ1SmxVg X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Received: from mx3210.local (70.52.161.120) by cmx-torrgo001.bell.net (authenticated as dave.anglin@bell.net) id 6AE76339035B064A; Wed, 2 Dec 2026 13:01:42 -0500 Date: Wed, 2 Dec 2026 13:01:41 -0500 From: John David Anglin To: Helge Deller , "James E.J. Bottomley" Cc: linux-parisc@vger.kernel.org Subject: [PATCH] parisc: uaccess: Avoid double evaluation of ptr in __get_user() Message-ID: X-Mailing-List: linux-parisc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xwYwumiIAJy6zo1y" Content-Disposition: inline --xwYwumiIAJy6zo1y Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable parisc: uaccess: Avoid double evaluation of ptr in __get_user() In __get_user(val, ptr), the pointer argument `ptr` is passed directly to both __get_user_internal() and __probe_user_internal(). When callers pass an expression with side effects (such as a post-increment), `ptr` is evaluated twice: once during the load and a second time during the subsequent `proberi` check. This causes callers such as compat_get_bitmap()=E2=80=94which invokes `unsafe_get_user(l1, umask++, Efault)` inside its loop when copying bitmaps larger than 32 bits=E2=80=94to advance the source pointer by two wo= rds per read and skip every other word. On 64-bit parisc kernels running a 32-bit userspace, this breaks select()/pselect6() whenever any monitored file descriptor is >=3D 32, causing pselect6() to poll an empty fd_set and hang until timeout (manifesting as cascading DejaGnu timeouts in the GCC testsuite when Expect spawn_ids are not immediately closed). Additionally, probing the incremented pointer can spuriously fail with -EFAULT if the original read occurred at the end of a mapped page. Cache `ptr` in a local `__ptr` variable in __get_user(), matching how __put_user() is already implemented. Fixes: 89f686a0fb6e ("parisc: Revise __get_user() to probe user read access= ") Cc: stable@vger.kernel.org # v5.12+ Signed-off-by: John David Anglin --- diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/ua= ccess.h index 6c531d2c847e..0c823f70a546 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h @@ -55,10 +55,11 @@ #define __get_user(val, ptr) \ ({ \ register long __gu_err; \ + __typeof__(&*(ptr)) __ptr =3D (ptr); \ \ - __gu_err =3D __get_user_internal(SR_USER, val, ptr); \ + __gu_err =3D __get_user_internal(SR_USER, val, __ptr); \ if (likely(!__gu_err)) \ - __probe_user_internal(SR_USER, __gu_err, ptr); \ + __probe_user_internal(SR_USER, __gu_err, __ptr);\ __gu_err; \ }) =20 --xwYwumiIAJy6zo1y Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEnRzl+6e9+DTrEhyEXb/Nrl8ZTfEFAmsQXPsACgkQXb/Nrl8Z TfFyfA//VeSHUlZFTci+tsM9huG3CZsZd/UwzBorLt6lxiqWJksSKgw0bd7EwnTu tuzM9UBTFkjapSmQgWbZf6/EPAbxuDDXl+W4oylBKWa/8tY7C3wEq9KV3kle26Gk g4udeSxUekKQVg8mzk+1/t1PXjrRvR54g7hW3JDxWoAaEZKZ9i3DPr4WarXnNRzl v73Kz9VU27W9UazX3vr+suFC9QutNC1BEu3Ixf+M3po/ok28lCZQlEx1E3QiEcRM oeabNeKjZ/6TsdC2VR7h2hMrZw0SHCyJwyiESdjszsqTZev2NiBkWOt6R+MaXlH4 tBrZpNH/dfYzlKm5BdFwtDYv9XVM3jl6gQGuDPcyfkKJArAq6hxCdBNuRbVgWeGy ih0VSai5ZcUrOhwLznJYlua6sGRjsw4wsNFT0WnMgPRdlxPSaJXKzHCN9MkY0cpb IfdqLHEzXyUGApI/CkT/fohpys5itwEHM0XDquJCoseEWI2ILQHT2Kz1gT1NkrN0 IIP5IQre8Linj7ffwi6seAhu3w8oAw85zcCCoFAn8yz+t9e0NoWG3l2kwfhfw2ln WsQ8mbT4LQiSkTy2d9stiB6gAJC2c9G/Go/kiZYFGPQ4Qo5sKnHe+CFngmSXjs23 QrIgVyU0l2OrRZ4p+ot9qVrNlag3zxn7RQOjxwVDCHcscVOkfkI= =T+fu -----END PGP SIGNATURE----- --xwYwumiIAJy6zo1y--