Home

binfmtmisc

binfmt_misc is a Linux kernel facility that allows the registration of miscellaneous executable formats so that the kernel can automatically invoke an interpreter or loader to run non-native binaries. It exposes a runtime interface at /proc/sys/fs/binfmt_misc and uses a simple registration mechanism to associate a format with an interpreter or loader. When a program is executed, the kernel checks the registered rules and, if a match is found, delegates execution to the specified interpreter, supplying the binary as an argument. This enables transparent execution of foreign-architecture binaries and other formats without requiring each application to provide its own launcher.

Registration is performed by writing a line to /proc/sys/fs/binfmt_misc/register. A format definition consists of fields such

binfmt_misc has been part of the Linux kernel as a generic mechanism for handling non-native executable formats

as
a
name,
type,
offset,
magic
or
extension,
optional
mask,
the
path
to
the
interpreter
or
loader,
and
optional
flags.
The
type
can
indicate
a
magic-based
match
or
a
filename
extension
match,
among
other
options.
A
common
use
is
to
enable
QEMU
user-mode
emulation
so
that
binaries
for
architectures
like
ARM
can
be
run
on
an
x86
host,
with
the
kernel
automatically
invoking
qemu
when
needed.
for
many
years.
It
is
typically
enabled
by
loading
the
binfmt_misc
module
and
can
be
configured
at
runtime,
offering
a
lightweight
alternative
to
per-application
emulation
layers.
Security
considerations
include
the
fact
that
any
registered
format
can
alter
process
startup
behavior
and
should
be
managed
carefully.