Information about the Kerla project was recently released. Kerla is being developed as an operating system kernel written in Rust. The code is distributed under the Apache 2.0 and MIT licenses. The project is being developed by Japanese developer Seiya Nuta, known for creating the Resea microkernel operating system, written in C.
The new kernel initially aims to ensure compatibility with the Linux kernel at the ABI level, allowing unmodified binaries created for Linux to run in a Kerla-based environment.
About Keral
Kerla is a monolithic operating system kernel built from scratch in Rust. At its current stage of development, Kerla can only run on x86_64 systems and implements basic system calls such as write, stat, mmap, pipe, and poll. It supports signals, unnamed pipes, and context switches. Calls like fork, wait4, and execve are used to control processes. There is support for tty and pseudo-terminals (pty). The initramfs (used to mount the root filesystem), tmpfs, and devfs filesystems are still supported.
A network stack with support for TCP and UDP sockets, based on the smoltcp library, is also provided. The developer has prepared a boot environment that works in QEMU or Firecracker VMs using the virtio-net driver, which you can already connect to via SSH . Musl is used as a system library, and BusyBox as a user utility . A Docker-based build system has been prepared that allows you to create your own boot initramfs using the Kerla kernel.
So far, few details have been provided about its new kernel, but what draws the most attention to Kerla's features is the fact that it is written in Rust. So does writing it in Rust have any advantages over other languages or over existing code? Many answered yes to this question, emphasizing the memory security benefits that language provides.
It is also provided when evaluating the accuracy of memory accesses at runtime. Furthermore , Mozilla believes that Rust offers protection against integer overflows , requires mandatory initialization of variable values before use, adopts the concept of references and immutable variables by default, offers strong static typing to minimize logical errors, and simplifies input processing through pattern matching.
Among the advantages, we highlight the integrated tools for evaluating code quality and creating unit tests that can be run not only on real hardware but also in QEMU. Essentially, Mozilla considers Rust easier to debug, since the compiler will reject errors. However, the tests did point out some drawbacks to Rust.
“As with C ++, it is almost impossible to write idiomatic Rust without using templates, so it has bloated binaries and slow compile times. All of these compile-time checks also come at a cost. Also, if you rewrite something, you lose the old mature codebase, and there is no way you can produce a codebase of similar quality in a reasonable amount of time; it is much better to extend, rather than rewrite, the program in Rust. It's better to extend the program rather than rewrite it in Rust, ”says a software engineer.
According to its creator, this is why Linux developers, particularly Linus Torvalds himself, rejected the idea of rewriting the entire kernel in Rust.
“Do some work to create secure links, then write the additional code in Rust and you can still enjoy that mature code. (That's what Linux does, there are efforts to add the ability to write a kernel module in Rust), ”he added. Linux developers have been exploring the possibilities of writing certain new kernel modules using the Rust language for about three years. This gave rise to the »Rust for Linux« project.
Finally, if you are interested in learning more, you can find the details at the following link.