Kerla project develops a Linux compatible kernel in Rust

In the framework of the project kerla , the development of the operating system kernel written in the RUST language is underway. The new core is initially focused on ensuring compatibility with the Linux kernel at the ABI level, which will allow to run surrounded by Kerla unmodified executable files collected for Linux. The code applies under the licenses Apache 2.0 and Mit. The project develops the Japanese developer Seiya Nuta (Seiya Nuta), known for the creation of a micronuclear operating system Resea written in C language.

At the current stage of development, Kerla can only work on systems with the architecture x86_64 and implements basic system calls, Such as Write, Stat, MMAP, PIPE and POLL, supports signals, unnamed channels and context switching. Process management are provided with challenges such as Fork, Wait4 and Execve. There is support for TTY and pseudoerminal (PTY).
From file systems are still supported by initramfs (applied to mount root FS), TMPFS and DEVFS. A network stack is provided with TCP / UDP sockets, implemented on the basis of the smoltcp .

Musl can be used as a system library, and as a custom utility – cargo-binutils . The developer has prepared a boot environment, started in QEMU or in the FireCracker virtual machine with the Virtio-Net driver, to which you can already connect to SSH. At the docker database, the assembly system has been prepared, allowing to form your own bootable initramfs with the kerla core. Separately develop similar to Fish software shell NSH and GUI stack Kazari on the base of the Wayland protocol.

Using the RUST language in the project allows you to reduce the number of errors in the code through the use of secure programming techniques and improve the efficiency of problems in working with memory. Safe memory work is provided in Rust during compilation through checks checks, tracking property tracking and accounting of objects of objects (area of ​​visibility), as well as via an assessment of memory access valuables during code execution. In addition, Rust provides tools to protect from integer overflows, requires mandatory initialization of variable values ​​before use, applies the concept of immutability (Immutable) of references and default variables, offers strong static typing to minimize logical errors, simplifies the processing of input values ​​due to the comparison tools with the sample .

To develop low-level components, such as the OS kernel, RUST provides support for RAW pointers, packaging structures, assembler inline inserts, embedding files on the assembler. To work without binding to the standard library there are separate CRATE packets for performing operations with rows, vectors and bit flags. From advantages There are also built-in tools for assessing the quality of code (Linter, Rust-Analyzer) and creating unit tests that can be launched not only on real equipment, but also in QEMU.

/Media reports.