Re: [PATCH v6 2/4] uaccess: always export _copy_[from|to]_user with CONFIG_RUST
From: Andrew Morton
Date: Tue May 14 2024 - 13:28:12 EST
On Thu, 18 Apr 2024 08:59:18 +0000 Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> Rust code needs to be able to access _copy_from_user and _copy_to_user
> so that it can skip the check_copy_size check in cases where the length
> is known at compile-time, mirroring the logic for when C code will skip
> check_copy_size. To do this, we ensure that exported versions of these
> methods are available when CONFIG_RUST is enabled.
>
> Alice has verified that this patch passes the CONFIG_TEST_USER_COPY test
> on x86 using the Android cuttlefish emulator.
>
> ...
>
> -#ifdef INLINE_COPY_TO_USER
> static inline __must_check unsigned long
> -_copy_to_user(void __user *to, const void *from, unsigned long n)
> +_inline_copy_to_user(void __user *to, const void *from, unsigned long n)
> {
I think it would be helpful to have some comments in here describing
why we're doing this _inline_* thing. What problem is it avoiding?