News for hackers. Stuff that matters.
Re:Towards Linux Kernel Memory Safety by mkesper on Thursday November 16, 2017 @05:16AM (#15711525)
Memory safety without GC and with zero-cost abstractions is the combination rust enables. Nim and swift (and Go) strictly require a GC and D without GC doesn't work without heavy lifting.
Re:Towards Linux Kernel Memory Safety by dom96 on Thursday November 16, 2017 @05:23AM (#15711547)
> Nim and swift (and Go) strictly require a GC and D without GC doesn't work without heavy lifting.

I think Nim belongs with D here. You can freely disable the GC in Nim.

Full disclosure: I'm a Nim core dev.

Re:Towards Linux Kernel Memory Safety by zurn on Thursday November 16, 2017 @08:04AM (#15712313)
Refcounting and costly abstractions are in wide use currently - just done in C without the safety.
Re:Towards Linux Kernel Memory Safety by Varriount on Thursday November 16, 2017 @05:48AM (#15711665)
What's wrong with garbage collectors? Depending on the type, you can get performance characteristics better than or similar to destructor-based management.

Even current operating systems use forms of garbage collection (such as refcounting) to track resources.

Re:Towards Linux Kernel Memory Safety by cyphar on Thursday November 16, 2017 @08:02AM (#15712302)
The problems with a GC (in the context of embedding it in a larger codebase written in a another language) is that the calling conventions are more complicated and the existence of a GC (especially mark-and-sweep GCs) means that the embedding is not "seamless". Even with a C FFI interface it's still harder than (for example) using Rust or C in such a project.

And if both languages have GC, then you're in even more trouble.

Re:Towards Linux Kernel Memory Safety by johncolanduoni on Thursday November 16, 2017 @10:49AM (#15713606)
For what language runtime are the calling conventions an issue? Even the most calling-convention dependent GC I can think of (GHC Haskell's) can handle standard C ABIs and .NET is a good example of making this whole process relatively seamless. If you can export a C FFI with pinned pointers in both directions, I don't see how it's any harder than Rust or C.

The multiple GCs in a process issue is usually due to the collector not playing nice with signal/exception handler installation when using safepoints, which is purely an issue of lazy implementations. There's even ways to collect cross-heap cycles when working this multiple GCs (Xamarin on Android does this fairly well).

Re:Towards Linux Kernel Memory Safety by jhasse on Thursday November 16, 2017 @08:02AM (#15712299)
Most things get moved to the heap.
Re:Towards Linux Kernel Memory Safety by pjmlp on Thursday November 16, 2017 @08:46AM (#15712542)
Only in GC languages that don't offer good language features for value types, which usually isn't the case with the ones targeted for low level systems development.
Re:Towards Linux Kernel Memory Safety by Rusky on Thursday November 16, 2017 @01:20PM (#15715078)
"Good language features for value types," while retaining memory safety, means at least one of these things:

* Boxing anything you take a reference directly to

* Forbidding sum types and complicating the GC to allow interior pointers

* Forbidding references to value types

* A borrow checker

Guess which one is most flexible, and novel in Rust.

Re:Towards Linux Kernel Memory Safety by pjmlp on Thursday November 16, 2017 @01:39PM (#15715266)
A language like Modula-3 doesn't suffer from those issues.

We only don't have it thanks to Compaq killing the project after acquiring DEC Olivetti. Politics as usual.

Rust ideas come from Cyclone and ATS, it is not novel in Rust.

The borrow checker still is pretty much WIP, that the NLL changes will surely improve, but don't not yet solve all ergonomic problems.

Re:Towards Linux Kernel Memory Safety by Rusky on Saturday November 18, 2017 @02:20AM (#15728129)
Modula-3 either uses one of those techniques, or is not memory safe. (Looks like primarily the first one- manual deallocation is unsafe and it relies on GC for the rest?)

Cyclone and ATS do not have Rust's combination of ownership and borrowing.

Re:Towards Linux Kernel Memory Safety by pjmlp on Thursday November 16, 2017 @06:15AM (#15711804)
Ada already enabled it.
Re:Towards Linux Kernel Memory Safety by johncolanduoni on Thursday November 16, 2017 @10:31AM (#15713406)
Ada's model for safe allocations is far more limited than Rust's, however. Particularly in ways that would require more unsafe code when writing a kernel.
Re:Towards Linux Kernel Memory Safety by pjmlp on Thursday November 16, 2017 @10:51AM (#15713626)
I don't see why, given that Unchecked_Deallocation calls should only exist inside data structure implementations, never called directly from safe code.

Which should just use controlled types, pools or standard containers.

Also there are a few open experiments with Ada,

https://muen.codelabs.ch/

https://github.com/Lucretia/bare_bones

https://marte.unican.es/

Then there are the commercial ones used in the industry, making use of bare metal profiles like Ravenscar.