Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #86881

Re: Package for development of out-of-tree kernel modules written in Rust

From NoisyCoil <noisycoil@disroot.org>
Newsgroups linux.debian.kernel
Subject Re: Package for development of out-of-tree kernel modules written in Rust
Date 2025-04-13 20:30 +0200
Message-ID <KBafD-dhqA-31@gated-at.bofh.it> (permalink)
References (8 earlier) <KyFSF-bDwQ-7@gated-at.bofh.it> <KAMdj-d1Gi-1@gated-at.bofh.it> <KB3QR-ddhw-15@gated-at.bofh.it> <KB7B7-dfGP-1@gated-at.bofh.it> <KB8xb-dghd-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 13/04/25 18:17, Miguel Ojeda wrote:
> I am not sure I am following correctly the tests, but are you
> referring to rebuilding all the Rust artifacts (and not just the host
> ones)?

Yes. Only rebuilding the host ones -- that is, the macros -- did not 
work. To recap:


1. If the kernel is compiled natively on arm64

    a. building the OOT module on arm64 using the artifacts from the 
build obviously works

    b. if the natively built artifacts are transferred to an x86_64 
machine, and libmacros.so is replaced from a twin cross-build, 
cross-building the OOT module does not work. The compiler complains that 
the kernel crate and macros are not found

    c. like 1b., but all Rust artifacts (i.e. rmetas too) are replaced 
from a twin cross-build, works


2. If the kernel is cross-built on x86_64

    a. cross-building the OOT module on x86_64 using the artifacts from 
the build works

    b. if the cross-built artifacts are transferred to an arm64 machine, 
and libmacros.so is replaced from a twin native build, natively building 
the OOT module does not work. As in 1b. the compiler complains that the 
kernel crate and macros are not found

    c. like 2b., but all Rust artifacts (i.e. rmetas too) are replaced 
from a twin native build, works


The builds are of 6.14.2 [1], done in Debian unstable containers with 
the latest toolchain versions available at this time. When I say a build 
worked I also mean the module correctly loaded on arm64. I have 
MODVERSIONS enabled in my config, but this is probably irrelevant in 
this context because, even if it wasn't, vermagic should be the same for 
native and cross builds here IIUC.

> I think that would still be not generally supported by the kernel,
> since you still used a different host/target pair (i.e. different
> toolchains/binaries) -- if I understand correctly, your out-of-tree
> module ends up using `.rmeta`s that are different than those used for
> the main kernel since they come from a different build, even if they
> are all accepted by the Rust compiler since it built them all.

Correct. Yeah, I get this is unsupported by the kernel, I was just 
throwing things at the wall and see what sticks :-) Apparently what 
stuck is pretending rustc was never part of the equation and present the 
kernel image with a module built whatever way it works (in this case, by 
rebuilding the Rust bits with a non-matching compiler together with the 
OOT module). As far as I understand, this is the most support the kernel 
ever provided to this kind of stuff -- none, but once you get binaries 
to build these may turn out to be compatible if you're lucky enough.


Cheers!


[1] One caveat though: I wanted to try to load the modules without 
setting up other arm64 machines or VMs, so it was easier for me to use 
the Asahi fork. AFAICS they don't make changes to the build system nor 
module loading bits.

Back to linux.debian.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Package for development of out-of-tree kernel modules written in Rust NoisyCoil <noisycoil@disroot.org> - 2025-02-26 01:30 +0100
  Re: Package for development of out-of-tree kernel modules written in  Rust Bastian Blank <waldi@debian.org> - 2025-02-26 12:50 +0100
    Re: Package for development of out-of-tree kernel modules written in  Rust NoisyCoil <noisycoil@disroot.org> - 2025-02-26 13:20 +0100
      Re: Package for development of out-of-tree kernel modules written in Rust Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> - 2025-02-26 14:00 +0100
        Re: Package for development of out-of-tree kernel modules written in  Rust NoisyCoil <noisycoil@disroot.org> - 2025-02-26 15:20 +0100
          Re: Package for development of out-of-tree kernel modules written in Rust Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> - 2025-02-26 19:30 +0100
            Re: Package for development of out-of-tree kernel modules written in  Rust NoisyCoil <noisycoil@disroot.org> - 2025-02-26 22:00 +0100
              Re: Package for development of out-of-tree kernel modules written in Rust Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> - 2025-02-27 18:40 +0100
        Re: Package for development of out-of-tree kernel modules written  in Rust Ben Hutchings <ben@decadent.org.uk> - 2025-02-26 19:20 +0100
          Re: Package for development of out-of-tree kernel modules written in  Rust NoisyCoil <noisycoil@disroot.org> - 2025-02-26 19:30 +0100
            Re: Package for development of out-of-tree kernel modules written in Rust Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> - 2025-02-26 20:10 +0100
              Re: Package for development of out-of-tree kernel modules written in  Rust NoisyCoil <noisycoil@disroot.org> - 2025-02-26 20:20 +0100
                Re: Package for development of out-of-tree kernel modules written in Rust Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> - 2025-02-27 18:40 +0100
              Re: Package for development of out-of-tree kernel modules written in  Rust Bastian Blank <waldi@debian.org> - 2025-04-02 23:00 +0200
                Re: Package for development of out-of-tree kernel modules written in  Rust Bastian Blank <waldi@debian.org> - 2025-04-02 23:30 +0200
                Re: Package for development of out-of-tree kernel modules written in  Rust NoisyCoil <noisycoil@disroot.org> - 2025-04-02 23:40 +0200
                Re: Package for development of out-of-tree kernel modules written in  Rust NoisyCoil <noisycoil@disroot.org> - 2025-04-03 00:50 +0200
                Re: Package for development of out-of-tree kernel modules written in  Rust Bastian Blank <waldi@debian.org> - 2025-04-03 16:50 +0200
                Re: Package for development of out-of-tree kernel modules written in  Rust NoisyCoil <noisycoil@disroot.org> - 2025-04-03 19:30 +0200
                Re: Package for development of out-of-tree kernel modules written in  Rust Bastian Blank <waldi@debian.org> - 2025-04-03 21:00 +0200
                Re: Package for development of out-of-tree kernel modules written in Rust Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> - 2025-04-03 23:30 +0200
                Re: Package for development of out-of-tree kernel modules written in  Rust NoisyCoil <noisycoil@disroot.org> - 2025-04-03 23:40 +0200
                Re: Package for development of out-of-tree kernel modules written in Rust Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> - 2025-04-06 23:40 +0200
                Re: Package for development of out-of-tree kernel modules written in  Rust NoisyCoil <noisycoil@disroot.org> - 2025-04-12 18:50 +0200
                Re: Package for development of out-of-tree kernel modules written in  Rust Bastian Blank <waldi@debian.org> - 2025-04-13 13:40 +0200
                Re: Package for development of out-of-tree kernel modules written in  Rust NoisyCoil <noisycoil@disroot.org> - 2025-04-13 17:40 +0200
                Re: Package for development of out-of-tree kernel modules written in Rust Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> - 2025-04-13 18:40 +0200
                Re: Package for development of out-of-tree kernel modules written in  Rust NoisyCoil <noisycoil@disroot.org> - 2025-04-13 20:30 +0200
                Re: Package for development of out-of-tree kernel modules written  in Rust Ben Hutchings <ben@decadent.org.uk> - 2025-04-16 17:40 +0200
                Re: Package for development of out-of-tree kernel modules written in Rust Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> - 2025-05-03 17:10 +0200
                Re: Package for development of out-of-tree kernel modules written in  Rust Bastian Blank <waldi@debian.org> - 2025-04-04 11:20 +0200
                Re: Package for development of out-of-tree kernel modules written in Rust Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> - 2025-04-06 23:40 +0200
          Re: Package for development of out-of-tree kernel modules written in Rust Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> - 2025-02-26 19:40 +0100
      Re: Package for development of out-of-tree kernel modules written in  Rust NoisyCoil <noisycoil@disroot.org> - 2025-02-26 14:40 +0100
      Re: Package for development of out-of-tree kernel modules written in  Rust Bastian Blank <waldi@debian.org> - 2025-02-26 14:40 +0100

csiph-web