by blueflow · 1y ago · 0 comments
The first comment on LWN is about a bug in the more(1) from uutils. I checked out that code, found some oddities (like doing stat() on a path to check if it exists, right before open()ing it) and went to check against how GNU coreutils does it.
Turns out coreutils does not do it at all, because more(1) is from util-linux. ta-dam.
There are a lot of GNU utils. For now, Ubuntu is only taking on the ones that are actually in coreutils. Those are the ones that uutils considers "production ready".
Wouldn't this imply that these aren't actually 1:1 replacements?
This would seem to be one of the driving factors in the creation of oxidizr: to allow testing how ready the components are to be drop in replacements with easy recourse. You can read more about that in this section of the linked blog post by jnsgruk https://discourse.ubuntu.com/t/carefully-but-purposefully-ox...
uutils aims to be a drop-in replacement for the GNU utils. Differences with GNU are treated as bugs.
-- https://github.com/uutils/coreutils?tab=readme-ov-file#goalsTheir goals are to _replace GPL's code_. It's a subtle attack on Free Software by providing corporations a workaround so they don't have to abide by the terms of the license.
Nobody seriously doubts the efficiency or safety of the GNU Coreutils. They've been battle tested for over 30 years and whatever safety or optimization risks are left are negligible.
However the TOCTOU is completely benign here. It's just an extra check before Rust opens the file so if you were to try to "exploit" it the only thing that would happen is you get a different error message.
Can't reproduce this. If I do
sudo strace -e inject=stat:delay_exit=30s:when=2 ./coreutils more foo
on one terminal and rm foo
ln -s /etc/passwd foo
on another, I can see the contents of /etc/passwd on the first one. ln -s /etc/passwd foo
sudo more foo
OMG! The original version is "vulnerable" too!(I did not know about that strace feature though - that is very cool, thanks!)