Binfmt misc explained

binfmt_misc (Miscellaneous Binary Format) is a capability of the Linux kernel which allows arbitrary executable file formats to be recognized and passed to certain user space applications, such as emulators and virtual machines.[1] It is one of a number of binary format handlers in the kernel that are involved in preparing a user-space program to run.[2]

The executable formats are registered through the special purpose file system binfmt_misc file-system interface (usually mounted under part of /proc). This is either done directly by sending special sequences to the register procfs file or using a wrapper like Debian-based distributions binfmt-support package[3] or systemd's systemd-binfmt.service.[4] [5]

Registration

The register file contains lines which define executable types to be handled. Each line is of the form:

:name:type:offset:magic:mask:interpreter:flags

Each format has a corresponding file entry in the /proc/sys/fs/binfmt_misc directory which can be read to get information about a given file format.

Common usage

See also

References

  1. https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html Kernel Support for miscellaneous Binary Formats (binfmt_misc)
  2. https://lwn.net/Articles/630727/ How programs get run
  3. http://packages.debian.org/sid/binfmt-support Details of package binfmt-support in sid
  4. https://www.freedesktop.org/software/systemd/man/systemd-binfmt.service.html# systemd-binfmt.service
  5. https://www.freedesktop.org/software/systemd/man/binfmt.d.html binfmt.d
  6. https://www.kernel.org/doc/html/latest/admin-guide/java.html Java(tm) Binary Kernel Support for Linux v1.03
  7. https://www.kernel.org/doc/html/latest/admin-guide/mono.html Mono(tm) Binary Kernel Support for Linux
  8. http://www.mono-project.com/Guide:Running_Mono_Applications Guide:Running Mono Applications

External links