top | item 23059477

Re: Integrating "safe" languages into OpenBSD? (2017)

319 points| xnyt | 5 years ago |marc.info | reply

389 comments

order
[+] staticassertion|5 years ago|reply
This is less "On Rust" and more "On accepting a rewrite of any tool into OpenBSD, on the merits of memory safety alone".

There isn't really much of a statement or judgment on Rust. At most there's an interesting point on it's value proposition:

> However there is a rampant fiction that if you supply a new safer method everyone will use it. For gods sake, the simplest of concepts like the stack protector took nearly 10 years for adoption, let people should switch languages? DELUSION.

This is mostly true. Developers in particular don't generally care about security, so selling Rust as a "secure" language is not going to be enough. I've said this since 1.0. But it's not entirely true for products, which often drive development - Chrome's pairing of performance and security led to tons of marketing wins.

Given that tools like "cat" etc are:

a) Not generally security sensitive

b) Target developers

I don't see anyone choosing the "rust cat" over the builtin. This is why people build tools like "bat", that aren't just memory safe copies, but they're memory safe tools that add features and target slightly different cases.

Not much else to get from this post, I think.

[+] throwaway894345|5 years ago|reply
Yeah. Not sure about BSD, but I was wading into building the GNU coreutils and other GNU packages just yesterday. Fresh hell, they all seem to be build dependencies of each other. ‘sed’ is its own build dependency.

The whole C ecosystem is a joke with respect to builds—all dependencies are implicit; you’re just expected to have the exact dependencies installed on your system at the exact versions and in the exact locations on the filesystem that the build tooling is willing to look. Autotools and CMake are absolutely terrible; they make Python’s build ecosystem look sane and well-designed.

So no, “security” isn’t the most compelling use case (for me, anyway), it’s moving past these dumpster fire build systems as quickly as possible so mere mortals can build their own software. Specifically, hasten the day where my entire application dependency tree doesn’t bottom out in some Autotools, CMake, shell script, project.

[+] hvs|5 years ago|reply
This is pretty much a judgment of Rust:

  Such ecosystems come with incredible costs.  For instance,
  rust cannot even compile itself on i386 at present time
  because it exhausts the address space.

  Consider me a skeptic -- I think these compiler ecosystems
  face a grim bloaty future.
I would think that OpenBSD developers/users would care about security, since that's pretty much the value-proposition of OpenBSD.
[+] hedora|5 years ago|reply
> Developers in particular don't generally care about security, so selling Rust as a "secure" language is not going to be enough.

You do realize that OpenBSD is, by far, the most secure general purpose operating system specifically due to decades of thankless work by people like Theo de Raadt, right?

I don’t think healthy skepticism of Rust is strong enough evidence to conclude that they don’t care about security.

[+] fluffything|5 years ago|reply
> Developers in particular don't generally care about security,

Bad developers don't, but many developers do. The Rust project itself has hundreds of contributors, to the point that it feels that it has more contributors than LLVM itself (I work on both, and this is an unbacked feeling I get from the velocity of the contributions).

Point being, if developers wouldn't care about Rust, they wouldn't be developing it.

[+] bluejekyll|5 years ago|reply
I like bat more than cat, not because it’s memory safe, but because it’s benefiting from the entire Rust ecosystem and provides features I enjoy that cat does not have.

It’s not always security, but that’s always a plus (though I have no idea if bat is any more secure than cat). I can make the same statement about exa and many of the other tools that are getting better in the Rust suite of CLI tools.

[+] stcredzero|5 years ago|reply
However there is a rampant fiction that if you supply a new safer method everyone will use it.

A fiction indeed. This is how developers actually behave. If you build a better mousetrap, lots of developers will all too quickly give you n reasons why it's terrible, and why you won't be able to pry their (punch cards/assembler/compiler/favorite-language/favorite-tool) out of their cold, dead hands.

This has been true, literally since the modern era of computer programming began in the middle of the last century, and it shows no signs of abating.

[+] black_puppydog|5 years ago|reply
Anecdata to the rescue: since installing ripgrep, my use of grep has plummeted. If I ever use it, it's because it comes as part for a copy/paste command I'm running.
[+] rurban|5 years ago|reply
A lot is missing also.

First he doesn't know about ripgrep, which is far better than GNU or BSD grep.

Second,none of the known grep's can find unicode strings. Redhat carried along the uni patches for a while, but when people complained about performance on the new utf8 locales, they dropped it. coreutils is still missing unicode support, so we don't find equivalent strings with different bytes. No normalization, no fold casing. Rust based coreutils could solve that, because they have the proper libs which are better than in C land and could survive the perf critics.

Third, rust is not secure. Just more secure than C. Memory safety, thread safety and type safety are lies. People buy it, but Theo should know.

[+] utborin|5 years ago|reply
In a thread about OpenBSD,

> Developers in particular don't generally care about security

Thanks, now I have to clean a mouthful of coffee off my screen!

[+] benibela|5 years ago|reply
> This is less "On Rust" and more "On accepting a rewrite of any tool into OpenBSD, on the merits of memory safety alone".

If people wanted memory safety so much, they could have done that years ago with Java

[+] bsdubernerd|5 years ago|reply
It also doesn't help that Rust keeps on pushing on the idea that "static linking is the only way to go". This is another cargo-cult which I wish didn't end up being engrained so deep in the toolchain because while it has some merits, it also has significant drawbacks of a typical unix distribution.

Static linking might be good for folks distributing a single server binary over a fleet of machines (pretty much like Go's primary use case), or a company that only cares about a single massive binary containing the OS itself (the browser), but it stops "being cool" very quickly on a typical *nix system if you plan to have hundreds of rust tools lying around.

Size _matters_ once you have a few thousands binaries on your system (mine has short of 6k), think about the memory requirements of caching vs cold-starting each, and running those and how patching for bug or vulnerabilities will pan out. There's a reason dynamic linkage was introduced and it's _still_ worth it today.

And rebuilding isn't cheap in storage requirements either: a typical cargo package will require a few hundred megabytes of storage, likely for _each_ rebuild.

Two days ago I rebuilt the seemingly innocuous weechat-discord: the build tree takes about 850mb on disk, with a resulting binary of 30mb. By comparison, the latest emacs binary from git rebuilds in a 1/10 of the time with all the features enabled, the build tree weights 150mb (most of which are lisp sources+elc) with a results in a binary of 9mb, not stripped.

[+] dathinab|5 years ago|reply
Let's try to summarize what he tries to say but kinda doesn't do very well:

_Rust and OpenBSD are not a good fit._

OpenBSD keeps to certain aspects about how to do thinks which just don't work well with rust. This doesn't mean they are better or worse. They are just different.

For example outside of rustc-dev hardly anyone compiles rust them self. As such not many work on making rust compile itself on exotic systems (and yes in 2020 i386 is a exotic system, even through it was the standard in the past). I mean improving cross compilation is for now much more important (as far as I can tell).

But OpenBSD requires the ability to self compile and support hardware for a very long time so rust (for now) doesn't fit.

Another example is that many rewrites of classical small tools provide little value to anyone _if_ they are 100% compatible. As such they tend _to not be compatible_ in favor of better interfaces/output etc. (E.g. ripgrep!!)

Lastly OpenBSD is stuck in a world where thinks move very slow. But this is also why many people use it. One the other hand rust is from a world where thinks move much faster, sure with small steps and backward compatibility but a small step every 6 weeks is still a lot over a fiew years. So they just don't fit well together.

I also believe that in the future they might fit well together at some point. But not for now and probably not in the next 3 or so years.

[+] jcranmer|5 years ago|reply
> I wasn't implying. I was stating a fact. There has been no attempt to move the smallest parts of the ecosystem, to provide replacements for base POSIX utilities.

This is in fact incorrect--there is a project aiming to build all of the coreutils in Rust (https://github.com/uutils/coreutils).

More to the point: while I do concur in the conclusion that Rust shouldn't be a part of the OpenBSD base system, the gatekeeping implied here (it's not a serious language because it's not used to build an operating system) is really toxic. Especially considering that the gate in question has already been thoroughly breached by the language in question (some universities have switched to using Rust in their OS courses, for example).

[+] cycloptic|5 years ago|reply
There is no gatekeeping. To actually achieve POSIX-compliance is not an easy task and requires lots of testing. If you don't do it then your replacement will break everyone's scripts. A distro maintainer will also want to retain compatibility with their supported GNU/BSD extensions so that's more work to add on.

I would still agree with his statement at least as far as BSD is concerned. Outside of Redox I haven't seen any serious projects to implement POSIX compatibility. The Rust coreutils project is a good start but from their readme it looks like they are more aiming to achieve GNU compatibility on Microsoft Windows while being MIT licensed — I don't think anyone is seriously using it to build a BSD (or even a GNU) distro. If I'm wrong about that I'd love to hear it though. Rust is a good choice to write these things in but let's be realistic about the time frame required to rewrite everything.

Plus I just downloaded those Rust coreutils and tried to build it and now I'm waiting for 400 (!!!) Rust dependencies to download and compile. Is this really appropriate for a core system component to have this many dependencies? Or is there something I'm missing here? I admit I am not familiar with best practices in Rust. As the project stabilizes I assume they will want to start eliminating the dependencies or vendoring them upstream? At what point do we decide to put these into a separate library like libbsd or gnulib?

[+] simias|5 years ago|reply
He's a maintainer, gatekeeping is literally his job. He's the one who decides what makes it in or not.

His reply is not great, but IMO posting to some venerable old project's ML saying, in the abstract and without actually having made any effort to analyze the issue in depth "Under what conditions would you consider replacing one of the current C implementations with an implementation written in another, "safer" language?" comes off as rather rude and not very productive IMO. I can understand him shutting it down immediately instead of wasting his time arguing with programming 101 students who cargo cult Rust without understanding the reality of maintaining something as complex as OpenBSD.

[+] asveikau|5 years ago|reply
Some substantive comments I read from the mail:

* It takes a long time for a rewrite to be fully compatible and a good implementation. This project says it uses the busybox tests and that seems like a good start. Is it good enough though? Busybox itself is quite good for certain embedded niches but it would be absurd to replace a good chunk of OpenBSD userland with that, the usability would suffer a lot.

* OpenBSD needs to compile itself, in reasonable time, and at the time of the writing rust was slower than C at this and could not self host on 32bit x86 due to address space limitations. Has it been fixed?

[+] creddit|5 years ago|reply
> the gatekeeping implied here (it's not a serious language because it's not used to build an operating system) is really toxic.

He's not gatekeeping in that way by saying that Rust isn't used to create OS utilities (which as an aside is what he actually says. He doesn't say anything about building an OS) and therefore isn't a serious language and therefore shouldn't be included in OpenBSD*. He's saying it's not used for making OS utilities and therefore has no specific use in OpenBSD that requires it to be in the toolchain. Very different points with the latter being pretty reasonable, imo.

[+] protomyth|5 years ago|reply
The post was written in 2017. How far along was the project in 2017.

Also, I am a bit confused about the gatekeeping implied here (it's not a serious language because it's not used to build an operating system) is really toxic.? Which line in the e-mail stated that?

[+] jcims|5 years ago|reply
I think it's OK for platforms to have principles and if those principles are going to yield anything of value you have to be fairly consistent and ruthless about them.

There was a little bit of editorializing there but if 'base builds base' is table stakes then start working on that coreutils project first.

[+] ajross|5 years ago|reply
> the gatekeeping implied here [...] is really toxic

It's Theo de Raadt, toxic rhetoric is sort of his brand.

But... he has a real point here. It's not about grep or cat or whatever really, those are just the use cases for which OpenBSD would care.

It's that as Rust is reaching the second decade of its history, and despite some outrageous wins in press, evangelism, and general developer mindshare... Rust just hasn't made much progress in replacing exactly the software that it claims to be intended to replace!

Where are the pervasively used compression libraries in Rust? Video and audio codecs? Network stacks? Database engines? System management utilities? PKI and encryption stacks? All that stuff is still in C. After ten years of Rust success!

It's not like no one is using Rust. It's not like it doesn't have success stories (even in the categories above). But they're comparatively rare, still. There's nothing in Rust that rises to the category of "stuff everyone just uses because it's what everyone uses" (c.f. zlib, libjpeg, readline...) yet.

And if there isn't after the first decade, what needs to change to make it happen in the second. I mean, is it maybe fair to say that the window is closing for rust to take over a significant fraction the systems programming world?

[+] skrebbel|5 years ago|reply
You make valid point, but you can't fault Theo for predicting a different future in 2017.
[+] gjvc|5 years ago|reply
There is nothing sinister being implied by wishing to maintain the course that the OpenBSD project has taken. This leadership may not please all of the people all of the time (least of all non-dependent external projects), and it has no obligation to do so.
[+] justin66|5 years ago|reply
Do any major Linux distros think uutils is good enough to ship as the default? Are they at all involved?

They'd be infinitely easier to persuade to try something like this than a BSD. For OpenBSD it's probably always going to be a non-starter because of all the hardware they'd have to leave behind.

[+] notaplumber|5 years ago|reply
BSD does not use GNU coreutils. Is it really unexpected that the developer of a BSD project might have been unaware at the time of a project attempting to replace it, or simply found it incompatible with the stated requirements-- POSIX compliant base utilities. OpenBSD does not care about compatibility with GNU, for example longopts do not work for many utilities, with exceptions to permissive replacements to historically used GNU utilities (grep example).

It also does not address the concerns of higher build times compared the contemporary C counterparts, which also support far more platforms than Rust.

The use of cargo for example suggests that at least a few uu utilities makes network connections at build time to fetch dependencies!

For example something as simple as chown:

https://github.com/uutils/coreutils/blob/master/src/uu/chown...

[+] gdy|5 years ago|reply
>the gatekeeping implied here is really toxic

The words 'gatekeeping' and 'toxic' are toxic.

[+] zdw|5 years ago|reply
Linked mailing list message is from 2017, which is may be after when the linked project was started/viable.
[+] pjmlp|5 years ago|reply
Not only that, there are several POSIX implementations in Ada.

They just don't get exposure in FOSS land.

[+] dirtydroog|5 years ago|reply
Is it 'really toxic', or just uninformed? Note that the email conversation was from a few years ago.
[+] dathinab|5 years ago|reply
Not only does coreutils exist there is also another think which shouldn't be forgotten.

When you re-write a tool, _why not improve it_? (Especially if the chance that the 100% backwards compatible rewrite will not be accepted anyway).

For a bunch of tools exactly this happens, a new tool which provides the (roughly) functionality but a new (IMHO often better) interface, slightly different options or syntax (for got reasons). Etc.

An example for this is ripgrep (rg), which already became a widely used replacement for grep. It's just not a drop in replacement. (It couldn't do what it does if it would be).

[+] zdw|5 years ago|reply
As with most things Theo says, they're aligned with being the right answer for OpenBSD's niche, which is probably not your niche.

Any new tools that have high resource needs, don't support all the more exotic/esoteric platforms that it supports, are all nonstarters if your goal is a very small core system that compiles quickly on all supported platforms.

[+] all_blue_chucks|5 years ago|reply
Yes but if he had an iota of social intelligence he would say "it is an interesting project but it is not nearly ready for inclusion in OpenBSD for reasons X, Y, and Z."

Instead he personally attacks people.

[+] wyldfire|5 years ago|reply
> However there is a rampant fiction that if you supply a new safer method everyone will use it. For gods sake, the simplest of concepts like the stack protector took nearly 10 years for adoption, let people should switch languages? DELUSION.

Yeah, I agree: if the sole value proposition were 'security' it would be a really slow roll. cargo is the killer app IMO. Anyone who's walked a big dependency tree - download, build, oh oops this requires libfoo - download, build, oh oops that requires libbar...

But I think lots of coders land on rust because they want or need something faster or more portable than Python or JS and rust is 'easier' than C.

[+] dorfsmay|5 years ago|reply
This is from 2017.

In 2020 I personally use ag 99% of the time, and when I do use grep is because its options are burned in my brain and it saves me 30 seconds by not looking up the equivalent for ag.

https://github.com/ggreer/the_silver_searcher

[+] nromiun|5 years ago|reply
> Adding such a toolchain would take make build time from 40 minutes to hours. I don't see how that would happen.

This should have been at the top of the email because this is the main issue (along with the i386 one). As other people have noted in this thread some people have already re-written basic utilities in Rust (and other languages).

Unless someone manage to make the Rust compiler much much faster then it is currently it won't get accepted into OpenBSD anytime soon.

[+] protomyth|5 years ago|reply
Such ecosystems come with incredible costs. For instance, rust cannot even compile itself on i386 at present time because it exhausts the address space.

Is this true anymore or just a history note?

[+] enz|5 years ago|reply
This is not "de Raadt on Rust". There isn’t any de Raadt’s opinion on Rust.

This is Theo de Raadt on integrating Rust utilities in OpenBSD.

[+] Zenst|5 years ago|reply
Interesting read and raises one big issue:

We need to make memory safe languages accessible and with that, the tools and other frameworks for a new language isn't an easy path.

Which gets to an aspect in many walks of life - if you are doing something from scratch - you can use the latest knowledge and enforce that, but knowledge moves on and bringing up the rest of the system inline with a what is needed to use that new language/knowledge is not an overnight task, it's a slow process - and even if you provide something better, you can not guarantee it will be embraced at a needed pace to keep the momentum going.

Much like anything in life, you have better trains than you did when they was invented, but legacy infrastructure precludes an instant/overnight switch, due to impact upon what is used currently.

So case of, requirements for something better like rust support, is a bit of a catch-22 as you need it there to get the people to use it so tools get written, but to get it there you kinda need the tools so that people use it to write the tools. Hence the first step is always the biggest.

Which makes you wonder how intertwined aspects of the OS and programs are, even with standards like POSIX, there is clearly a bigger larger standard needed.

This along with the dependances and you can see why docker and other application level virtualization has much going for it.

[+] SergeAx|5 years ago|reply
> For instance, rust cannot even compile itself on i386 at present time because it exhausts the address space.

Wow, that one was really cruel.

[+] raggi|5 years ago|reply
Working on an operating system that uses some of these modern / safer alternatives, the concerns around bootstrapping, lack of spec, lack of formal memory model, long compile times, and larger output binaries are valid. They are real and present challenges for us, that we choose to work against. It is currently extremely difficult to produce a binary of the size of bsd cat using these technologies, and very large amounts of work are needed to close that gap, if it even can be.

In a new system you may not need cat though, but if you're a unix system with a heavy shell and textual basis, you do need lightweight versions of these things - light to build, light to run, and well integrated into the environment.

What's the path out for unix systems? I have no idea, but at least as of today I have not seen a modern safe language that is ready to replace unix use cases. Maybe zig? It's hello world is at least under 10kb.

[+] BearOso|5 years ago|reply
I want to like the rust language. The syntax is nice and the features are interesting.

My problem is the ecosystem. The packaging and build system clearly isn’t designed to accommodate classic desktop applications. The FFI is really painful, and even Firefox has tons of wrapper code to just integrate with the libraries it needs to have a GUI.

In that respect I agree with Theo in that Rust developers are focusing on far too narrow of a use case, mostly web facing applications or data processing. Cargo being so similar to npm kind of confirms this. Rust isn’t intended for me.

[+] maallooc|5 years ago|reply
Feels like I've just had a coke. Nice reply from Theo.