From: David Laight <david.laight.linux@gmail.com>
To: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
kernel test robot <lkp@intel.com>,
Russell King <linux@armlinux.org.uk>,
linux-arm-kernel@lists.infradead.org, x86@kernel.org,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
linuxppc-dev@lists.ozlabs.org, Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
linux-riscv@lists.infradead.org,
Heiko Carstens <hca@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
linux-s390@vger.kernel.org, Julia Lawall <Julia.Lawall@inria.fr>,
Nicolas Palix <nicolas.palix@imag.fr>,
Peter Zijlstra <peterz@infradead.org>,
Darren Hart <dvhart@infradead.org>,
Davidlohr Bueso <dave@stgolabs.net>,
Andre Almeida <andrealmeid@igalia.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] uaccess: Fix build of scoped user access with const pointer
Date: Sun, 1 Mar 2026 21:52:57 +0000 [thread overview]
Message-ID: <20260301215257.7bdad5f1@pumpkin> (raw)
In-Reply-To: <4e994e13b48420ef36be686458ce3512657ddb41.1772393211.git.chleroy@kernel.org>
On Sun, 1 Mar 2026 20:33:58 +0100
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org> wrote:
> After converting powerpc checksum wrappers to scoped user access,
> following build failure happens:
>
> CC arch/powerpc/lib/checksum_wrappers.o
> In file included from arch/powerpc/lib/checksum_wrappers.c:12:
> arch/powerpc/lib/checksum_wrappers.c: In function 'csum_and_copy_from_user':
> ./include/linux/uaccess.h:691:1: error: initialization discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
> 691 | ({ \
> | ^
> ./include/linux/uaccess.h:755:37: note: in expansion of macro '__scoped_user_access_begin'
> 755 | for (void __user *_tmpptr = __scoped_user_access_begin(mode, uptr, size, elbl); \
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> ./include/linux/uaccess.h:770:9: note: in expansion of macro '__scoped_user_access'
> 770 | __scoped_user_access(read, usrc, size, elbl)
> | ^~~~~~~~~~~~~~~~~~~~
> arch/powerpc/lib/checksum_wrappers.c:17:9: note: in expansion of macro 'scoped_user_read_access_size'
> 17 | scoped_user_read_access_size(src, len, efault)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Cast __scoped_user_access_begin() to (void __user *) to fix it.
I posted a patch to fix this in december, I'll find it and resend it.
David
>
> Fixes: e497310b4ffb ("uaccess: Provide scoped user access regions")
> Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
> ---
> Thomas, I encountered this problem while preparing some patches to start using
> scope user access widely on powerpc in order to benefit more from masked user
> access. Can you make this patch go into 7.0 as a fix in order avoid dependency
> on this change when we start using scoped user access ?
>
> include/linux/uaccess.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
> index 1f3804245c06..5d9f6d45d301 100644
> --- a/include/linux/uaccess.h
> +++ b/include/linux/uaccess.h
> @@ -752,7 +752,8 @@ USER_ACCESS_GUARD(rw)
> */
> #define __scoped_user_access(mode, uptr, size, elbl) \
> for (bool done = false; !done; done = true) \
> - for (void __user *_tmpptr = __scoped_user_access_begin(mode, uptr, size, elbl); \
> + for (void __user *_tmpptr = (void __user *) \
> + __scoped_user_access_begin(mode, uptr, size, elbl); \
> !done; done = true) \
> for (CLASS(user_##mode##_access, scope)(_tmpptr); !done; done = true) \
> /* Force modified pointer usage within the scope */ \
prev parent reply other threads:[~2026-03-01 21:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-01 19:33 [PATCH] uaccess: Fix build of scoped user access with const pointer Christophe Leroy (CS GROUP)
2026-03-01 20:01 ` Linus Torvalds
2026-03-01 21:59 ` David Laight
2026-03-01 22:16 ` David Laight
2026-03-01 21:52 ` David Laight [this message]
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=20260301215257.7bdad5f1@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=Julia.Lawall@inria.fr \
--cc=andrealmeid@igalia.com \
--cc=andrew.cooper3@citrix.com \
--cc=borntraeger@linux.ibm.com \
--cc=brauner@kernel.org \
--cc=chleroy@kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=hca@linux.ibm.com \
--cc=jack@suse.cz \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lkp@intel.com \
--cc=maddy@linux.ibm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mpe@ellerman.id.au \
--cc=nicolas.palix@imag.fr \
--cc=npiggin@gmail.com \
--cc=palmer@dabbelt.com \
--cc=peterz@infradead.org \
--cc=pjw@kernel.org \
--cc=svens@linux.ibm.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
--cc=x86@kernel.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