Earlier quoted context omitted.
I realize this is beating a dead horse, but it really is a shame that microkernels didn't win for human-facing Unix systems. This issue was recognized and basically solved decades ago, and we're still almost there.
This is true for server systems too. I've often had problems which were ultimately only solvable by rebooting large fleets of servers. Had the servers been running microkernels instead, updating services without full restarts would have been trivial in almost all cases. It's just a better approach overall. I curse the path dependency that led to the current situation.
The Case for Memory Safe Roadmaps
321–330 of 427 posts
Re: The Case for Memory Safe Roadmaps
#322Earlier quoted context omitted.
For sure C programs have a runtime. I'm debugging an issue right now that is to do with Windows not shipping VCRUNTIME140_1.DLL on out-of-the-box or old versions of Win10, so in that case it's very clear because you can make C programs that won't start due to a missing runtime library. The runtime isn't all that large but every OS has one. On UNIX it's spread over libc, libpthread, libgcc, libm and so on. On Linux st…
That's a rather idiosyncratic definition of "runtime"
So if it's idiosyncratic really depends on what audience you're talking to.
Re: The Case for Memory Safe Roadmaps
#323Their "Appendix: Memory Safe Languages" lists: C#, Go, Java, Python, Rust & Swift
Really, the only memory unsafe languages still in use are C and C++. If it weren't for the behemoth of legacy code we'd really have this problem more-or-less licked. Unfortunately, that behemoth is still rampaging across the landscape. "Rewrite it in Rust" gets a bit of pushback, perhaps even justified, but at this point in time I'll take anything that just reduces that behemoth in size. The journey of a thousand mil…
Re: The Case for Memory Safe Roadmaps
#324Earlier quoted context omitted.
You can also cause a segfault in Go by dereferencing a null pointer. That's another example of not being entirely memory safe.
In this case it's not memory unsafe. It is guaranteed to crash the program (or get caught). It's closer to a NullReferenceException than it is to reading from a null pointer in C. There's no memory exploitation you can pull off from this bug being in a Go program, but you could in a C program
> It's closer to a NullReferenceException than it is to reading from a null pointer in C.
No, it's exactly the same as a null pointer dereference in C, because it is literally reading from a null pointer in Go as well. In Java, the compiler inserts null checks before every single dereference and throws an exception for null references.
> There's no memory exploitation you can pull off from this bug being in a Go program, but you could in a C program
Provided the OS sends a SEGV signal for null pointer dereferences, I don't see there being a difference in security between C and Golang in this respect. It's a bigger problem when you're running without an operating system.
Re: The Case for Memory Safe Roadmaps
#325Earlier quoted context omitted.
>Java Java it's a pest fest for exploits. From those, I'd choose Go, C# (and not totally sure because of AOT/JIT's) and Rust.
>Java it's a pest fest for exploits. Sure, if you haven't used it since the nineties and pay zero attention to new development.
Re: The Case for Memory Safe Roadmaps
#326Earlier quoted context omitted.
what do we do about javascript?
Write javascript engines in memory safe languages. I'd vote for rust as rust and javascript's APIs are pretty similar in style, structure, consistency and security/other issues that are not memory safety. On that note, try valgrind on existing javascript engines, you might be "entertained". (I certainly was, but that was some years back.
AFAIK the only competitive JS engines written in memory safe languages are GraalJS and other JS-on-the-JVM runtimes. GraalJS has the advantage of being fully up to date, not having any memory unsafe code in it (the JIT compiler that makes it fast is a separate module, also written in a memory safe language, and the JS impl does not have low level code in it). And you can run it on SubstrateVM which is a virtual machine also written in a memory safe language, although of course small parts like the GC need to use unsafe features.
It also has other useful features like sandboxing and the ability to interop with other languages like Python or Java. Plus, it can actually sandbox native code as well because the "languages" that you can run on GraalVM include both wasm and more usefully LLVM bitcode, in which each individual C/C++ allocation becomes GC-managed and bounds checked.
So in terms of memory safety the Graal team are way ahead there.
(disclosure: I recently started part time work with the GraalVM team, but was a long term supporter before that)
Re: The Case for Memory Safe Roadmaps
#327Earlier quoted context omitted.
This is a common conception, and I agree to a point. However, interfaces matter. At the interface to _literally any_ system call, unsafe starts to creep out. Either in the wrapper implementation, or in the interface _to_ the system, or even leaking through the wrapper to the caller. At that point, if we have to re-wrap everything in rust to hide the unsafety of the interfaces to the system (sockets, shared mem, etc e…
> At the interface to _literally any_ system call, unsafe starts to creep out. Either in the wrapper implementation, or in the interface _to_ the system, or even leaking through the wrapper to the caller. It’s quite rare to have to make syscalls directly in Rust, just like it is in c++. Most code in any large enough system is related to the internal logic of the system, not to its interface with the outside world. An…
To answer your question, I'm referring to much of the networking code in socket2 / socket, which uses MaybeUninit when doing non-standard stuff like forming your own packets. (RAW)
Re: The Case for Memory Safe Roadmaps
#328Earlier quoted context omitted.
>Really, the only memory unsafe languages still in use are C and C++. Ada, Fortran, assembly?
Fortran doesn’t even have dynamic memory allocation, so it’s inherently safe.
No pointer direct arithmetic, though. If you allocate the memory via allocate, you can inquire if it's been deallocated.
Re: The Case for Memory Safe Roadmaps
#329Earlier quoted context omitted.
Hurd works in the same sense that OpenBSD works. It has very limited hardware support so you'll likely have to run it in a VM, but it does work.
If you're willing to split your workload into VMs in the first place I think application-level segmentation like Qubes starts to become a more interesting idea that microkernels.
Re: The Case for Memory Safe Roadmaps
#330I'm cynically thinking "because they can now target the runtimes instead, and get far more value from their exploits".
NSA is like the governmental version of the "inside you there are two wolves" meme One wolf that wants to help ensure that American computers are secure And one wolf that wants to hoard as many 0-days as possible