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]
Date: Tue, 03 Oct 2023 12:43:11 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: andrew@...n.ch
Cc: fujita.tomonori@...il.com, miguel.ojeda.sandonis@...il.com,
 netdev@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v1 1/3] rust: core abstractions for network PHY drivers

On Tue, 3 Oct 2023 03:40:50 +0200
Andrew Lunn <andrew@...n.ch> wrote:

> On Tue, Oct 03, 2023 at 09:33:38AM +0900, FUJITA Tomonori wrote:
>> On Mon, 2 Oct 2023 16:52:45 +0200
>> Andrew Lunn <andrew@...n.ch> wrote:
>> 
>> >> +//! Networking.
>> >> +
>> >> +#[cfg(CONFIG_PHYLIB)]
>> > 
>> > I brought this up on the rust for linux list, but did not get a answer
>> > which convinced me.
>> 
>> Sorry, I overlooked that discussion.
>> 
>> 
>> > Have you tried building this with PHYLIB as a kernel module? 
>> 
>> I've just tried and failed to build due to linker errors.
>> 
>> 
>> > My understanding is that at the moment, this binding code is always
>> > built in. So you somehow need to force phylib core to also be builtin.
>> 
>> Right. It means if you add Rust bindings for a subsystem, the
>> subsystem must be builtin, cannot be a module. I'm not sure if it's
>> acceptable.
>  
> You just need Kconfig in the Rust code to indicate it depends on
> PHYLIB. Kconfig should then remove the option to build the phylib core
> as a module. And that is acceptable.  

The following works. If you set the phylib as a module, the rust
option isn't available.

diff --git a/init/Kconfig b/init/Kconfig
index 6d35728b94b2..4b4e3df1658d 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1889,6 +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 CONSTRUCTORS
 	help
 	  Enables Rust support in the kernel.
diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs
index 0588422e273c..f9883bde4459 100644
--- a/rust/kernel/lib.rs
+++ b/rust/kernel/lib.rs
@@ -37,7 +37,6 @@
 pub mod ioctl;
 #[cfg(CONFIG_KUNIT)]
 pub mod kunit;
-#[cfg(CONFIG_NET)]
 pub mod net;
 pub mod prelude;
 pub mod print;
diff --git a/rust/kernel/net.rs b/rust/kernel/net.rs
index b49b052969e5..fbb6d9683012 100644
--- a/rust/kernel/net.rs
+++ b/rust/kernel/net.rs
@@ -2,5 +2,4 @@
 
 //! Networking.
 
-#[cfg(CONFIG_PHYLIB)]
 pub mod phy;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ