News

Running Unmodified Linux Programs on Fuchsia

Fuchsia OS Developers Will Add Support For Running Unmodified Linux Programs

Even though there is not much news about the Fuchsia OS, the project is still actively developing. The evidence of that is a statement from developers about their plans to create a mechanism for running unmodified programs that are produced for Linux.

In order to run Linux programs in the user space, developers plan to add a “Starnix” layer that provides great compatibility with the Linux ABI.

In this layer, the system interfaces of the Linux kernel are activated in a handler that operates as a process for the Fuchsia OS, running in user space and transforming requests from Linux programs into calls to the connected Fuchsia subsystems. It is mentioned that during the development of the project, many Fuchsia subsystems will have to be optimized to execute all the system interfaces available in Linux. The Starnix system largely depends on the Windows Subsystem for Linux applied in Windows to convert Linux system calls into Windows system calls.

The code of the layer will be scripted in Rust in order to prevent any technical problems. The developers hope that this programming language will minimize the risk of vulnerabilities that can be used to raise advantages of a Linux process to the starnix process itself. Fuchsia’s full-time security mechanisms will also be activated for this cause.

To illustrate, once accessed to a file system, network stack, or graphics subsystem, Starnix will transform the requests, converting the Linux ABI to the Fuchsia System ABI. This, as a result, will let you apply the same limitations that are used for normal processes in Fuchsia. The standard Linux methods for managing permissions will also be utilized.

Fuchsia OS and Linux Interrelation

It is worth mentioning that the OS developers have unlocked the ability to run Linux applications under Fuchsia before by using an application that is similar to what is included in Chrome OS. At large, you can understand them, since Fuchsia has always been treated as Google pet project. Previously, for the sake of improving compatibility with Linux, it was suggested to use the Machina library, which runs Linux software in a virtual machine formed by a hypervisor built on the Zircon kernel and VirtIO specifications.

The benefit of virtualization is not overlooked either, since the full implementation of the Linux system interface is rather a complex task. In addition to the Starnix layer, it has been proposed to create an appliance for running Linux executables with the Linux kernel running in a separate virtual machine. This appliance was brought up as the easiest to execute, but also the most efficient. At one time, Microsoft started building its Linux compatibility layer with a compiler, but eventually decided to switch to the native Linux kernel in Windows Subsystem for Linux 2.

In addition, Fuchsia already has a POSIX Lite compatibility layer operating on top of the Fuchsia System ABI. POSIX Lite lets you run some Linux programs, but demands recompilation of the application code, and in some cases, certain modifications of the source code. One of the serious issues with POSIX Lite is the incomplete activation of all POSIX features, including calls to change the global mode of procedures, which could be at odds with the security principles in Fuchsia that forbid changing the global mode. The use of POSIX Lite justifies itself in the process of porting available applications, but does not fix the issues with running programs for which there is no open access to the code (for instance, it is unattainable to reach compatibility with Android applications holding compiled native inserts).

As part of the Fuchsia project, Google is planning to deveop a universal operating system that can work on all types of devices, from workstations and smartphones to embedded and consumer devices. The development uses the previous experience of building the Android platform and takes into consideration all the shortcomings in the field of scaling and safety.

It could be observed that Google intends for Fuchsia to support all Android apps, without any exceptions, as apps that use the Android NDK to work in C or C++. Certainly, in the long run, Starnix should only be applied as a short-term measure to enable more widespread use of the Google Fuchsia OS, while waiting for developers to move their applications to the new OS. In the near future, a native Fuchsia app is expected to perform better than a Linux or Android app running through Starnix.

Summary

With all that being said, Starnix Fuchsia is only at the initial development stage, and a huge amount of work has to be completed to achieve full Android/Linux compatibility with Fuchsia/Zircon. And in order to avoid any drawbacks of such a project, Google researches through all the successes and failures of similar enterprises, such as the original Windows subsystem for Linux (WSL1).


.

You may also like...