News for hackers. Stuff that matters.
Re:The Case for Rust in the base system by loeg on Sunday January 21, 2024 @02:05PM (#39081705)
To strongman the "anti" case: I believe that FreeBSD still nominally supports a number of architectures that have immature or no Rust support, which seems like a major blocker to (at least) rewriting major system components like devd in Rust. And build times are already a problem -- the joke five years ago was that the FreeBSD build was a wart on the side of Clang. Doubling that isn't ideal.

That said, I'm a big Rust believer and think it's the right tool for the job in a lot of situations where the historical answer was C or C++. Maybe it's the right tool for FreeBSD, too.

Re:The Case for Rust in the base system by raggi on Sunday January 21, 2024 @04:01PM (#39083009)
Yeah, the architecture point comes up in lost of rust in core type discussions, but I think when it comes to the BSD's it's actually a critical argument. I'm not particularly excited by limping along unusual architectures that most of the contributors can't perform reproductions on, but the BSD's are a bastion in this space and something probably has to be. Addressing this issue in both Rust and LLVM would be valuable at large.
Re:The Case for Rust in the base system by mike_hock on Sunday January 21, 2024 @04:50PM (#39083439)
Even arm32 and x86 are Tier 2. Not exactly unusual architectures. The only Tier 1 architectures are amd64 and arm64, i.e. only the absolute mainstream. Not exactly a bastion of architecture support.
Re:The Case for Rust in the base system by est31 on Sunday January 21, 2024 @07:40PM (#39084666)
> Even arm32 and x86 are Tier 2. Not exactly unusual architectures.

There is 32-bit x86 tier 1 targets like i686-unknown-linux-gnu.

> The only Tier 1 architectures are [...] only the absolute mainstream. Not exactly a bastion of architecture support.

Tier 1 means that the target has the full testsuite run against it for each single pull request. Running the CI is computationally extremely complex, and it is hard to provide a reliable and fast CI service for most architectures.

Re:The Case for Rust in the base system by mike_hock on Monday January 22, 2024 @12:35AM (#39086640)
I meant ... the FreeBSD tiers.
Re:The Case for Rust in the base system by raggi on Sunday January 21, 2024 @04:05PM (#39083051)
It seems actually FreeBSD has dropped a lot of old platforms in recent versions, so this may not be a problem anymore. I imagine it would be with some other BSD's.
Re:The Case for Rust in the base system by kjs3 on Sunday January 21, 2024 @06:39PM (#39084215)
This. FreeBSD probably shouldn't be held back by VAX or MC88k support, but I'd be really disappointed if NetBSD for example abandon them.
Re:The Case for Rust in the base system by boricj on Sunday January 21, 2024 @02:35PM (#39082080)
If these architectures can't muster enough manpower to keep up with modern toolchains then they are living on borrowed time. Maintainers of active, modern development projects have a limited tolerance for anachronism before they say "get a modern toolchain up and running or get left behind, we're sick and tired of C89".
Re:The Case for Rust in the base system by mrweasel on Sunday January 21, 2024 @03:06PM (#39082461)
I feel like that might leave embedded devices without an upgrade path, and those are the devices that needs to longest "warning". So yes, borrowed time, but that might be a decade.

That no to say that Rust shouldn't be considered, but maybe initially for new development or selective rewrites. Some of the mentioned, like nscd or devd in particular, shouldn't be that high on the list. The ZFSd should be fairly safe, as that's mainly needed on the larger platforms.

Re:The Case for Rust in the base system by patmorgan23 on Sunday January 21, 2024 @03:28PM (#39082704)
If those devices really need updates then the vendor can fork BSD and do the updates they need. It's not like the existing code will stop working on them.

This is also why we LTS versions.

Re:The Case for Rust in the base system by kelnos on Sunday January 21, 2024 @10:14PM (#39085757)
I feel like those are the kinds of devices that never get manufacturer updates anyway. And even if they did, the manufacturer likely is no longer supporting them.

Sure, it's nice to be able to tinker and hack to see if you can upgrade them yourselves, but is it worth maintaining architecture support for that kind of use case? Not asserting that is definitely not, but I think it's worth considering.

Re:The Case for Rust in the base system by duped on Sunday January 21, 2024 @02:46PM (#39082223)
If by "modern" you mean "LLVM" then I'm sure the chip vendors will get right on it when they have a GCC backend that works and all of their customers use it.
Re:The Case for Rust in the base system by boricj on Sunday January 21, 2024 @03:13PM (#39082544)
There is a Rust front-end for GCC that is under active development [1]. If the chip vendors are not willing to develop and upstream a LLVM back-end then they can start contributing to it as an alternative.

[1] https://rust-gcc.github.io/

Re:The Case for Rust in the base system by refulgentis on Sunday January 21, 2024 @03:21PM (#39082628)
> If the chip vendors are not willing to develop and upstream a LLVM back-end

oh, my sweet summer child...

Re:The Case for Rust in the base system by duped on Sunday January 21, 2024 @05:38PM (#39083816)
You've got the prioritization backwards
Re:The Case for Rust in the base system by pharmakom on Sunday January 21, 2024 @03:11PM (#39082513)
What if Rust compiled to C? Wouldn’t that be a good way to support long tail platforms with low effort?
Re:The Case for Rust in the base system by jcranmer on Sunday January 21, 2024 @04:40PM (#39083357)
Not necessarily. C isn't a great language to target, since it's full of fun undefined behavior quirks that you will trip over if you look at it slightly cross-eyed. And part of the problem with the long tail platforms is that they can have issues that you don't expect (e.g., function pointers and data pointers might have different representation!).

So the main set of platforms you're looking at are ones that are functional enough to have modern, stable C compilers, aren't too quirky that reasonably portable C code would "just" work, and yet ones that you don't already have support for in Rust. Outside of the embedded space, there's like... fewer than 5 architectures left, the most notable of which probably being Alpha.

Re:The Case for Rust in the base system by midmagico on Sunday January 21, 2024 @02:42PM (#39082174)
You must be fun at parties
Re:The Case for Rust in the base system by dang on Sunday January 21, 2024 @03:09PM (#39082487)
Please don't do this here, even if another comment is annoying.
Re:The Case for Rust in the base system by LAC-Tech on Sunday January 21, 2024 @02:48PM (#39082253)
You go to parties where people are passionate about 32-bit PowerPC?

... can you invite me? This sounds great.

Re:The Case for Rust in the base system by tialaramex on Sunday January 21, 2024 @03:01PM (#39082400)
They might be Amigans which seems like a pretty bad outcome. Look forward to an hour or more of someone who is enthusiastically wrong about a broad range of topics and has been scammed for thousands of dollars without learning a thing from the experience. Oh the new one is faster and cheaper, but you had to get in early to lock in the price? And the delays have really only been a couple of years? Right, yes...
Re:The Case for Rust in the base system by LAC-Tech on Sunday January 21, 2024 @03:38PM (#39082801)
Ha what a bunch of idiots (he says, typing this on his 40% ortholinear mechanical keyboard with two stage spring switches and POM blank keycaps).
Re:The Case for Rust in the base system by nocombination on Sunday January 21, 2024 @03:26PM (#39082683)
Honestly, after being in the software industry for a couple of decades and seeing how many times folks attempt to reinvent the wheel (for commercial or other reasons), I am beginning to sigh when I see how many language zealots there are (not you, just in general). The reality is, Rust does not need to replace everything. Nor should it be held on some kind of pedestal.

E.G. Curiosity rover is doing just fine running on millions of lines of C.

https://vdocuments.mx/monitoring-the-execution-of-space-craf...

If it's going to impact OS stability and decrease performance and portability of the humble, dependable, simple C, it doesn't belong in the core. C is better than Rust for OS development.

Re:The Case for Rust in the base system by jimberlage on Sunday January 21, 2024 @03:56PM (#39082965)
The Curiosity rover might be doing ok, but the many places that have my social security number are not. I care more about the latter than the former.
Re:The Case for Rust in the base system by nocombination on Sunday January 21, 2024 @04:01PM (#39083014)
Right—and maybe those places ought to install OpenBSD. https://www.openbsd.org/

Rust is not immune to security vulnerabilities. And at the end of the day, social engineering will steal more data than "hacking the mainframe". Why break in when you can just ask to be let in?

OpenBSD has a great security track record because they resist excessive change and prefer simplicity. For those who want to add Rust to the core of FreeBSD my primary question: is it really necessary? Or is it just because a bunch of Rustaceans want to?

Re:The Case for Rust in the base system by mcronce on Sunday January 21, 2024 @04:44PM (#39083393)
Not solving all security issues isn't the same as not solving security issues. I'd rather my financial data be handled by software written in something that solves many whole classes of vulnerabilities than something that solves none of them.
Re:The Case for Rust in the base system by carlmr on Monday January 22, 2024 @03:58AM (#39087635)
Apart from the fact that it doesn't only solve a lot of security vulnerabilities, but also avoids a lot of bugs, by virtue of having a stricter type system and memory safety.
Re:The Case for Rust in the base system by nocombination on Monday January 22, 2024 @10:37AM (#39090562)
Remember we are talking about putting it into the core OS and overall what will the impact be on the stability of said OS. What folks here tend to describe is userspace applications which languages like Go/Java/C#/Erlang/Etc... already solve. In fact, most banks probably already use safer languages for the bulk of the workloads and it works just fine.

I want to point out one more thing: Rust is not a simple language by any stretch. It's equal to in complexity to C++ (yet without decades of established "good practices"). It is much preferable to have an easier to understand core and move the complexity outward—for improved stability and robustness. The core OS by nature of what it does needs to access raw resources in an "unsafe" manner. Rust kernel code will be littered with unsafe blocks and unnecessary complexity.

Re:The Case for Rust in the base system by nordsieck on Sunday January 21, 2024 @05:18PM (#39083674)
> Right—and maybe those places ought to install OpenBSD.

Sure.

But running on OpenBSD doesn't solve application level vulnerabilities. And sure - OpenBSD may help limit the ability of an attacker to leverage one vuln into compromising the entire system. But if the original attack was important enough, that's cold comfort.

Re:The Case for Rust in the base system by avgcorrection on Sunday January 21, 2024 @05:26PM (#39083724)
> For those who want to add Rust to the core of FreeBSD my primary question: is it really necessary? Or is it just because a bunch of Rustaceans want to?

Bfha... the link is a thread by the FreeBSD devs. Stop it with this language evangelist strawman.

Re:The Case for Rust in the base system by kjs3 on Sunday January 21, 2024 @06:49PM (#39084306)
OpenBSD? So lower scalability, limited hardware support, less features and a culture that screams "screw you" at anyone who doesn't think their world view is the only One True Way. Yeah...that'd be awesome. I mean, I'm as skeptical of Rust as anyone who's been around for more than a decade, but seriously.
Re:The Case for Rust in the base system by jimberlage on Monday January 22, 2024 @10:26AM (#39090434)
It seems like this isn’t actionable for me - I don’t have much sway over people’s choice of install. Given this, I think my best course of action are to push for regulation, or for standards bodies to accelerate the transition to memory safe languages.

I don’t think it was your intention, but what you just said makes me want to applaud more heavy-handed efforts to make the switch away from C/C++.

Re:The Case for Rust in the base system by kjs3 on Sunday January 21, 2024 @06:41PM (#39084236)
the many places that have my social security number

So COBOL everywhere it is. Let it be written, let it be done.

Re:The Case for Rust in the base system by pjmlp on Monday January 22, 2024 @03:19AM (#39087470)
Actually it isn't susceptible to C's security flaws, and is a compiled language, with relatively good performance. :)
Re:The Case for Rust in the base system by timeon on Sunday January 21, 2024 @03:39PM (#39082803)
How is this relevant to parent comment?
Re:The Case for Rust in the base system by richardwhiuk on Sunday January 21, 2024 @03:39PM (#39082802)
I assume you are still programming in COBOL?
Re:The Case for Rust in the base system by ben_bai on Sunday January 21, 2024 @04:27PM (#39083248)
Just like C, COBOL will always be with us.

> According to research, up to 850 billion lines of COBOL code are currently running in nearly 30,000 organizations, typically in critical production environments. 90 percent of Fortune 500 companies rely on it. Never has there been this much COBOL in circulation and the volume is only likely to increase for the foreseeable future.

https://www.chrly.pt/en/2023/06/14/cobol-the-immortal-langua...

Re:The Case for Rust in the base system by nocombination on Sunday January 21, 2024 @03:50PM (#39082897)
It's not what you program in that matters—it's how you test and ensure quality results.
Re:The Case for Rust in the base system by littlestymaar on Sunday January 21, 2024 @04:05PM (#39083062)
The amount of budget and time you have for the all project is finished, and in practice it's much easier for management to skip testing and QA than to reduce the scope of the project / the amount of features.hence the terrible quality that's plaguing this entire industry.
Re:The Case for Rust in the base system by kstrauser on Sunday January 21, 2024 @04:36PM (#39083326)
I like that Rust tests my code as I write it.
Re:The Case for Rust in the base system by dboreham on Sunday January 21, 2024 @06:23PM (#39084109)
Looks for lollipop...
Re:The Case for Rust in the base system by IshKebab on Sunday January 21, 2024 @06:05PM (#39083992)
That's stupid the language you write in has a huge effect on how you test and ensure quality results. They aren't separate things.

E.g. at one end of the spectrum you have Python where you have to write explicit tests for typos and type errors.

At the other end of the spectrum you have formal verification languages like Dafny that may not require any tests to be written.

Rust is somewhere in-between. It has a very strong type system and lots of features that make memory errors and business errors less likely than in most other languages. You still need some tests, but not as many as with C/C++, Python, JavaScript, etc.

Re:The Case for Rust in the base system by yencabulator on Monday January 22, 2024 @02:13PM (#39093957)
It's really hard to test for security.

It's much more feasibly to be secure by construction.

Re:The Case for Rust in the base system by saagarjha on Sunday January 21, 2024 @06:19PM (#39084088)
The C code that went into the Curiosity rover was quite expensive.
Re:The Case for Rust in the base system by pjmlp on Monday January 22, 2024 @03:18AM (#39087467)
I doubt many C devs would be doing fine coding under the same level of quality expected by NASA / JPL programming standards and security validation.
Re:The Case for Rust in the base system by PartiallyTyped on Sunday January 21, 2024 @05:02PM (#39083548)
Besides LLVM, there's been progress for a GCC backend, and in google summer of code, a suggested project is a c backend, so that all c compilers may be leveraged.