linuxulator

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linuxulator [2021/07/04 15:50] – EdwardTomaszNapieralalinuxulator [2023/01/29 14:30] (current) – man.freebsd.org GrahamPerrin
Line 1: Line 1:
 +===== Linuxulator (Linux Emulation) =====
 +
 Linux binary compatibility, commonly referred to as Linuxulator, is a mechanism to run unmodified Linux binaries under %%FreeBSD%%.  It does not involve virtual machines or emulation; instead, it provides the binaries with kernel interfaces identical to those provided by a real Linux kernel.  Technically it's similar to the way 32-bit %%FreeBSD%% binaries run on top of 64-bit %%FreeBSD%% kernel. Linux binary compatibility, commonly referred to as Linuxulator, is a mechanism to run unmodified Linux binaries under %%FreeBSD%%.  It does not involve virtual machines or emulation; instead, it provides the binaries with kernel interfaces identical to those provided by a real Linux kernel.  Technically it's similar to the way 32-bit %%FreeBSD%% binaries run on top of 64-bit %%FreeBSD%% kernel.
  
-There are two main ways to use Linuxulator.  First, documented in the [[https://docs.freebsd.org/en/books/handbook/linuxemu|FreeBSD Handbook]], uses Linux applications provided as %%FreeBSD%% ports and packages, to be installed using [[https://www.freebsd.org/cgi/man.cgi?pkg|pkg(8)]].  Second, described at [[LinuxJails]], provides a full Debian/Ubuntu userspace.  The former is more user-friendly, but provides a limited number of available applications.  The latter is more cumbersome, but is handy when doing development work.  Both can be used at the same time.+There are two main ways to use Linuxulator.  First, documented in the [[https://docs.freebsd.org/en/books/handbook/linuxemu|FreeBSD Handbook]], uses Linux applications provided as %%FreeBSD%% ports and packages, to be installed using [[https://man.freebsd.org/cgi/man.cgi?pkg|pkg(8)]].  Second, described at [[LinuxJails]], provides a full Debian/Ubuntu userspace.  The former is more user-friendly, but provides a limited number of available applications.  The latter method is more involved, but is handy when doing development work.  Both can be used at the same time.
  
 ===== Status ===== ===== Status =====
Line 13: Line 15:
 The goal is to implement as many Linux syscalls as possible, except for ones that are obsolete or only used for management purposes. The goal is to implement as many Linux syscalls as possible, except for ones that are obsolete or only used for management purposes.
  
-The canonical list of unimplemented syscalls can be found at [[https://svnweb.freebsd.org/base/head/sys/amd64/linux/linux_dummy.c?view=markup|sys/amd64/linux/linux_dummy.c]].  Those marked UNIMPLEMENTED() are not supposed to be ever supported, usually because they have been [[http://www.man7.org/linux/man-pages/man2/unimplemented.2.html|obsoleted upstream]].  A somewhat stale list can be found at [[LinuxulatorMissing]].+The canonical list of unimplemented syscalls can be found at [[https://cgit.freebsd.org/src/tree/sys/compat/linux/linux_dummy.c|sys/compat/linux/linux_dummy.c]].  Those marked UNIMPLEMENTED() are not supposed to be ever supported, usually because they have been [[http://www.man7.org/linux/man-pages/man2/unimplemented.2.html|obsoleted upstream]].  A somewhat stale list can be found at [[LinuxulatorMissing]].
  
 The [[http://www.kernel.org/doc/man-pages/online/pages/man2/syscalls.2.html|Linux syscalls(2) man page]] lists all syscalls including references to the Linux kernel version each syscall first appeared. Note that in Linux, there are differences in syscalls supported by each architecture, there's a [[https://fedora.juszkiewicz.com.pl/syscalls.html|website tracking this]]. The [[http://www.kernel.org/doc/man-pages/online/pages/man2/syscalls.2.html|Linux syscalls(2) man page]] lists all syscalls including references to the Linux kernel version each syscall first appeared. Note that in Linux, there are differences in syscalls supported by each architecture, there's a [[https://fedora.juszkiewicz.com.pl/syscalls.html|website tracking this]].
Line 19: Line 21:
 ==== Testing ==== ==== Testing ====
  
-  * [[http://ltp.sf.net|Linux Test Project]]: README and INSTALL are straightforward, don't forget to mount devfs, linprocfs and linsysfs to the linux-chroot where you compile/test+  * [[https://github.com/linux-test-project/ltp|Linux Test Project]]: README and INSTALL are straightforward, don't forget to mount devfs, linprocfs and linsysfs to the linux-chroot where you compile/test
   * [[http://www.Leidinger.net/FreeBSD/linuxolator/|GNU libc nptl regression test]]: not as easy as LTP, but doable; precompiled stuff available   * [[http://www.Leidinger.net/FreeBSD/linuxolator/|GNU libc nptl regression test]]: not as easy as LTP, but doable; precompiled stuff available
   * [[http://people.freebsd.org/~jkim/mmap_test.c|mmap fingerprinter]]: little tool by [[MarcinCieslak|Marcin Cieslak]], extended by [[jkim@FreeBSD.org|Jung-uk Kim]] to determine the fingerprint of the mmap() call. Could be used to extend the %%FreeBSD%% regression tests too. Note: Marcin confirmed that mmap_test.c is public domain.   * [[http://people.freebsd.org/~jkim/mmap_test.c|mmap fingerprinter]]: little tool by [[MarcinCieslak|Marcin Cieslak]], extended by [[jkim@FreeBSD.org|Jung-uk Kim]] to determine the fingerprint of the mmap() call. Could be used to extend the %%FreeBSD%% regression tests too. Note: Marcin confirmed that mmap_test.c is public domain.
   * [[http://git.kernel.org/?p=linux/kernel/git/dvhart/futextest.git|Darren Hart's futex test suite]]: this suite will run various futex related functionality, performance and stress tests.   * [[http://git.kernel.org/?p=linux/kernel/git/dvhart/futextest.git|Darren Hart's futex test suite]]: this suite will run various futex related functionality, performance and stress tests.
   * [[https://github.com/kernelslacker/trinity|Trinity: a Linux system call fuzz tester]]: a  package to call syscalls at random, with random arguments, to find eventual vulnerabilities and bugs.   * [[https://github.com/kernelslacker/trinity|Trinity: a Linux system call fuzz tester]]: a  package to call syscalls at random, with random arguments, to find eventual vulnerabilities and bugs.
 +  * [[https://github.com/strace/strace|strace(1)]] test suite - ''%%make check%%'' to run, focused on ''%%ptrace(2)%%''
   * The ¨ballista¨ test cases of the Linux Test Project should be run when we are finished with fixing bugs.   * The ¨ballista¨ test cases of the Linux Test Project should be run when we are finished with fixing bugs.
   * The Open POSIX test suite (comes with the LPI); we need a reference output from Linux to be able to compare this.   * The Open POSIX test suite (comes with the LPI); we need a reference output from Linux to be able to compare this.
Line 44: Line 47:
 ==== Debugging ==== ==== Debugging ====
  
-%%FreeBSD%%'s truss(1) and ktrace(1) can trace Linux binaries and decode the syscall names, but they don't support decoding Linux arguments into human-readable form.  Linux strace(1) does, though - it can be installed from devel/linux-c7-strace port, or the linux-c7-strace package.+%%FreeBSD%%'s truss(1) and ktrace(1) can trace Linux binaries and decode the syscall names, but they don't support decoding Linux arguments into human-readable form.  Linux strace(1) does, though - it can be installed from the linux-c7-strace package, or by ''%%apt install strace%%'' in [[LinuxJails|Ubuntu chroot]].
  
-Linux core dumps are supported starting with 14.0-CURRENT.+Linux core dumps are supported starting with 14.0-CURRENT.  Use Linux ''%%gdb%%'' to open them; you might want to consult [[https://wiki.ubuntu.com/Debug%20Symbol%20Packages|Ubuntu documentation on debug symbol packages.]]
  
 ===== Roadmap ===== ===== Roadmap =====
  
-  * Implement NETLINK (RFC 3549), at least route part for ''%%getifaddrs%%'' and ''%%if_indextoname%%'' glibc functions 
   * Implement PI Futexes   * Implement PI Futexes
   * Implement linprocfs ''%%/proc/self/task/$TID/%%''   * Implement linprocfs ''%%/proc/self/task/$TID/%%''
  • linuxulator.1625413802.txt.gz
  • Last modified: 2021/07/04 15:50
  • by EdwardTomaszNapierala