[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240209164505.2108-1-kernel@valentinobst.de>
Date: Fri, 9 Feb 2024 17:45:05 +0100
From: Valentin Obst <kernel@...entinobst.de>
To: arnd@...db.de
Cc: a.hindborg@...sung.com,
akpm@...ux-foundation.org,
alex.gaynor@...il.com,
aliceryhl@...gle.com,
arve@...roid.com,
benno.lossin@...ton.me,
bjorn3_gh@...tonmail.com,
boqun.feng@...il.com,
brauner@...nel.org,
cmllamas@...gle.com,
gary@...yguo.net,
gregkh@...uxfoundation.org,
joel@...lfernandes.org,
keescook@...omium.org,
kernel@...entinobst.de,
linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
maco@...roid.com,
ojeda@...nel.org,
rust-for-linux@...r.kernel.org,
surenb@...gle.com,
tkjos@...roid.com,
viro@...iv.linux.org.uk,
wedsonaf@...il.com
Subject: Re: [PATCH v2 2/4] uaccess: always export _copy_[from|to]_user with CONFIG_RUST
>>> -#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.
I see, thanks for the explanation.
- Best Valentin
>
> Arnd
Powered by blists - more mailing lists