Re: [PATCH] uaccess: decouple INLINE_COPY_FROM_USER and CONFIG_RUST
From: Alice Ryhl
Date: Fri Oct 24 2025 - 05:15:41 EST
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.
Alice