Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. The coreutils Rust rewrite story is pretty funny.

The coreutils Rust rewrite story is pretty funny.

Scheduled Pinned Locked Moved Uncategorized
47 Posts 27 Posters 173 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • lcamtuf@infosec.exchangeL lcamtuf@infosec.exchange

    The coreutils Rust rewrite story is pretty funny.

    Coreutils are tools like rm, mv, mkdir, etc. Unlike binutils, this isn't a fertile ground for memory safety bugs. But, the rewrite was completed, and in the spirit of progress, Canonical decided to switch.

    But do you know what coreutils are a fertile ground for? Race conditions around file creation, deletion, permission setting, and so on. The original code accounted for decades of hard-learned lessons in that space. The Rust rewrite did not:

    Link Preview Image
    oss-sec: uutils coreutils CVEs

    favicon

    (seclists.org)

    PS. I'm not dunking on Rust. It's just that... starting over from scratch has its hidden costs.

    klausman@mas.toK This user is from outside of this forum
    klausman@mas.toK This user is from outside of this forum
    klausman@mas.to
    wrote last edited by
    #25

    @lcamtuf There's also that human habit of getting complacent about all bugs when _some_ types of bugs are either impossible or very very hard to make because of language structure and tooling.

    1 Reply Last reply
    0
    • lcamtuf@infosec.exchangeL lcamtuf@infosec.exchange

      The coreutils Rust rewrite story is pretty funny.

      Coreutils are tools like rm, mv, mkdir, etc. Unlike binutils, this isn't a fertile ground for memory safety bugs. But, the rewrite was completed, and in the spirit of progress, Canonical decided to switch.

      But do you know what coreutils are a fertile ground for? Race conditions around file creation, deletion, permission setting, and so on. The original code accounted for decades of hard-learned lessons in that space. The Rust rewrite did not:

      Link Preview Image
      oss-sec: uutils coreutils CVEs

      favicon

      (seclists.org)

      PS. I'm not dunking on Rust. It's just that... starting over from scratch has its hidden costs.

      groxx@hachyderm.ioG This user is from outside of this forum
      groxx@hachyderm.ioG This user is from outside of this forum
      groxx@hachyderm.io
      wrote last edited by
      #26

      @lcamtuf a related observation would probably be: why did important, security-critical edge cases get handled without enough documentation to prevent them from reoccurring?

      1 Reply Last reply
      0
      • lcamtuf@infosec.exchangeL lcamtuf@infosec.exchange

        The coreutils Rust rewrite story is pretty funny.

        Coreutils are tools like rm, mv, mkdir, etc. Unlike binutils, this isn't a fertile ground for memory safety bugs. But, the rewrite was completed, and in the spirit of progress, Canonical decided to switch.

        But do you know what coreutils are a fertile ground for? Race conditions around file creation, deletion, permission setting, and so on. The original code accounted for decades of hard-learned lessons in that space. The Rust rewrite did not:

        Link Preview Image
        oss-sec: uutils coreutils CVEs

        favicon

        (seclists.org)

        PS. I'm not dunking on Rust. It's just that... starting over from scratch has its hidden costs.

        arcaik@hachyderm.ioA This user is from outside of this forum
        arcaik@hachyderm.ioA This user is from outside of this forum
        arcaik@hachyderm.io
        wrote last edited by
        #27

        @lcamtuf Why do we keep calling uutils coreutils a rewrite?

        1 Reply Last reply
        0
        • rmq@toot.ioR rmq@toot.io

          @synlogic4242 Uutils started as someone’s personal project to learn rust, and “write a system utility” is frequently used as a basic exercise for learning. Uutils is doing exactly what it set out to do.

          It’s not the fault of uutils that Canonical is dumb.

          @lcamtuf

          synlogic4242@social.vivaldi.netS This user is from outside of this forum
          synlogic4242@social.vivaldi.netS This user is from outside of this forum
          synlogic4242@social.vivaldi.net
          wrote last edited by
          #28

          @rmq @lcamtuf I view it as both their fault. I'm pissed that after having to deal with Copy.Fail I now have to wipe other people's butts again for them. and I worry this will happen with more frequency as more vibe-coded software spreads around

          1 Reply Last reply
          0
          • lcamtuf@infosec.exchangeL lcamtuf@infosec.exchange

            The coreutils Rust rewrite story is pretty funny.

            Coreutils are tools like rm, mv, mkdir, etc. Unlike binutils, this isn't a fertile ground for memory safety bugs. But, the rewrite was completed, and in the spirit of progress, Canonical decided to switch.

            But do you know what coreutils are a fertile ground for? Race conditions around file creation, deletion, permission setting, and so on. The original code accounted for decades of hard-learned lessons in that space. The Rust rewrite did not:

            Link Preview Image
            oss-sec: uutils coreutils CVEs

            favicon

            (seclists.org)

            PS. I'm not dunking on Rust. It's just that... starting over from scratch has its hidden costs.

            E This user is from outside of this forum
            E This user is from outside of this forum
            equity7804@hostux.social
            wrote last edited by
            #29

            @lcamtuf Hey, would you care to elaborate or point me to resources explaining why the coreutils aren't fertile ground for memory safety issues? It's the first time I heard of this

            1 Reply Last reply
            0
            • lcamtuf@infosec.exchangeL lcamtuf@infosec.exchange

              The coreutils Rust rewrite story is pretty funny.

              Coreutils are tools like rm, mv, mkdir, etc. Unlike binutils, this isn't a fertile ground for memory safety bugs. But, the rewrite was completed, and in the spirit of progress, Canonical decided to switch.

              But do you know what coreutils are a fertile ground for? Race conditions around file creation, deletion, permission setting, and so on. The original code accounted for decades of hard-learned lessons in that space. The Rust rewrite did not:

              Link Preview Image
              oss-sec: uutils coreutils CVEs

              favicon

              (seclists.org)

              PS. I'm not dunking on Rust. It's just that... starting over from scratch has its hidden costs.

              sten@chaos.socialS This user is from outside of this forum
              sten@chaos.socialS This user is from outside of this forum
              sten@chaos.social
              wrote last edited by
              #30

              @lcamtuf Not only that, some of the utils were not command line-compatible with their non-Rust counterparts.

              Honestly, I don't understand why these utils were rewritten. They didn't need rewriting.

              1 Reply Last reply
              0
              • lcamtuf@infosec.exchangeL lcamtuf@infosec.exchange

                The coreutils Rust rewrite story is pretty funny.

                Coreutils are tools like rm, mv, mkdir, etc. Unlike binutils, this isn't a fertile ground for memory safety bugs. But, the rewrite was completed, and in the spirit of progress, Canonical decided to switch.

                But do you know what coreutils are a fertile ground for? Race conditions around file creation, deletion, permission setting, and so on. The original code accounted for decades of hard-learned lessons in that space. The Rust rewrite did not:

                Link Preview Image
                oss-sec: uutils coreutils CVEs

                favicon

                (seclists.org)

                PS. I'm not dunking on Rust. It's just that... starting over from scratch has its hidden costs.

                ireneista@adhd.irenes.spaceI This user is from outside of this forum
                ireneista@adhd.irenes.spaceI This user is from outside of this forum
                ireneista@adhd.irenes.space
                wrote last edited by
                #31

                @lcamtuf yeah it's frustrating because in some sense we all had the opportunity to learn this lesson, a long time ago

                we remember when we were kids, after Netscape went bankrupt trying to re-write their software from scratch, there were some good essays analyzing what went wrong and advocating for refactoring instead so as not to lose the knowledge that's in the code

                and then there's the ATC system

                like... there's so many past instances to learn from

                ireneista@adhd.irenes.spaceI 1 Reply Last reply
                0
                • ireneista@adhd.irenes.spaceI ireneista@adhd.irenes.space

                  @lcamtuf yeah it's frustrating because in some sense we all had the opportunity to learn this lesson, a long time ago

                  we remember when we were kids, after Netscape went bankrupt trying to re-write their software from scratch, there were some good essays analyzing what went wrong and advocating for refactoring instead so as not to lose the knowledge that's in the code

                  and then there's the ATC system

                  like... there's so many past instances to learn from

                  ireneista@adhd.irenes.spaceI This user is from outside of this forum
                  ireneista@adhd.irenes.spaceI This user is from outside of this forum
                  ireneista@adhd.irenes.space
                  wrote last edited by
                  #32

                  @lcamtuf and then there's... well, there's a persistent feeling that starting over without regard for the past will make things better, rather than just repeating the same fundamental mistake that happened the first time

                  we've felt it too. it's a powerful pull.

                  we wrote a bit about that feeling, a while back https://irenes.space/leaves/2024-09-29-technology-community-idealism

                  doomed_daniel@mastodon.gamedev.placeD 1 Reply Last reply
                  0
                  • ireneista@adhd.irenes.spaceI ireneista@adhd.irenes.space

                    @lcamtuf and then there's... well, there's a persistent feeling that starting over without regard for the past will make things better, rather than just repeating the same fundamental mistake that happened the first time

                    we've felt it too. it's a powerful pull.

                    we wrote a bit about that feeling, a while back https://irenes.space/leaves/2024-09-29-technology-community-idealism

                    doomed_daniel@mastodon.gamedev.placeD This user is from outside of this forum
                    doomed_daniel@mastodon.gamedev.placeD This user is from outside of this forum
                    doomed_daniel@mastodon.gamedev.place
                    wrote last edited by
                    #33

                    @ireneista @lcamtuf
                    I guess that could work if you really investigate all the fundamental mistakes, as well as the regular bugs/pitfalls, from the first time and try your best to avoid them.

                    Assuming that "it was written in a less safe language" was the only or even most important issue is.. not that useful

                    ireneista@adhd.irenes.spaceI 1 Reply Last reply
                    0
                    • doomed_daniel@mastodon.gamedev.placeD doomed_daniel@mastodon.gamedev.place

                      @ireneista @lcamtuf
                      I guess that could work if you really investigate all the fundamental mistakes, as well as the regular bugs/pitfalls, from the first time and try your best to avoid them.

                      Assuming that "it was written in a less safe language" was the only or even most important issue is.. not that useful

                      ireneista@adhd.irenes.spaceI This user is from outside of this forum
                      ireneista@adhd.irenes.spaceI This user is from outside of this forum
                      ireneista@adhd.irenes.space
                      wrote last edited by
                      #34

                      @Doomed_Daniel @lcamtuf yeah, exactly

                      ireneista@adhd.irenes.spaceI 1 Reply Last reply
                      0
                      • ireneista@adhd.irenes.spaceI ireneista@adhd.irenes.space

                        @Doomed_Daniel @lcamtuf yeah, exactly

                        ireneista@adhd.irenes.spaceI This user is from outside of this forum
                        ireneista@adhd.irenes.spaceI This user is from outside of this forum
                        ireneista@adhd.irenes.space
                        wrote last edited by
                        #35

                        @Doomed_Daniel @lcamtuf we firmly believe, for ourselves, that code is communication

                        and one very big thing it's communicating is: hey, future maintainer, this detail is important

                        doomed_daniel@mastodon.gamedev.placeD 1 Reply Last reply
                        0
                        • ireneista@adhd.irenes.spaceI ireneista@adhd.irenes.space

                          @Doomed_Daniel @lcamtuf we firmly believe, for ourselves, that code is communication

                          and one very big thing it's communicating is: hey, future maintainer, this detail is important

                          doomed_daniel@mastodon.gamedev.placeD This user is from outside of this forum
                          doomed_daniel@mastodon.gamedev.placeD This user is from outside of this forum
                          doomed_daniel@mastodon.gamedev.place
                          wrote last edited by
                          #36

                          @ireneista @lcamtuf
                          Additional fun thought: I can imagine they avoided looking at the GNU coreutils C implementation because they are using MIT license instead of GPL.

                          ireneista@adhd.irenes.spaceI 1 Reply Last reply
                          0
                          • doomed_daniel@mastodon.gamedev.placeD doomed_daniel@mastodon.gamedev.place

                            @ireneista @lcamtuf
                            Additional fun thought: I can imagine they avoided looking at the GNU coreutils C implementation because they are using MIT license instead of GPL.

                            ireneista@adhd.irenes.spaceI This user is from outside of this forum
                            ireneista@adhd.irenes.spaceI This user is from outside of this forum
                            ireneista@adhd.irenes.space
                            wrote last edited by
                            #37

                            @Doomed_Daniel @lcamtuf ouch. welp.

                            puppygirlhornypost2@transfem.socialP 1 Reply Last reply
                            0
                            • ireneista@adhd.irenes.spaceI ireneista@adhd.irenes.space

                              @Doomed_Daniel @lcamtuf ouch. welp.

                              puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                              puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                              puppygirlhornypost2@transfem.social
                              wrote last edited by
                              #38

                              @ireneista@adhd.irenes.space @lcamtuf@infosec.exchange @Doomed_Daniel@mastodon.gamedev.place Well there's always the ability for clean room implementation, no?

                              doomed_daniel@mastodon.gamedev.placeD 1 Reply Last reply
                              0
                              • puppygirlhornypost2@transfem.socialP puppygirlhornypost2@transfem.social

                                @ireneista@adhd.irenes.space @lcamtuf@infosec.exchange @Doomed_Daniel@mastodon.gamedev.place Well there's always the ability for clean room implementation, no?

                                doomed_daniel@mastodon.gamedev.placeD This user is from outside of this forum
                                doomed_daniel@mastodon.gamedev.placeD This user is from outside of this forum
                                doomed_daniel@mastodon.gamedev.place
                                wrote last edited by
                                #39

                                @puppygirlhornypost2 @lcamtuf @ireneista
                                sure, but needs more people, and some of them won't get to do the fun part (writing new code)

                                they could've looked at musl though, I assume it does not have the same bugs (but am too lazy to check)

                                puppygirlhornypost2@transfem.socialP 1 Reply Last reply
                                0
                                • doomed_daniel@mastodon.gamedev.placeD doomed_daniel@mastodon.gamedev.place

                                  @puppygirlhornypost2 @lcamtuf @ireneista
                                  sure, but needs more people, and some of them won't get to do the fun part (writing new code)

                                  they could've looked at musl though, I assume it does not have the same bugs (but am too lazy to check)

                                  puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                                  puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                                  puppygirlhornypost2@transfem.social
                                  wrote last edited by
                                  #40

                                  @Doomed_Daniel@mastodon.gamedev.place @lcamtuf@infosec.exchange @ireneista@adhd.irenes.space I think you mistook musl for BusyBox. I did the same thing in my head. (musl is an MIT-licensed C standard library implementation) It appears BusyBox (alternative to gnu coreutils) is also licensed under GPLv2, unfortunately.

                                  ireneista@adhd.irenes.spaceI fiore@brain.worm.pinkF 2 Replies Last reply
                                  0
                                  • puppygirlhornypost2@transfem.socialP puppygirlhornypost2@transfem.social

                                    @Doomed_Daniel@mastodon.gamedev.place @lcamtuf@infosec.exchange @ireneista@adhd.irenes.space I think you mistook musl for BusyBox. I did the same thing in my head. (musl is an MIT-licensed C standard library implementation) It appears BusyBox (alternative to gnu coreutils) is also licensed under GPLv2, unfortunately.

                                    ireneista@adhd.irenes.spaceI This user is from outside of this forum
                                    ireneista@adhd.irenes.spaceI This user is from outside of this forum
                                    ireneista@adhd.irenes.space
                                    wrote last edited by
                                    #41

                                    @puppygirlhornypost2 @lcamtuf @Doomed_Daniel ... wait, is BusyBox an alternative? we thought it was the same coreutils, just bundled in a single executable for deployment reasons?

                                    puppygirlhornypost2@transfem.socialP 1 Reply Last reply
                                    0
                                    • puppygirlhornypost2@transfem.socialP puppygirlhornypost2@transfem.social

                                      @Doomed_Daniel@mastodon.gamedev.place @lcamtuf@infosec.exchange @ireneista@adhd.irenes.space I think you mistook musl for BusyBox. I did the same thing in my head. (musl is an MIT-licensed C standard library implementation) It appears BusyBox (alternative to gnu coreutils) is also licensed under GPLv2, unfortunately.

                                      fiore@brain.worm.pinkF This user is from outside of this forum
                                      fiore@brain.worm.pinkF This user is from outside of this forum
                                      fiore@brain.worm.pink
                                      wrote last edited by
                                      #42

                                      @puppygirlhornypost2@transfem.social @lcamtuf@infosec.exchange @Doomed_Daniel@mastodon.gamedev.place @ireneista@irenes.space busybox is not an alternative to gnu coreutils , it doesnt care to be coreutils compatible .. uutils does (for some reason??)

                                      puppygirlhornypost2@transfem.socialP 1 Reply Last reply
                                      1
                                      0
                                      • R relay@relay.mycrowd.ca shared this topic
                                      • fiore@brain.worm.pinkF fiore@brain.worm.pink

                                        @puppygirlhornypost2@transfem.social @lcamtuf@infosec.exchange @Doomed_Daniel@mastodon.gamedev.place @ireneista@irenes.space busybox is not an alternative to gnu coreutils , it doesnt care to be coreutils compatible .. uutils does (for some reason??)

                                        puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                                        puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                                        puppygirlhornypost2@transfem.social
                                        wrote last edited by
                                        #43

                                        @fiore@brain.worm.pink @lcamtuf@infosec.exchange @Doomed_Daniel@mastodon.gamedev.place @ireneista@adhd.irenes.space I mean there's "alternative" and then there's "drop in replacement". I guess that was a linguistic issue on my part. I did not mean to imply busybox is supposed to be a remake of gnu coreutils. Some commands/programs/whatever (the windows sysadmin in me wants to say commandlets lol) of coreutils such as shuf are not available on busybox. I do see it advertised as a light weight alternative to gnu coreutils in server applications. Specifically when you don't need GNU coreutils-specific features

                                        puppygirlhornypost2@transfem.socialP 1 Reply Last reply
                                        0
                                        • puppygirlhornypost2@transfem.socialP puppygirlhornypost2@transfem.social

                                          @fiore@brain.worm.pink @lcamtuf@infosec.exchange @Doomed_Daniel@mastodon.gamedev.place @ireneista@adhd.irenes.space I mean there's "alternative" and then there's "drop in replacement". I guess that was a linguistic issue on my part. I did not mean to imply busybox is supposed to be a remake of gnu coreutils. Some commands/programs/whatever (the windows sysadmin in me wants to say commandlets lol) of coreutils such as shuf are not available on busybox. I do see it advertised as a light weight alternative to gnu coreutils in server applications. Specifically when you don't need GNU coreutils-specific features

                                          puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                                          puppygirlhornypost2@transfem.socialP This user is from outside of this forum
                                          puppygirlhornypost2@transfem.social
                                          wrote last edited by
                                          #44

                                          @fiore@brain.worm.pink @lcamtuf@infosec.exchange @Doomed_Daniel@mastodon.gamedev.place @ireneista@adhd.irenes.space iirc busybox is often used in initramfs and other light environments like containers. I mean, on my Gentoo desktop, I have the busybox module installed for dracut, so it's packed into my initramfs... but also that's not something that's default with the distribution.

                                          fiore@brain.worm.pinkF 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups