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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231007.085400.1040380280563980814.fujita.tomonori@gmail.com>
Date: Sat, 07 Oct 2023 08:54:00 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: andrew@...n.ch
Cc: fujita.tomonori@...il.com, gregkh@...uxfoundation.org,
 netdev@...r.kernel.org, rust-for-linux@...r.kernel.org,
 miguel.ojeda.sandonis@...il.com
Subject: Re: [PATCH v2 3/3] net: phy: add Rust Asix PHY driver

On Fri, 6 Oct 2023 18:55:23 +0200
Andrew Lunn <andrew@...n.ch> wrote:

>> How about adding CONFIG_RUST_PHYLIB to the first patch. Not
>> selectable, it's just a flag for Rust PHYLIB support.
> 
> We have to be careful with names. To some extent, CONFIG_PHYLIB means
> the core of phylib. So it could be that CONFIG_RUST_PHYLIB means the
> core of phylib written in rust? I doubt that will ever happen, but we
> are setting a naming scheme here which i expect others will blindly
> cut/paste. What we actually want is a symbol which represents the Rust
> binding onto the phylib core. So i think it should have BINDING, or
> WRAPPER or something like that in the name.

Good point. Let's save CONFIG_PHYLIB for someday.


>> diff --git a/init/Kconfig b/init/Kconfig
>> index 4b4e3df1658d..2b6627aeb98c 100644
>> --- a/init/Kconfig
>> +++ b/init/Kconfig
>> @@ -1889,7 +1889,7 @@ config RUST
>>  	depends on !GCC_PLUGINS
>>  	depends on !RANDSTRUCT
>>  	depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE
>> 	depends on PHYLIB=y
>> +	select RUST_PHYLIB
> 
> I know the rust build system is rather limited at the moment, but is
> this required? Is it possible to build the rust code without the
> phylib binding? Can your `RUST_PHYLIB` add phylib.rs to a Makefile
> target only if it is enabled?

A short-term solution could work, I think.

config RUST
	bool "Rust support"
	depends on HAVE_RUST
	depends on RUST_IS_AVAILABLE
	depends on !MODVERSIONS
	depends on !GCC_PLUGINS
	depends on !RANDSTRUCT
	depends on !DEBUG_INFO_BTF || PAHOLE_HAS_LANG_EXCLUDE
	select CONSTRUCTORS
	help
	  Enables Rust support in the kernel.

	  This allows other Rust-related options, like drivers written in Rust,
	  to be selected.

	  It is also required to be able to load external kernel modules
	  written in Rust.

	  See Documentation/rust/ for more information.

	  If unsure, say N.

config RUST_PHYLIB_BINDING
	bool "PHYLIB bindings support"
	depends on RUST
	depends on PHYLIB=y
	help
          Adds support needed for PHY drivers written in Rust. It provides
          a wrapper around the C phlib core.


Then we can conditionally build build the PHYLIB bindings.

diff --git a/rust/kernel/net.rs b/rust/kernel/net.rs
index fbb6d9683012..33fc1531a6c0 100644
--- a/rust/kernel/net.rs
+++ b/rust/kernel/net.rs
@@ -2,4 +2,5 @@

 //! Networking.

+#[cfg(CONFIG_RUST_BINDINGS_PHYLIB)]
 pub mod phy;


A long-term solution is under discussion.

https://lore.kernel.org/rust-for-linux/20231006155739.246381-1-yakoyoku@gmail.com/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ