News for hackers. Stuff that matters.
Re:Rust: Enable WebAssembly backend by default by steveklabnik on Monday November 27, 2017 @07:17AM (#15786742)
> The two places of unsafe are barely just the minimum.

Yes, this is only one subsystem. Obviously, as you say, there are more than that in a realer kernel. But even larger ones have still shown that the vast majority of their stuff works in safe code.

> Setting up a syscall is unsafe

Fun detail, this isn't unsafe anymore on x86! You don't need naked functions; you can

  extern "x86-interrupt" fn some_handler()
and LLVM knows how to properly do the codegen! This is kinda emblematic of what I mean: you can do more with safe code than you'd think.
Re:Rust: Enable WebAssembly backend by default by zaarn on Monday November 27, 2017 @07:51AM (#15786892)
>Fun detail, this isn't unsafe anymore on x86!

On x86, not x86-64, which has the syscall instruction, replacing interrupts for syscalls (technically x86 had sysenter)

The syscall instruction requires writing the address of the syscall function into the LSTAR MSR. Additionally, the syscall entry is purely naked, only the EIP and Segments are preserved and in a way that requires the caller to handle it.

Sysret is also particularly nasty in being unsafe in various ways, including being buggy on all Intel CPUs.

Atleast it's faster than interrupts and you don't technically need the -mno-redzone for it if it's not part of your interrupt handling code.