lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aRxM_NHhekMl9joH@google.com>
Date: Tue, 18 Nov 2025 10:39:56 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: "Yury Norov (NVIDIA)" <yury.norov@...il.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>, 
	Boqun Feng <boqun.feng@...il.com>, Danilo Krummrich <dakr@...nel.org>, Arnd Bergmann <arnd@...db.de>, 
	Alex Gaynor <alex.gaynor@...il.com>, Gary Guo <gary@...yguo.net>, 
	John Hubbard <jhubbard@...dia.com>, 
	"Björn Roy Baron" <bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>, 
	Andreas Hindborg <a.hindborg@...nel.org>, Trevor Gross <tmgross@...ch.edu>, linux-kernel@...r.kernel.org, 
	rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v2] uaccess: decouple INLINE_COPY_FROM_USER and CONFIG_RUST

On Fri, Oct 24, 2025 at 11:47:53AM -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.
> 
> Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
> Tested-by: Alice Ryhl <aliceryhl@...gle.com>
> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@...il.com>

It looks like this is not quite correct. The header file still has this
declaration unconditionally:

extern __must_check unsigned long
_copy_from_user(void *, const void __user *, unsigned long);

extern __must_check unsigned long
_copy_to_user(void __user *, const void *, unsigned long);

this causes:

ERROR: modpost: "_copy_from_user" [samples/rust/rust_misc_device.ko] undefined!
ERROR: modpost: "_copy_to_user" [samples/rust/rust_misc_device.ko] undefined!

This is because when Rust sees both a helper and a non-helper of the
same function, it prefers to call the non-helper version. In this case,
it saw a declaration of the function in the header file, and so it tried
to call that instead of the helper.

To fix this, we need to wrap the above declarations in:

	#ifndef INLINE_COPY_FROM_USER

Alice

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ