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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ef950304-0e98-4c91-8fa1-d236cbb782b8@disroot.org>
Date: Sat, 22 Feb 2025 13:09:29 +0100
From: NoisyCoil <noisycoil@...root.org>
To: stable@...r.kernel.org
Cc: regressions@...ts.linux.dev, ojeda@...nel.org, alex.gaynor@...il.com,
 linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: FTBFS: Rust firmware abstractions in current stable (6.13.4) on arm64
 with rustc 1.85.0

Hi!

The Rust firmware abstractions FTBFS on arm64 and current stable 
(6.13.4) when compiled with rustc 1.85.0:


```
   RUSTC L rust/kernel.o
error[E0308]: mismatched types
   --> rust/kernel/firmware.rs:20:14
    |
20 |         Self(bindings::request_firmware)
    |         ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found 
fn item
    |         |
    |         arguments to this function are incorrect
    |
    = note: expected fn pointer `unsafe extern "C" fn(_, *const i8, _) -> _`
                  found fn item `unsafe extern "C" fn(_, *const u8, _) 
-> _ {request_firmware}`
note: tuple struct defined here
   --> rust/kernel/firmware.rs:14:8
    |
14 | struct FwFunc(
    |        ^^^^^^

error[E0308]: mismatched types
   --> rust/kernel/firmware.rs:24:14
    |
24 |         Self(bindings::firmware_request_nowarn)
    |         ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn 
pointer, found fn item
    |         |
    |         arguments to this function are incorrect
    |
    = note: expected fn pointer `unsafe extern "C" fn(_, *const i8, _) -> _`
                  found fn item `unsafe extern "C" fn(_, *const u8, _) 
-> _ {firmware_request_nowarn}`
note: tuple struct defined here
   --> rust/kernel/firmware.rs:14:8
    |
14 | struct FwFunc(
    |        ^^^^^^

error[E0308]: mismatched types
   --> rust/kernel/firmware.rs:64:45
    |
64 |         let ret = unsafe { func.0(pfw as _, name.as_char_ptr(), 
dev.as_raw()) };
    |                            ------           ^^^^^^^^^^^^^^^^^^ 
expected `*const i8`, found `*const u8`
    |                            |
    |                            arguments to this function are incorrect
    |
    = note: expected raw pointer `*const i8`
               found raw pointer `*const u8`

error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0308`.
```


This is because rustc 1.85 (now stable) switched core::ffi::c_char from 
i8 to u8 on arm64 and other platforms [1], and because current stable 
still uses rustc's core's instead of the custom ffi integer types like 
6.14 will. Looking for other i8's in *.rs files tells me only the QR 
code panic screen should be affected in addition to the firmware 
abstractions, and that was already reported in [2].

A simple fix would be to switch i8 to u8 in `struct FwFunc`, but that 
breaks rustc <= 1.84 so I guess a more robust solution is needed.

Cheers!


[1] https://github.com/rust-lang/rust/pull/132975
[2] 
https://lore.kernel.org/all/20250120124531.2581448-1-linkmauve@linkmauve.fr/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ