[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <ace5ac5c-88d2-43be-9236-11d3913886b9@app.fastmail.com>
Date: Wed, 15 May 2024 07:34:31 +0000
From: "Arnd Bergmann" <arnd@...db.de>
To: "Andrew Morton" <akpm@...ux-foundation.org>,
"Alice Ryhl" <aliceryhl@...gle.com>
Cc: "Miguel Ojeda" <ojeda@...nel.org>, "Matthew Wilcox" <willy@...radead.org>,
"Alexander Viro" <viro@...iv.linux.org.uk>,
"Kees Cook" <keescook@...omium.org>, "Alex Gaynor" <alex.gaynor@...il.com>,
"Wedson Almeida Filho" <wedsonaf@...il.com>,
"Boqun Feng" <boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
"Benno Lossin" <benno.lossin@...ton.me>,
"Andreas Hindborg" <a.hindborg@...sung.com>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
Arve Hjønnevåg <arve@...roid.com>,
"Todd Kjos" <tkjos@...roid.com>, "Martijn Coenen" <maco@...roid.com>,
"Joel Fernandes" <joel@...lfernandes.org>,
"Carlos Llamas" <cmllamas@...gle.com>,
"Suren Baghdasaryan" <surenb@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, "Christian Brauner" <brauner@...nel.org>
Subject: Re: [PATCH v6 2/4] uaccess: always export _copy_[from|to]_user with
CONFIG_RUST
On Tue, May 14, 2024, at 17:27, Andrew Morton wrote:
> On Thu, 18 Apr 2024 08:59:18 +0000 Alice Ryhl <aliceryhl@...gle.com> wrote:
>
>> From: Arnd Bergmann <arnd@...db.de>
>>
>> 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?
How about
/*
* Architectures that #define INLINE_COPY_TO_USER use this function
* directly in the normal copy_to_user(), the other ones go through
* an extern _copy_to_user(), which expands the same code here.
* Rust code always uses the extern definition.
*/
Arnd
Powered by blists - more mailing lists