Re: [PATCH] uaccess: decouple INLINE_COPY_FROM_USER and CONFIG_RUST
From: Yury Norov
Date: Fri Oct 24 2025 - 09:45:52 EST
On Fri, Oct 24, 2025 at 09:12:56AM +0000, Alice Ryhl wrote:
> On Thu, Oct 23, 2025 at 01:16:06PM -0400, Yury Norov (NVIDIA) wrote:
> > Commit 1f9a8286bc0c ("uaccess: always export _copy_[from|to]_user with
> > CONFIG_RUST") exports _copy_{from,to}_user() unconditionally, if RUST
> > is enabled. This pollutes exported symbols namespace, and spreads RUST
> > ifdefery in core files.
> >
> > It's better to declare a corresponding helper under the rust/helpers,
> > similarly to how non-underscored copy_{from,to}_user() is handled.
> >
> > Signed-off-by: Yury Norov (NVIDIA) <yury.norov@xxxxxxxxx>
>
> Overall LGTM:
> Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> Tested-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
>
>
> In include/linux/uaccess.h there is the comment:
>
> Rust code always uses the extern definition.
>
> I think we should reword this comment as part of this change. You can
> say that Rust accesses _inline_copy_from_user() through a helper, or
> similar.
>
> After all, when using LTO or other mechanism to inline helpers, it is no
> longer the case that Rust always uses the a function call.
It is actually worth to just drop the rust part of the comment - with
this patch there's nothing special in managing the _copy_from_user().
I'll send v2. Thanks for review!
Thanks,
Yury