While Linux 7.0 is the next kernel version solely over Linus Torvalds’ numbering preference, there is a notable symbolic change that was sent in overnight for this new kernel merge window: formally concluding the “Rust experiment” with upstream kernel developers now in acceptance that Rust for the Linux kernel is here to stay.

The patch was talked about back in December that the Rust experiment is over and it’s here to stay. There are already uses for Rust in production environments, some Linux distributions shipping with Rust kernel code, and millions of Android devices also using it.

  • TrivialBetaState@sopuli.xyz
    link
    fedilink
    arrow-up
    32
    ·
    1 day ago

    Can someone explain to me why Rust has been so controversial for the GNU/Linux kernel? One thing that I personally don’t like is that the equivalent Rust-made (equivalent) GNU tools are licensed under MIT (or Apache? - something permissive like that) instead of GPL. If they were under GPL, I’d be more than happy. But since the kernel is under GPL regardless of C or Rust, what is the reason for the backlash? Sounds like a very promising language indeed.

    • Corbin
      link
      fedilink
      English
      arrow-up
      4
      ·
      3 hours ago

      From the perspective of somebody who’s actually hacked on Linux: Most Linux maintainers, like most programmers in general, are full of machismo stemming from the inherent difficulty of writing C. It is extremely difficult to write correct C and nobody can do it consistently, so those maintainers are heavily invested in the perception that they are skilled with C. Rust is much easier to write and democratizes kernel hacking, which is uncomfortable for older maintainers due to the standard teenagers-vs-parents social dynamics. Worse, adapting various kernel interfaces so that they are Rust-friendly has revealed that the pre- and postconditions of interface methods were not known before; there is existing sloppiness in the kernel’s internals which is only visible because of Rust-related cleanups.

      Note that Linux is not a GNU project. GNU’s kernel project is GNU Herd. “GNU/Linux” refers to Linux userlands populated with GNU packages. It’s important not to be distracted by this; the kernel is agnostic towards userland and generally is compatible with any loadable executable that uses Linux’s public syscall interface, so the entire discussion of Rust in the kernel is separate from anything going on in userland.

      Most siblings are wrong! PRs written in Rust can be rejected. There are already multiple non-C languages in the kernel. Rust is sufficiently available on the platforms where it will be required for building kernel. Maintainers are only added after they have shown themselves to be socially reliable and they can be removed by other maintainers if they are unresponsive. The only correct sibling points out that Rust is different.

    • Jhex@lemmy.world
      link
      fedilink
      arrow-up
      4
      arrow-down
      2
      ·
      12 hours ago

      From what I have ready the issue is as follows:

      Rust is a memory safe language, because of this Rust enthusiast have been pushing for it. Not a problem there.

      The issue is that some have taken it to an extreme, evangelical level where they expect name dropping Rust should open every door and blindly accept every PR

      In reality, Rust rewrites can (and have) introduced bugs because you can make shitty code even with the best languages out there

    • ILikeBoobies@lemmy.ca
      link
      fedilink
      arrow-up
      35
      arrow-down
      1
      ·
      edit-2
      24 hours ago

      Most common reason I saw was not wanting mixed languages across the code base.

      If you’re a Rust maintainer and you’re given a C patch (or reverse) then what do you do with it/confirm it’s not bringing other bugs.

      Other issues are that it’s heavier, hurts compatibility, and doesn’t function like C.

    • Jankatarch@lemmy.world
      link
      fedilink
      arrow-up
      18
      arrow-down
      1
      ·
      1 day ago

      The main real argument is that if new contributors write code and then leave for other projects then old contributors still have to maintain that code, a task that gets really hard when code is written in a different paradigm entirely.

    • lbfgs
      link
      fedilink
      arrow-up
      11
      ·
      1 day ago

      One big practical criticism is that it requires a different compiler which is supported on far fewer platforms than GCC

    • wonderingwanderer@sopuli.xyz
      link
      fedilink
      arrow-up
      7
      arrow-down
      2
      ·
      1 day ago

      What’s the advantage of GPL? As far as I’m aware MIT and Apache are both FOSS. But I’m new to this and still learning.

      I don’t know what the big deal about Rust is. It seems like a cool language to me…

      • PlexSheep@infosec.pub
        link
        fedilink
        arrow-up
        15
        ·
        21 hours ago

        MIT: do whatever you want, I don’t care

        GPL: You can modify this freely, but your product must also be FOSS if you modify this.

      • TrivialBetaState@sopuli.xyz
        link
        fedilink
        arrow-up
        27
        ·
        1 day ago

        GPL enforces that all derivatives are FOSS and GPL as well. With permissive licenses, like MIT and Apache, a company is free to take the code, change/develop it further (or leave it as is) and make it closed-sourced without sharing anything with anyone. Regarding Rust, I am with you. Hence my question.

        • wonderingwanderer@sopuli.xyz
          link
          fedilink
          arrow-up
          5
          arrow-down
          2
          ·
          1 day ago

          I see. That makes sense.

          So if the kernel were written in a language licensed under GPL, for instance, Ubuntu would either have to ditch their proprietary blobs or make their own kernel?

          If I had to guess, the only reason Rust might be controversial to some people is probably because they’re used to C and likely set in their ways. Someone who’s been programming since the 80s and doesn’t want to learn a new language cause maybe they’ll feel like a newbie again and can’t be smug about knowing every possible command in C anymore. Just a guess…

          • [object Object]@lemmy.world
            link
            fedilink
            arrow-up
            5
            ·
            edit-2
            21 hours ago

            The kernel is licensed under GPL, specifically only version 2. And it can’t be relicensed, since it contains code from many people. The poster above is complaining about command-line utilities that are being rewritten in Rust.

            Binary-only modules can be used with the kernel, because they don’t use the kernel’s source, only the API or a GPL middleware is made that is compiled with kernel header files, but provides an intermediary API for the binaries. I’m not quite versed in what exactly is allowed and prohibited by GPL.

            Edit: Linux-syscall-note explicitly places the boundary of ‘derivative works’ at syscalls — so userspace programs aren’t considered derivative and don’t have to be licensed under GPL, but kernel modules are.

          • TrivialBetaState@sopuli.xyz
            link
            fedilink
            arrow-up
            8
            ·
            1 day ago

            I’m pretty sure that code written in any language can be licensed under the GPL. That’s why I cannot understand the backlash against Rush for the Kernel.

            • Kushan@lemmy.world
              link
              fedilink
              English
              arrow-up
              3
              arrow-down
              3
              ·
              1 day ago

              I don’t understand the backlash against using an MIT/Apache licence at all. Those licenses are far more permissive than GPL but completely compatible.

              The only downside is that someone could fork the code and close source it, but the original code still remains available and that’s where the community will stay.

              • TrivialBetaState@sopuli.xyz
                link
                fedilink
                arrow-up
                9
                ·
                1 day ago

                A lot of things can go wrong. A company can take the free code, change it slightly to work only with a proprietary file type and then use their resources to promote their version and make their proprietary filetype and proprietary program the industry standard. Unfortunately this sounds too familiar. There are even cases that the filetype is an open standard but obfuscated to make it impossible for anyone (including the original FOSS) to open/save it.

              • FooBarrington@lemmy.world
                link
                fedilink
                arrow-up
                6
                ·
                edit-2
                19 hours ago

                It’s pretty much undeniable that the GPL has been a massive driving force behind companies giving back to projects, and it’s similarly undeniable that MIT-licensed projects have fewer comparable contributions.

                Sure, the community can stay on the open version, but it will still be companies mostly taking without giving back.

              • [object Object]@lemmy.world
                link
                fedilink
                arrow-up
                4
                ·
                1 day ago

                Iirc GPL is how we have OpenWRT. Because a company used Linux in their routers, but forgot to release the code initially until sued by FSF or whomever.

                Imagine, for example, that your phone has forks of Linux utilities with mysterious closed-source functionality added here and there. And you’d need to reverse-engineer that functionality to have LineageOS and such, instead of just taking the source-code.

                Proprietary apps are prone to enshittification, and permissive licenses allow vendors to build their proprietary software on open-source software without giving anything in return.

  • kbal@fedia.io
    link
    fedilink
    arrow-up
    49
    ·
    2 days ago

    Okay fine, guess I really do need to learn (the rest of) Rust now.

  • lambalicious@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    19
    ·
    2 days ago

    Well, recalling from my experience with a lot of software products, they all tend to rust by around or shortly before version 7, so…

  • Lembot_0006
    link
    fedilink
    arrow-up
    4
    arrow-down
    46
    ·
    2 days ago

    Well, it is time to investigate Hurd more closely, I suppose.

      • Lembot_0006
        link
        fedilink
        arrow-up
        3
        arrow-down
        62
        ·
        2 days ago

        I don’t see any future for Rust and forcing such ugly language in the kernel might lead to problems.

        Linus is to blame here more than Rust. C++ would be much more straightforward and welcomed by the kernel community update from C. And Linus is afraid of C++.

        Rust will kill Linux if it persists there long enough .

        • [object Object]@lemmy.world
          link
          fedilink
          arrow-up
          9
          arrow-down
          1
          ·
          24 hours ago

          Solid bait there. 🍿

          “C++ would be straightforward and welcomed”, amazing lmao. How do you even come up with this.

        • RustySharp
          link
          fedilink
          arrow-up
          50
          arrow-down
          2
          ·
          2 days ago

          I don’t see any future for seatbelts, and forcing such an ugly implement in cars might lead to problems.

          Seatbelts will kill cars if it persists there long enough.

          • olympicyes@lemmy.world
            link
            fedilink
            English
            arrow-up
            16
            ·
            1 day ago

            The upper middle class family of a childhood friend refused to wear seatbelts (1980s) because mom was injured by her seatbelt in an accident. I remember being surprised at their approach to risk reduction.

            • tomenzgg@midwest.social
              link
              fedilink
              English
              arrow-up
              2
              ·
              13 hours ago

              My dad knew someone who survived a car crash because he went through the windshield because he wasn’t wearing a seatbelt and, if he had, he would’ve been trapped in the car and (in this particular crash) died; he refuses to wear a seatbelt since.

              My father was, likewise, surprised.

          • ByteJunk@lemmy.world
            link
            fedilink
            arrow-up
            18
            arrow-down
            1
            ·
            2 days ago

            I don’t see any future for halos in F1 cars, and forcing such an ugly implement in cars might lead to problems.

            Halos will kill F1 if they persist there long enough.

            • RustySharp
              link
              fedilink
              arrow-up
              2
              ·
              1 day ago

              Haha I was fully expecting this comment when I wrote it. Hi fellow c/fuckcars lurker 👋🏽

        • arcterus@piefed.blahaj.zone
          link
          fedilink
          English
          arrow-up
          32
          arrow-down
          2
          ·
          2 days ago

          I don’t see any future for C++ and forcing such ugly language in the kernel might lead to problems.

          Lembot_0006 is to blame here more than C++. Zig/D/Hare/whatever would be much more straightforward and welcomed by the kernel community update from C. And Lembot_0006 is afraid of Rust.

          C++ will kill Linux if it persists there long enough .

          • wonderingwanderer@sopuli.xyz
            link
            fedilink
            arrow-up
            5
            ·
            1 day ago

            I don’t see any future for Zig/D/Hare and forcing such ugly language in the kernel might lead to problems.

            Arcterus is to blame here more than Zig/D/Hare. Fennel would be much more straightforward and welcomed by the kernel community update from C. And Arcterus is afraid of Fennel.

            Zig/D/Hare will kill Linux if it persists there long enough .

            • lad
              link
              fedilink
              English
              arrow-up
              3
              ·
              22 hours ago

              Sounds interesting:

              Fennel is a programming language that brings together the simplicity, speed, and reach of Lua with the flexibility of a lisp syntax and macro system.

              • [object Object]@lemmy.world
                link
                fedilink
                arrow-up
                2
                ·
                11 hours ago

                Lua itself is great, it runs circles around Python in speed even without LuaJIT, and especially the startup time is almost nonexistent, which is important for scripting. Lisp adds convenience like having everything be an expression and the ability to stick an (if) anywhere for a ternary. And since Lua is so snappy, Fennel has no noticeable overhead. Iirc the Lisp code is compiled to Lua, so long-term there’s practically no overhead at all.

                Although it’s been a while since I’ve used Fennel, so don’t remember if it has any nasty limitations.

                There’s also a similar thing for Python, called Hy.

              • wonderingwanderer@sopuli.xyz
                link
                fedilink
                arrow-up
                1
                ·
                19 hours ago

                It does sound interesting, but I was mostly joking just to extend the copypasta.

                I don’t know enough about programming to know whether it’s even suitable for writing a kernel. As far as I’m aware, Lua is mostly used for embedding scripts like in games, but the engines themselves are better written in C or Rust. I would assume a similar concept applies for writing a Kernel.

                Perhaps it would have made more sense if I said Fortran or PS-Algol. It would have been more clear that it was a shitpost

                • [object Object]@lemmy.world
                  link
                  fedilink
                  arrow-up
                  2
                  ·
                  11 hours ago

                  Lua doesn’t have capabilities for direct access to the memory and such, and those would need to be added by either embedding Lua in C or modifying the interpreter, which is, of course, written in C. So it’s indeed mostly for scripting. Although there’s a game engine/framework Löve, where the entire game can be written in Lua.

                • lad
                  link
                  fedilink
                  English
                  arrow-up
                  1
                  ·
                  17 hours ago

                  I expect it’s not suited for kernel, yeah, but it sounds like a fun thing to try other than for kernel stuff

        • tyler
          link
          fedilink
          arrow-up
          37
          arrow-down
          1
          ·
          2 days ago

          This has to be one of the most brain dead comments I’ve read about Linux…. ever.

          • bitcrafter
            link
            fedilink
            arrow-up
            22
            ·
            1 day ago

            I think you mean: it is one of the most brain dead comments you have ever hurd about Linux.