BSDun has been published, a module for running FreeBSD executable files in Linux.

The BSDun project has been released, developing a module for the Linux kernel that allows recognizing, loading, and executing unmodified ELF executable files compiled for FreeBSD in Linux. It uses a simulated FreeBSD environment hosted in the /compat/freebsd directory. Overall, the project is the complete opposite of FreeBSD's Linuxulator. The code is distributed under the GPLv2+ license and was written with the assistance of the AI assistant Claude Code.

With BSDun, many applications from FreeBSD packages have been successfully run in Linux, including pkg, nginx, mc, ping, xeyes, xfce4-panel, Thunar, xfce4-terminal, Libreoffice, Midori, Epiphany, Chromium, and VScode. To run Chromium and VScode, sandbox isolation must be disabled and the video memory size limited using the options "--no-sandbox --force-gpu-mem-available-mb=1024."

The module does not aim to be included in the main kernel, since since the removal of the Solaris ABI, the Linux kernel architecture does not allow the inclusion of other executable file handlers (OS Personalities) and only provides for a single syscall table. To circumvent this issue, BSDun employs the kprobe mechanism to intercept all system calls.

Using kprobe, FreeBSD system calls were separated from Linux system calls and wrapped into a separate table. Some FreeBSD system calls were directly linked to Linux system calls, while others required re-packaging of the parameter and return structures, some were replaced with stubs (such as those related to Capcicum), and others were based on internal structures of the Linux kernel. For implementing the kevent/kqueue mechanism over epoll(), a modification of user-space components was separately applied, automatically occurring upon loading each FreeBSD executable.

In total, about 250 system calls have been implemented. SystemV IPC, network functions, futexes, sysctl MIB, prctl, timers, and ioctl have also been implemented. To isolate file systems, a chroot environment was used on the Linux side (in experimental processes without chroot, the author overwrote the contents of /usr/local/* in Linux by executing "pkg install ..."). However, some utilities can still work without chroot.

The proposed module can be used for the development, building, and porting of software for FreeBSD without using of virtual machines. Quick usage instructions: make make load ./bsdun-freebsd-root-resetup.sh ./bsdun-freebsd-enter.sh uname -a FreeBSD host 16.0-CURRENT FreeBSD 16.0-CURRENT (bsdun) amd64

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster