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: <87jz0685om.fsf@t14s.mail-host-address-is-not-set>
Date: Tue, 04 Nov 2025 11:15:21 +0100
From: Andreas Hindborg <a.hindborg@...nel.org>
To: Stephen Rothwell <sfr@...b.auug.org.au>, Luis Chamberlain
 <mcgrof@...nel.org>, Petr Pavlu <petr.pavlu@...e.com>, Sami Tolvanen
 <samitolvanen@...gle.com>, Daniel
 Gomez <da.gomez@...sung.com>, Miguel Ojeda <ojeda@...nel.org>
Cc: Tamir Duberstein <tamird@...il.com>, Daniel Gomez <da.gomez@...nel.org>,
 Linux
 Kernel Mailing List <linux-kernel@...r.kernel.org>, Linux Next Mailing
 List <linux-next@...r.kernel.org>
Subject: Re: linux-next: build failure after merge of the modules tree

Hi,

"Stephen Rothwell" <sfr@...b.auug.org.au> writes:

> Hi all,
>
> After merging the modules tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
>
> error[E0308]: mismatched types
>   --> rust/kernel/module_param.rs:75:47
>    |
> 75 |         let new_value = T::try_from_param_arg(arg)?;
>    |                         --------------------- ^^^ expected `&BStr`, found `&CStr`
>    |                         |
>    |                         arguments to this function are incorrect
>    |
>    = note: expected reference `&BStr`
>               found reference `&ffi::CStr`
> note: associated function defined here
>   --> rust/kernel/module_param.rs:32:8
>    |
> 32 |     fn try_from_param_arg(arg: &BStr) -> Result<Self>;
>    |        ^^^^^^^^^^^^^^^^^^
>
> error: aborting due to 1 previous error
>
> For more information about this error, try `rustc --explain E0308`.
>
> Caused by commit
>
>   0b08fc292842 ("rust: introduce module_param module")
>
> This is some interaction with something later in linux-next - presumably
> commit
>
>   3b83f5d5e78a ("rust: replace `CStr` with `core::ffi::CStr`")
>
> from the rust tree.
>
> Hopefully someone can provide a resolution for me tomorrow.
>
> I have used the modules tree from next-20251103 for today.

Please use the following resolution:

diff --git a/rust/kernel/module_param.rs b/rust/kernel/module_param.rs
index e7d5c930a467d..6a8a7a875643a 100644
--- a/rust/kernel/module_param.rs
+++ b/rust/kernel/module_param.rs
@@ -70,6 +70,7 @@ pub trait ModuleParam: Sized + Copy {
     // SAFETY: By function safety requirement, val is non-null, null-terminated
     // and valid for reads for the duration of this function.
     let arg = unsafe { CStr::from_char_ptr(val) };
+    let arg: &BStr = arg.as_ref();
 
     crate::error::from_result(|| {
         let new_value = T::try_from_param_arg(arg)?;
diff --git a/rust/macros/module.rs b/rust/macros/module.rs
index d62e9c1e2a898..decb0849f3d33 100644
--- a/rust/macros/module.rs
+++ b/rust/macros/module.rs
@@ -133,10 +133,10 @@ fn emit_params(&mut self, info: &ModuleInfo) {
                         ::kernel::module_param::KernelParam::new(
                             ::kernel::bindings::kernel_param {{
                                 name: if ::core::cfg!(MODULE) {{
-                                    ::kernel::c_str!(\"{param_name}\").as_bytes_with_nul()
+                                    ::kernel::c_str!(\"{param_name}\").to_bytes_with_nul()
                                 }} else {{
                                     ::kernel::c_str!(\"{module_name}.{param_name}\")
-                                        .as_bytes_with_nul()
+                                        .to_bytes_with_nul()
                                 }}.as_ptr(),
                                 // SAFETY: `__this_module` is constructed by the kernel at load
                                 // time and will not be freed until the module is unloaded.



Best regards,
Andreas Hindborg



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ