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: <20251105155109.1b3fc7d8@canb.auug.org.au>
Date: Wed, 5 Nov 2025 15:51:09 +1100
From: Stephen Rothwell <sfr@...b.auug.org.au>
To: 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>, Andreas Hindborg
 <a.hindborg@...nel.org>, 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 all,

On Tue, 4 Nov 2025 15:45:00 +1100 Stephen Rothwell <sfr@...b.auug.org.au> wrote:
>
> 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.

I have used the modules tree as is and applied the below merge
resolution patch (supplied by Andreas) to the merge of the rust tree.

From: Stephen Rothwell <sfr@...b.auug.org.au>
Date: Wed, 5 Nov 2025 14:52:29 +1100
Subject: [PATCH] fix up for "rust: replace `CStr` with `core::ffi::CStr`"

interacting with commit

  0b08fc292842 ("rust: introduce module_param module")

from the modules tree.

Signed-off-by: Stephen Rothwell <sfr@...b.auug.org.au>
---
 rust/kernel/module_param.rs | 1 +
 rust/macros/module.rs       | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/rust/kernel/module_param.rs b/rust/kernel/module_param.rs
index e7d5c930a467..6a8a7a875643 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 1a22de73d512..f6a94712384f 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.
-- 
2.51.1

-- 
Cheers,
Stephen Rothwell

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ