rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Valentin Obst" <kernel@valentinobst.de>,
	"Alice Ryhl" <aliceryhl@google.com>
Cc: "Andreas Hindborg" <a.hindborg@samsung.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Christian Brauner" <brauner@kernel.org>,
	"Carlos Llamas" <cmllamas@google.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Joel Fernandes" <joel@joelfernandes.org>,
	"Kees Cook" <keescook@chromium.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	"Martijn Coenen" <maco@android.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	rust-for-linux@vger.kernel.org,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>
Subject: Re: [PATCH v2 2/4] uaccess: always export _copy_[from|to]_user with CONFIG_RUST
Date: Fri, 09 Feb 2024 15:41:08 +0100	[thread overview]
Message-ID: <6eeba3ce-d66c-45e2-8c34-ad0109ec2ef0@app.fastmail.com> (raw)
In-Reply-To: <20240208225608.11987-1-kernel@valentinobst.de>

On Thu, Feb 8, 2024, at 23:56, Valentin Obst wrote:
>> -#else
>>  extern __must_check unsigned long
>>  _copy_from_user(void *, const void __user *, unsigned long);
>> -#endif
>
> This function is now unconditionally declared, but only defined if
> `!defined(INLINE_COPY_FROM_USER) || defined(CONFIG_RUST)`, i.e., in the
> common case where it is inlined and Rust is disabled this can lead to
> link-time problems if someone decides to use it.

Yes, that is intentional.

If someone tries to use it when the declaration is not there,
they just get a compile-time error, which is not all that
different from a link-time error in practice.

It's unlikely to make a difference here, but enclosing
declarations in an #ifdef is annoying when you want to
reference it from somewhere that is parsed by the compiler
but not called without the respective options.

The if(IS_ENABLED()) and PTR_IF() constructs in particular
only work when the unused functions are still declared.

       Arnd

  reply	other threads:[~2024-02-09 14:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-08 15:47 [PATCH v2 0/4] Memory management patches needed by Rust Binder Alice Ryhl
2024-02-08 15:47 ` [PATCH v2 1/4] rust: uaccess: add userspace pointers Alice Ryhl
2024-02-08 22:54   ` Valentin Obst
2024-02-09 11:15     ` Alice Ryhl
2024-02-21 11:47   ` Alice Ryhl
2024-02-27 10:05   ` Carlos López
2024-02-27 13:12     ` Alice Ryhl
2024-02-08 15:47 ` [PATCH v2 2/4] uaccess: always export _copy_[from|to]_user with CONFIG_RUST Alice Ryhl
2024-02-08 22:56   ` Valentin Obst
2024-02-09 14:41     ` Arnd Bergmann [this message]
2024-02-09 16:45       ` Valentin Obst
2024-02-10  0:15   ` Kees Cook
2024-02-10 11:07     ` Arnd Bergmann
2024-02-14 10:51     ` Alice Ryhl
2024-02-08 15:47 ` [PATCH v2 3/4] rust: uaccess: add typed accessors for userspace pointers Alice Ryhl
2024-02-08 22:57   ` Valentin Obst
2024-02-09 10:40     ` Alice Ryhl
2024-02-09 17:18       ` Valentin Obst
2024-02-08 15:47 ` [PATCH v2 4/4] rust: add abstraction for `struct page` Alice Ryhl
2024-02-10  4:23   ` Martin Rodriguez Reboredo
2024-02-12  9:36     ` Alice Ryhl
2024-02-12 18:11       ` Martin Rodriguez Reboredo
2024-02-27  8:32   ` Andreas Hindborg
2024-02-27 15:37   ` Matthew Wilcox
2024-02-27 15:56     ` Alice Ryhl

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=6eeba3ce-d66c-45e2-8c34-ad0109ec2ef0@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=a.hindborg@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=arve@android.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=brauner@kernel.org \
    --cc=cmllamas@google.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=joel@joelfernandes.org \
    --cc=keescook@chromium.org \
    --cc=kernel@valentinobst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maco@android.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=surenb@google.com \
    --cc=tkjos@android.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wedsonaf@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).