hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

9.4K
active users

Tactless: "Rust in the kernel is a cancer."

Elegant: "Rust in the kernel is carcinization."

@dalias "Historical: Rust in the kernel begs the question why we didn't fix it before."

@lispi314 I'm not sure what you mean but let me just have my pun or whatever you call it without bringing up the actual argument... 🙃

@dalias I did notice the pun, aye.

Just felt like poking fun at the kernel being written in C when better Libre options were available the entire time.

@lispi314 Anyway IMO the problem is not that the kernel is written in the wrong language. It's that shit device drivers run in the same privilege domain and memory space as the kernel rather than being properly sandboxed.

@dalias Microkernels are mostly a way to work around flaws in the implementation language.

Sure, something needs to manage the capabilities or references in a memory-safe language that needs to handle hardware, but none of the other parts need to have such access.

With that handled, there isn't any security-based need for multiple address spaces. Heterogenous memory could still be useful for caching and such though, of course.

@lispi314 Yes, memory-safe languages and privsep are two very different philosophies to achieve similat ends, and I vastly prefer privsep because it lets you use any existing code and lets people write in the languages they're most comfortable in, and because it can protect against not just errors representable in your type system but also logic errors.

@dalias Technically, nothing prevents using capabilities (privsep) with languages that don't inherently support them. It just requires a compatibility interface.

seL4 has one for C. Memory-safe languages permit for much less awkward interfaces to use them though. They are complementary, not in opposition.
@dalias Unfortunately no, Free/Libre compilers for it are a much newer thing.

But even Pascal has significant safety improvements over C, as does Modula-2 & Oberon. In some aspects even Fortran (late-ish versions, early ones no) did better. One really didn't have to go far off the path to find better.

@lispi314 @dalias

I tried to use Pascal and Modula 2 for non-trivial programming in the '80s and they were non-starters. I couldn't even write code that would reliably do I/O on two different compilers on the same computer. It was easier to write cross-platform code in Fortran. That's why the original Software Tools book was revolutionary and Software Tools in Pascal was completely pointless.

@lispi314 @dalias

It's like the Godel Incompleteness Theorem. A systems programming language is either unsafe or so constrained as to be useless. Fortran is relatively safe because it has no pointers. Swift is close to a Godel-busting language. Rust may be closer. But Pascal and Modula 2 were not in the race.

@resuna @dalias On the other hand, on Lisp Machines there was a safe systems programming language with ease of doing unsafe things depending on the particular system. Of course they were so unaffordable as to defeat their whole point but they existed.

> But Pascal and Modula 2 were not in the race.

No, I named them more as examples of "even this little is still better than what C does", at least by spec. People probably promptly went and used unsafe options disabling some of their semantics for performance and then went "woe is me" when something went wrong.

Safe languages contemporary to C were kind of few and required expensive non-Free compilers for the most part.

Ada for example /existed/ but couldn't meaningfully be used unless one had military contractor company amounts of money. So it might as well not have been considered to exist before early 2000s.

@lispi314 @dalias

A safe programming language that you can do unsafe things in is a contradiction in terms though. Rust seems to be the first real attempt to let you practically avoid this loophole.

But Modula 2 and Pascal didn't even let you write safe code portably.

@resuna @dalias If it requires an explicit API, that's still being able to do unsafe things.

To avoid that one would otherwise need a hosted architecture more similar to Singularity or Midori's, with the hosting core being in one partly-safe language, and the rest being in a safe language with truly no access to anything else not wrapped & provided by the other as an API.

@lispi314 @dalias

The concept of the borrow checker in Rust radically expands the scope of what you can do within the bounds of safe code. It's really revolutionary in the world of open languages.

@resuna @dalias Ponylang has some interesting extensions to the concept, if you're interested in that aspect.

In some cases it might be interesting to transpose such semantics into other languages.
@resuna @dalias It took some time for them to stabilize in specification, and it is possible that compilers were just bad, yes. It is dismaying to think that implementers cared so little.

@lispi314 @dalias

The point is that we're talking of the period from 1970 onwards. The idea that there were "better Libre options the entire time" is just incomprehensible to someone who was actually working on kernel code back then.

@lispi314 @dalias The closest thing to a safe system programming environment was the Burroughs B series mainframes, with their high-level-only architecture.

@resuna @dalias Linux wasn't a thing until the 90s. I wasn't talking about the 70s.
@dalias @resuna I cannot reasonably poke fun at the early UNIXes on that level, because indeed options were very restricted.

But by the time Linux came into existence things were somewhat better.

@lispi314 @dalias

Linux wasn't really a separate thing from other UNIX implementations.

What languages are you thinking of?

@resuna @dalias On posting, I had been thinking saner Pascal compilers might've been an option (to name but one).

However, most of the Free alternatives I know unfortunately only came to be a thing a few years after Linux had already gotten started (Ada was only added to the GCC in 2001~), possibly partly as a consequence of it even (poses a bit of a chicken & egg problem; this isn't Ada's case, the project was already ongoing).

The notion that C was possibly one of the few with truly Libre compilers readily available is saddening. What an utter mess.

@lispi314 @dalias

I don't think it would have been possible to develop a useful portable language with Pascal as a base. There were too many unavoidable restrictions built into the language design. There were Pascal-like compilers that were closer to being usable but things like Turbo Pascal weren't actually Pascal and pretty much abandoned any pretense at safety.

@resuna @lispi314 @dalias Trying to get TeX ‘85 or ‘89 up and going on a pascal compiler (Berkeley pascal I think when I tried it) was really difficult, the web2c stuff made it vastly easier.