To actually register a new binary type, we have to set up a string like:
and echo it to /proc/sys/fs/binfmt_misc/register. We can choose
: character upon our needs and we can omit a field by simply
using an empty string; for example if we omit the offset and the mask
Fields description follows.
Mactivates first bytes recognition (also known as “magic” recognition); if set to
Eactivates file name extension recognition.
binfmt_miscwill look for file recognition.
The magic string may contain hex–encoded characters like
\xA4. When echoing the record from a shell environment, we will
have to quote the backslash:
If we chose filename extension matching, this is the extension to be
recognised (without the
\x0a specials are not
allowed). Extension matching is case sensitive.
magic. The mask is ANDed with the byte sequence from the file. It defaults to
There are some restrictions:
offset+size(magic)has to be less than 128.