€•áŒsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ+/translations/zh_CN/admin-guide/binfmt-misc”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/zh_TW/admin-guide/binfmt-misc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/it_IT/admin-guide/binfmt-misc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/ja_JP/admin-guide/binfmt-misc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/ko_KR/admin-guide/binfmt-misc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/pt_BR/admin-guide/binfmt-misc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ+/translations/sp_SP/admin-guide/binfmt-misc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒ=Kernel Support for miscellaneous Binary Formats (binfmt_misc)”h]”hŒ=Kernel Support for miscellaneous Binary Formats (binfmt_misc)”…”�”}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³ŒE/var/lib/git/docbuild/linux/Documentation/admin-guide/binfmt-misc.rst”h´KubhŒ paragraph”“”)�”}”(hŒÉThis Kernel feature allows you to invoke almost (for restrictions see below) every program by simply typing its name in the shell. This includes for example compiled Java(TM), Python or Emacs programs.”h]”hŒÉThis Kernel feature allows you to invoke almost (for restrictions see below) every program by simply typing its name in the shell. This includes for example compiled Java(TM), Python or Emacs programs.”…”�”}”(hhÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhÌ)�”}”(hXTTo achieve this you must tell binfmt_misc which interpreter has to be invoked with which binary. Binfmt_misc recognises the binary-type by matching some bytes at the beginning of the file with a magic byte sequence (masking out specified bits) you have supplied. Binfmt_misc can also recognise a filename extension aka ``.com`` or ``.exe``.”h]”(hX?To achieve this you must tell binfmt_misc which interpreter has to be invoked with which binary. Binfmt_misc recognises the binary-type by matching some bytes at the beginning of the file with a magic byte sequence (masking out specified bits) you have supplied. Binfmt_misc can also recognise a filename extension aka ”…”�”}”(hhÛh²hh³Nh´NubhŒliteral”“”)�”}”(hŒ``.com``”h]”hŒ.com”…”�”}”(hhåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhhÛubhŒ or ”…”�”}”(hhÛh²hh³Nh´Nubhä)�”}”(hŒ``.exe``”h]”hŒ.exe”…”�”}”(hh÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhhÛubhŒ.”…”�”}”(hhÛh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhÌ)�”}”(hŒ"First you must mount binfmt_misc::”h]”hŒ!First you must mount binfmt_misc:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhŒ literal_block”“”)�”}”(hŒ9mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc”h]”hŒ9mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1jh³hÊh´Khh·h²hubhÌ)�”}”(hŒêTo actually register a new binary type, you have to set up a string looking like ``:name:type:offset:magic:mask:interpreter:flags`` (where you can choose the ``:`` upon your needs) and echo it to ``/proc/sys/fs/binfmt_misc/register``.”h]”(hŒQTo actually register a new binary type, you have to set up a string looking like ”…”�”}”(hj/h²hh³Nh´Nubhä)�”}”(hŒ2``:name:type:offset:magic:mask:interpreter:flags``”h]”hŒ.:name:type:offset:magic:mask:interpreter:flags”…”�”}”(hj7h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj/ubhŒ (where you can choose the ”…”�”}”(hj/h²hh³Nh´Nubhä)�”}”(hŒ``:``”h]”hŒ:”…”�”}”(hjIh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj/ubhŒ! upon your needs) and echo it to ”…”�”}”(hj/h²hh³Nh´Nubhä)�”}”(hŒ%``/proc/sys/fs/binfmt_misc/register``”h]”hŒ!/proc/sys/fs/binfmt_misc/register”…”�”}”(hj[h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj/ubhŒ.”…”�”}”(hj/h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhÌ)�”}”(hŒƒThe first character of the string is its field delimiter and can be any ASCII punctuation character other than the backslash ``\``.”h]”(hŒ}The first character of the string is its field delimiter and can be any ASCII punctuation character other than the backslash ”…”�”}”(hjsh²hh³Nh´Nubhä)�”}”(hŒ``\``”h]”hŒ\”…”�”}”(hj{h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjsubhŒ.”…”�”}”(hjsh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhÌ)�”}”(hŒHere is what the fields mean:”h]”hŒHere is what the fields mean:”…”�”}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhŒ bullet_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hŒª``name`` is an identifier string. A new /proc file will be created with this name below ``/proc/sys/fs/binfmt_misc``; cannot contain slashes ``/`` for obvious reasons.”h]”hŒdefinition_list”“”)�”}”(hhh]”hŒdefinition_list_item”“”)�”}”(hŒ§``name`` is an identifier string. A new /proc file will be created with this name below ``/proc/sys/fs/binfmt_misc``; cannot contain slashes ``/`` for obvious reasons.”h]”(hŒterm”“”)�”}”(hŒ``name``”h]”hä)�”}”(hj»h]”hŒname”…”�”}”(hj½h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj¹ubah}”(h]”h ]”h"]”h$]”h&]”uh1j·h³hÊh´Khj³ubhŒ definition”“”)�”}”(hhh]”hÌ)�”}”(hŒžis an identifier string. A new /proc file will be created with this name below ``/proc/sys/fs/binfmt_misc``; cannot contain slashes ``/`` for obvious reasons.”h]”(hŒOis an identifier string. A new /proc file will be created with this name below ”…”�”}”(hjÕh²hh³Nh´Nubhä)�”}”(hŒ``/proc/sys/fs/binfmt_misc``”h]”hŒ/proc/sys/fs/binfmt_misc”…”�”}”(hjÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÕubhŒ; cannot contain slashes ”…”�”}”(hjÕh²hh³Nh´Nubhä)�”}”(hŒ``/``”h]”hŒ/”…”�”}”(hjïh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÕubhŒ for obvious reasons.”…”�”}”(hjÕh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KhjÒubah}”(h]”h ]”h"]”h$]”h&]”uh1jÐhj³ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j±h³hÊh´Khj®ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj¨ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj£h²hh³Nh´Nubj§)�”}”(hŒ€``type`` is the type of recognition. Give ``M`` for magic, ``E`` for extension and ``B`` for a bpf-backed handler (see below).”h]”j­)�”}”(hhh]”j²)�”}”(hŒ~``type`` is the type of recognition. Give ``M`` for magic, ``E`` for extension and ``B`` for a bpf-backed handler (see below).”h]”(j¸)�”}”(hŒ``type``”h]”hä)�”}”(hj,h]”hŒtype”…”�”}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj*ubah}”(h]”h ]”h"]”h$]”h&]”uh1j·h³hÊh´K hj&ubjÑ)�”}”(hhh]”hÌ)�”}”(hŒuis the type of recognition. Give ``M`` for magic, ``E`` for extension and ``B`` for a bpf-backed handler (see below).”h]”(hŒ!is the type of recognition. Give ”…”�”}”(hjDh²hh³Nh´Nubhä)�”}”(hŒ``M``”h]”hŒM”…”�”}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjDubhŒ for magic, ”…”�”}”(hjDh²hh³Nh´Nubhä)�”}”(hŒ``E``”h]”hŒE”…”�”}”(hj^h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjDubhŒ for extension and ”…”�”}”(hjDh²hh³Nh´Nubhä)�”}”(hŒ``B``”h]”hŒB”…”�”}”(hjph²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjDubhŒ& for a bpf-backed handler (see below).”…”�”}”(hjDh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hjAubah}”(h]”h ]”h"]”h$]”h&]”uh1jÐhj&ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j±h³hÊh´K hj#ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj£h²hh³Nh´Nubj§)�”}”(hŒÉ``offset`` is the offset of the magic/mask in the file, counted in bytes. This defaults to 0 if you omit it (i.e. you write ``:name:type::magic...``). Ignored when using filename extension matching.”h]”j­)�”}”(hhh]”j²)�”}”(hŒÆ``offset`` is the offset of the magic/mask in the file, counted in bytes. This defaults to 0 if you omit it (i.e. you write ``:name:type::magic...``). Ignored when using filename extension matching.”h]”(j¸)�”}”(hŒ ``offset``”h]”hä)�”}”(hj­h]”hŒoffset”…”�”}”(hj¯h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj«ubah}”(h]”h ]”h"]”h$]”h&]”uh1j·h³hÊh´K$hj§ubjÑ)�”}”(hhh]”hÌ)�”}”(hŒ»is the offset of the magic/mask in the file, counted in bytes. This defaults to 0 if you omit it (i.e. you write ``:name:type::magic...``). Ignored when using filename extension matching.”h]”(hŒqis the offset of the magic/mask in the file, counted in bytes. This defaults to 0 if you omit it (i.e. you write ”…”�”}”(hjÅh²hh³Nh´Nubhä)�”}”(hŒ``:name:type::magic...``”h]”hŒ:name:type::magic...”…”�”}”(hjÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÅubhŒ2). Ignored when using filename extension matching.”…”�”}”(hjÅh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K#hjÂubah}”(h]”h ]”h"]”h$]”h&]”uh1jÐhj§ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j±h³hÊh´K$hj¤ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj£h²hh³Nh´Nubj§)�”}”(hX``magic`` is the byte sequence binfmt_misc is matching for. The magic string may contain hex-encoded characters like ``\x0a`` or ``\xA4``. Note that you must escape any NUL bytes; parsing halts at the first one. In a shell environment you might have to write ``\\x0a`` to prevent the shell from eating your ``\``. If you chose filename extension matching, this is the extension to be recognised (without the ``.``, the ``\x0a`` specials are not allowed). Extension matching is case sensitive, and slashes ``/`` are not allowed!”h]”j­)�”}”(hhh]”j²)�”}”(hX``magic`` is the byte sequence binfmt_misc is matching for. The magic string may contain hex-encoded characters like ``\x0a`` or ``\xA4``. Note that you must escape any NUL bytes; parsing halts at the first one. In a shell environment you might have to write ``\\x0a`` to prevent the shell from eating your ``\``. If you chose filename extension matching, this is the extension to be recognised (without the ``.``, the ``\x0a`` specials are not allowed). Extension matching is case sensitive, and slashes ``/`` are not allowed!”h]”(j¸)�”}”(hŒ ``magic``”h]”hä)�”}”(hj h]”hŒmagic”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j·h³hÊh´K-hjubjÑ)�”}”(hhh]”hÌ)�”}”(hXis the byte sequence binfmt_misc is matching for. The magic string may contain hex-encoded characters like ``\x0a`` or ``\xA4``. Note that you must escape any NUL bytes; parsing halts at the first one. In a shell environment you might have to write ``\\x0a`` to prevent the shell from eating your ``\``. If you chose filename extension matching, this is the extension to be recognised (without the ``.``, the ``\x0a`` specials are not allowed). Extension matching is case sensitive, and slashes ``/`` are not allowed!”h]”(hŒkis the byte sequence binfmt_misc is matching for. The magic string may contain hex-encoded characters like ”…”�”}”(hj"h²hh³Nh´Nubhä)�”}”(hŒ``\x0a``”h]”hŒ\x0a”…”�”}”(hj*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj"ubhŒ or ”…”�”}”(hj"h²hh³Nh´Nubhä)�”}”(hŒ``\xA4``”h]”hŒ\xA4”…”�”}”(hj<h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj"ubhŒz. Note that you must escape any NUL bytes; parsing halts at the first one. In a shell environment you might have to write ”…”�”}”(hj"h²hh³Nh´Nubhä)�”}”(hŒ ``\\x0a``”h]”hŒ\\x0a”…”�”}”(hjNh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj"ubhŒ' to prevent the shell from eating your ”…”�”}”(hj"h²hh³Nh´Nubhä)�”}”(hŒ``\``”h]”hŒ\”…”�”}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj"ubhŒ`. If you chose filename extension matching, this is the extension to be recognised (without the ”…”�”}”(hj"h²hh³Nh´Nubhä)�”}”(hŒ``.``”h]”hŒ.”…”�”}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj"ubhŒ, the ”…”�”}”(hj"h²hh³Nh´Nubhä)�”}”(hŒ``\x0a``”h]”hŒ\x0a”…”�”}”(hj„h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj"ubhŒQ specials are not allowed). Extension matching is case sensitive, and slashes ”…”�”}”(hj"h²hh³Nh´Nubhä)�”}”(hŒ``/``”h]”hŒ/”…”�”}”(hj–h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj"ubhŒ are not allowed!”…”�”}”(hj"h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K'hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jÐhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j±h³hÊh´K-hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjýubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj£h²hh³Nh´Nubj§)�”}”(hXI``mask`` is an (optional, defaults to all 0xff) mask. You can mask out some bits from matching by supplying a string like magic and as long as magic. The mask is anded with the byte sequence of the file. Note that you must escape any NUL bytes; parsing halts at the first one. Ignored when using filename extension matching.”h]”j­)�”}”(hhh]”j²)�”}”(hXD``mask`` is an (optional, defaults to all 0xff) mask. You can mask out some bits from matching by supplying a string like magic and as long as magic. The mask is anded with the byte sequence of the file. Note that you must escape any NUL bytes; parsing halts at the first one. Ignored when using filename extension matching.”h]”(j¸)�”}”(hŒ``mask``”h]”hä)�”}”(hjÓh]”hŒmask”…”�”}”(hjÕh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÑubah}”(h]”h ]”h"]”h$]”h&]”uh1j·h³hÊh´K3hjÍubjÑ)�”}”(hhh]”hÌ)�”}”(hX;is an (optional, defaults to all 0xff) mask. You can mask out some bits from matching by supplying a string like magic and as long as magic. The mask is anded with the byte sequence of the file. Note that you must escape any NUL bytes; parsing halts at the first one. Ignored when using filename extension matching.”h]”hX;is an (optional, defaults to all 0xff) mask. You can mask out some bits from matching by supplying a string like magic and as long as magic. The mask is anded with the byte sequence of the file. Note that you must escape any NUL bytes; parsing halts at the first one. Ignored when using filename extension matching.”…”�”}”(hjëh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K0hjèubah}”(h]”h ]”h"]”h$]”h&]”uh1jÐhjÍubeh}”(h]”h ]”h"]”h$]”h&]”uh1j±h³hÊh´K3hjÊubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjÆubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj£h²hh³Nh´Nubj§)�”}”(hŒÉ``interpreter`` is the program that should be invoked with the binary as first argument (specify the full path). For ``B`` entries this field carries the name of the bpf handler instead (see below).”h]”j­)�”}”(hhh]”j²)�”}”(hŒÆ``interpreter`` is the program that should be invoked with the binary as first argument (specify the full path). For ``B`` entries this field carries the name of the bpf handler instead (see below).”h]”(j¸)�”}”(hŒ``interpreter``”h]”hä)�”}”(hjh]”hŒ interpreter”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j·h³hÊh´K7hjubjÑ)�”}”(hhh]”hÌ)�”}”(hŒ¶is the program that should be invoked with the binary as first argument (specify the full path). For ``B`` entries this field carries the name of the bpf handler instead (see below).”h]”(hŒeis the program that should be invoked with the binary as first argument (specify the full path). For ”…”�”}”(hj6h²hh³Nh´Nubhä)�”}”(hŒ``B``”h]”hŒB”…”�”}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj6ubhŒL entries this field carries the name of the bpf handler instead (see below).”…”�”}”(hj6h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K6hj3ubah}”(h]”h ]”h"]”h$]”h&]”uh1jÐhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1j±h³hÊh´K7hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj£h²hh³Nh´Nubj§)�”}”(hX‘``flags`` is an optional field that controls several aspects of the invocation of the interpreter. It is a string of capital letters, each controls a certain aspect. The following flags are supported: ``P`` - preserve-argv[0] Legacy behavior of binfmt_misc is to overwrite the original argv[0] with the full path to the binary. When this flag is included, binfmt_misc will add an argument to the argument vector for this purpose, thus preserving the original ``argv[0]``. e.g. If your interp is set to ``/bin/foo`` and you run ``blah`` (which is in ``/usr/local/bin``), then the kernel will execute ``/bin/foo`` with ``argv[]`` set to ``["/bin/foo", "/usr/local/bin/blah", "blah"]``. The interp has to be aware of this so it can execute ``/usr/local/bin/blah`` with ``argv[]`` set to ``["blah"]``. ``O`` - open-binary Legacy behavior of binfmt_misc is to pass the full path of the binary to the interpreter as an argument. When this flag is included, binfmt_misc will open the file for reading and pass its descriptor into the auxilary vector with the key "AT_EXECFD", thus allowing the interpreter to execute non-readable binaries. This feature should be used with care - the interpreter has to be trusted not to emit the contents of the non-readable binary. ``C`` - credentials Currently, the behavior of binfmt_misc is to calculate the credentials and security token of the new process according to the interpreter. When this flag is included, these attributes are calculated according to the binary. It also implies the ``O`` flag. This feature should be used with care as the interpreter will run with root permissions when a setuid binary owned by root is run with binfmt_misc. ``F`` - fix binary The usual behaviour of binfmt_misc is to spawn the binary lazily when the misc format file is invoked. However, this doesn't work very well in the face of mount namespaces and changeroots, so the ``F`` mode opens the binary as soon as the emulation is installed and uses the opened image to spawn the emulator, meaning it is always available once installed, regardless of how the environment changes. ``T`` - transparent Run the interpreter transparently. The binary is handed to the interpreter through ``AT_EXECFD`` (``T`` implies ``O``), the argument vector is left exactly as the caller built it and the kernel labels ``/proc/pid/exe`` with the binary instead of the interpreter. The interpreter has to load the binary from ``AT_EXECFD`` and follow the ``AT_FLAGS_TRANSPARENT_INTERP`` contract. Combining ``T`` with ``P`` is rejected: transparency preserves the whole argument vector, argv[0] included. ``L`` - loader substitution Do not run the interpreter on the binary at all: load the binary itself as a fully native exec and substitute the interpreter for the loader named in the binary's ``PT_INTERP``. See the "Loader substitution" section below. ``L`` rejects ``T``, ``P``, ``O`` and ``C``; ``F`` composes. ``D`` - registered disabled The entry is created disabled instead of being matchable at once, and has to be enabled by writing ``1`` to its file before it dispatches anything. This splits a registration into creating the entry and activating it, leaving room to configure it in between - which is what a ``B`` entry that binds interpreters needs; see the bpf section below. The flag is spent on the registration and is not read back: what an entry file reports afterwards is whether it is enabled. ”h]”j­)�”}”(hhh]”j²)�”}”(hXR``flags`` is an optional field that controls several aspects of the invocation of the interpreter. It is a string of capital letters, each controls a certain aspect. The following flags are supported: ``P`` - preserve-argv[0] Legacy behavior of binfmt_misc is to overwrite the original argv[0] with the full path to the binary. When this flag is included, binfmt_misc will add an argument to the argument vector for this purpose, thus preserving the original ``argv[0]``. e.g. If your interp is set to ``/bin/foo`` and you run ``blah`` (which is in ``/usr/local/bin``), then the kernel will execute ``/bin/foo`` with ``argv[]`` set to ``["/bin/foo", "/usr/local/bin/blah", "blah"]``. The interp has to be aware of this so it can execute ``/usr/local/bin/blah`` with ``argv[]`` set to ``["blah"]``. ``O`` - open-binary Legacy behavior of binfmt_misc is to pass the full path of the binary to the interpreter as an argument. When this flag is included, binfmt_misc will open the file for reading and pass its descriptor into the auxilary vector with the key "AT_EXECFD", thus allowing the interpreter to execute non-readable binaries. This feature should be used with care - the interpreter has to be trusted not to emit the contents of the non-readable binary. ``C`` - credentials Currently, the behavior of binfmt_misc is to calculate the credentials and security token of the new process according to the interpreter. When this flag is included, these attributes are calculated according to the binary. It also implies the ``O`` flag. This feature should be used with care as the interpreter will run with root permissions when a setuid binary owned by root is run with binfmt_misc. ``F`` - fix binary The usual behaviour of binfmt_misc is to spawn the binary lazily when the misc format file is invoked. However, this doesn't work very well in the face of mount namespaces and changeroots, so the ``F`` mode opens the binary as soon as the emulation is installed and uses the opened image to spawn the emulator, meaning it is always available once installed, regardless of how the environment changes. ``T`` - transparent Run the interpreter transparently. The binary is handed to the interpreter through ``AT_EXECFD`` (``T`` implies ``O``), the argument vector is left exactly as the caller built it and the kernel labels ``/proc/pid/exe`` with the binary instead of the interpreter. The interpreter has to load the binary from ``AT_EXECFD`` and follow the ``AT_FLAGS_TRANSPARENT_INTERP`` contract. Combining ``T`` with ``P`` is rejected: transparency preserves the whole argument vector, argv[0] included. ``L`` - loader substitution Do not run the interpreter on the binary at all: load the binary itself as a fully native exec and substitute the interpreter for the loader named in the binary's ``PT_INTERP``. See the "Loader substitution" section below. ``L`` rejects ``T``, ``P``, ``O`` and ``C``; ``F`` composes. ``D`` - registered disabled The entry is created disabled instead of being matchable at once, and has to be enabled by writing ``1`` to its file before it dispatches anything. This splits a registration into creating the entry and activating it, leaving room to configure it in between - which is what a ``B`` entry that binds interpreters needs; see the bpf section below. The flag is spent on the registration and is not read back: what an entry file reports afterwards is whether it is enabled. ”h]”(j¸)�”}”(hŒ ``flags``”h]”hä)�”}”(hj{h]”hŒflags”…”�”}”(hj}h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjyubah}”(h]”h ]”h"]”h$]”h&]”uh1j·h³hÊh´KzhjuubjÑ)�”}”(hhh]”(hÌ)�”}”(hŒ¾is an optional field that controls several aspects of the invocation of the interpreter. It is a string of capital letters, each controls a certain aspect. The following flags are supported:”h]”hŒ¾is an optional field that controls several aspects of the invocation of the interpreter. It is a string of capital letters, each controls a certain aspect. The following flags are supported:”…”�”}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K:hj�ubhŒ block_quote”“”)�”}”(hXÔ ``P`` - preserve-argv[0] Legacy behavior of binfmt_misc is to overwrite the original argv[0] with the full path to the binary. When this flag is included, binfmt_misc will add an argument to the argument vector for this purpose, thus preserving the original ``argv[0]``. e.g. If your interp is set to ``/bin/foo`` and you run ``blah`` (which is in ``/usr/local/bin``), then the kernel will execute ``/bin/foo`` with ``argv[]`` set to ``["/bin/foo", "/usr/local/bin/blah", "blah"]``. The interp has to be aware of this so it can execute ``/usr/local/bin/blah`` with ``argv[]`` set to ``["blah"]``. ``O`` - open-binary Legacy behavior of binfmt_misc is to pass the full path of the binary to the interpreter as an argument. When this flag is included, binfmt_misc will open the file for reading and pass its descriptor into the auxilary vector with the key "AT_EXECFD", thus allowing the interpreter to execute non-readable binaries. This feature should be used with care - the interpreter has to be trusted not to emit the contents of the non-readable binary. ``C`` - credentials Currently, the behavior of binfmt_misc is to calculate the credentials and security token of the new process according to the interpreter. When this flag is included, these attributes are calculated according to the binary. It also implies the ``O`` flag. This feature should be used with care as the interpreter will run with root permissions when a setuid binary owned by root is run with binfmt_misc. ``F`` - fix binary The usual behaviour of binfmt_misc is to spawn the binary lazily when the misc format file is invoked. However, this doesn't work very well in the face of mount namespaces and changeroots, so the ``F`` mode opens the binary as soon as the emulation is installed and uses the opened image to spawn the emulator, meaning it is always available once installed, regardless of how the environment changes. ``T`` - transparent Run the interpreter transparently. The binary is handed to the interpreter through ``AT_EXECFD`` (``T`` implies ``O``), the argument vector is left exactly as the caller built it and the kernel labels ``/proc/pid/exe`` with the binary instead of the interpreter. The interpreter has to load the binary from ``AT_EXECFD`` and follow the ``AT_FLAGS_TRANSPARENT_INTERP`` contract. Combining ``T`` with ``P`` is rejected: transparency preserves the whole argument vector, argv[0] included. ``L`` - loader substitution Do not run the interpreter on the binary at all: load the binary itself as a fully native exec and substitute the interpreter for the loader named in the binary's ``PT_INTERP``. See the "Loader substitution" section below. ``L`` rejects ``T``, ``P``, ``O`` and ``C``; ``F`` composes. ``D`` - registered disabled The entry is created disabled instead of being matchable at once, and has to be enabled by writing ``1`` to its file before it dispatches anything. This splits a registration into creating the entry and activating it, leaving room to configure it in between - which is what a ``B`` entry that binds interpreters needs; see the bpf section below. The flag is spent on the registration and is not read back: what an entry file reports afterwards is whether it is enabled. ”h]”j­)�”}”(hhh]”(j²)�”}”(hXU``P`` - preserve-argv[0] Legacy behavior of binfmt_misc is to overwrite the original argv[0] with the full path to the binary. When this flag is included, binfmt_misc will add an argument to the argument vector for this purpose, thus preserving the original ``argv[0]``. e.g. If your interp is set to ``/bin/foo`` and you run ``blah`` (which is in ``/usr/local/bin``), then the kernel will execute ``/bin/foo`` with ``argv[]`` set to ``["/bin/foo", "/usr/local/bin/blah", "blah"]``. The interp has to be aware of this so it can execute ``/usr/local/bin/blah`` with ``argv[]`` set to ``["blah"]``.”h]”(j¸)�”}”(hŒ``P`` - preserve-argv[0]”h]”(hä)�”}”(hŒ``P``”h]”hŒP”…”�”}”(hj²h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj®ubhŒ - preserve-argv[0]”…”�”}”(hj®h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1j·h³hÊh´KFhjªubjÑ)�”}”(hhh]”hÌ)�”}”(hX<Legacy behavior of binfmt_misc is to overwrite the original argv[0] with the full path to the binary. When this flag is included, binfmt_misc will add an argument to the argument vector for this purpose, thus preserving the original ``argv[0]``. e.g. If your interp is set to ``/bin/foo`` and you run ``blah`` (which is in ``/usr/local/bin``), then the kernel will execute ``/bin/foo`` with ``argv[]`` set to ``["/bin/foo", "/usr/local/bin/blah", "blah"]``. The interp has to be aware of this so it can execute ``/usr/local/bin/blah`` with ``argv[]`` set to ``["blah"]``.”h]”(hŒéLegacy behavior of binfmt_misc is to overwrite the original argv[0] with the full path to the binary. When this flag is included, binfmt_misc will add an argument to the argument vector for this purpose, thus preserving the original ”…”�”}”(hjÍh²hh³Nh´Nubhä)�”}”(hŒ ``argv[0]``”h]”hŒargv[0]”…”�”}”(hjÕh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÍubhŒ . e.g. If your interp is set to ”…”�”}”(hjÍh²hh³Nh´Nubhä)�”}”(hŒ ``/bin/foo``”h]”hŒ/bin/foo”…”�”}”(hjçh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÍubhŒ and you run ”…”�”}”(hjÍh²hh³Nh´Nubhä)�”}”(hŒ``blah``”h]”hŒblah”…”�”}”(hjùh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÍubhŒ (which is in ”…”�”}”(hjÍh²hh³Nh´Nubhä)�”}”(hŒ``/usr/local/bin``”h]”hŒ/usr/local/bin”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÍubhŒ ), then the kernel will execute ”…”�”}”(hjÍh²hh³Nh´Nubhä)�”}”(hŒ ``/bin/foo``”h]”hŒ/bin/foo”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÍubhŒ with ”…”�”}”(hjÍh²hh³Nh´Nubhä)�”}”(hŒ ``argv[]``”h]”hŒargv[]”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÍubhŒ set to ”…”�”}”(hjÍh²hh³Nh´Nubhä)�”}”(hŒ/``["/bin/foo", "/usr/local/bin/blah", "blah"]``”h]”hŒ+["/bin/foo", "/usr/local/bin/blah", "blah"]”…”�”}”(hjAh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÍubhŒ8. The interp has to be aware of this so it can execute ”…”�”}”(hjÍh²hh³Nh´Nubhä)�”}”(hŒ``/usr/local/bin/blah``”h]”hŒ/usr/local/bin/blah”…”�”}”(hjSh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÍubhŒ with ”…”�”}”(hjÍh²hh³Nh´Nubhä)�”}”(hŒ ``argv[]``”h]”hŒargv[]”…”�”}”(hjeh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÍubhŒ set to ”…”�”}”hjÍsbhä)�”}”(hŒ ``["blah"]``”h]”hŒ["blah"]”…”�”}”(hjwh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÍubhŒ.”…”�”}”(hjÍh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K?hjÊubah}”(h]”h ]”h"]”h$]”h&]”uh1jÐhjªubeh}”(h]”h ]”h"]”h$]”h&]”uh1j±h³hÊh´KFhj§ubj²)�”}”(hXÍ``O`` - open-binary Legacy behavior of binfmt_misc is to pass the full path of the binary to the interpreter as an argument. When this flag is included, binfmt_misc will open the file for reading and pass its descriptor into the auxilary vector with the key "AT_EXECFD", thus allowing the interpreter to execute non-readable binaries. This feature should be used with care - the interpreter has to be trusted not to emit the contents of the non-readable binary.”h]”(j¸)�”}”(hŒ``O`` - open-binary”h]”(hä)�”}”(hŒ``O``”h]”hŒO”…”�”}”(hj£h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjŸubhŒ - open-binary”…”�”}”(hjŸh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1j·h³hÊh´KNhj›ubjÑ)�”}”(hhh]”hÌ)�”}”(hX¹Legacy behavior of binfmt_misc is to pass the full path of the binary to the interpreter as an argument. When this flag is included, binfmt_misc will open the file for reading and pass its descriptor into the auxilary vector with the key "AT_EXECFD", thus allowing the interpreter to execute non-readable binaries. This feature should be used with care - the interpreter has to be trusted not to emit the contents of the non-readable binary.”h]”hX½Legacy behavior of binfmt_misc is to pass the full path of the binary to the interpreter as an argument. When this flag is included, binfmt_misc will open the file for reading and pass its descriptor into the auxilary vector with the key “AT_EXECFDâ€�, thus allowing the interpreter to execute non-readable binaries. This feature should be used with care - the interpreter has to be trusted not to emit the contents of the non-readable binary.”…”�”}”(hj¾h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KIhj»ubah}”(h]”h ]”h"]”h$]”h&]”uh1jÐhj›ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j±h³hÊh´KNhj§ubj²)�”}”(hX§``C`` - credentials Currently, the behavior of binfmt_misc is to calculate the credentials and security token of the new process according to the interpreter. When this flag is included, these attributes are calculated according to the binary. It also implies the ``O`` flag. This feature should be used with care as the interpreter will run with root permissions when a setuid binary owned by root is run with binfmt_misc.”h]”(j¸)�”}”(hŒ``C`` - credentials”h]”(hä)�”}”(hŒ``C``”h]”hŒC”…”�”}”(hjàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÜubhŒ - credentials”…”�”}”(hjÜh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1j·h³hÊh´KVhjØubjÑ)�”}”(hhh]”hÌ)�”}”(hX“Currently, the behavior of binfmt_misc is to calculate the credentials and security token of the new process according to the interpreter. When this flag is included, these attributes are calculated according to the binary. It also implies the ``O`` flag. This feature should be used with care as the interpreter will run with root permissions when a setuid binary owned by root is run with binfmt_misc.”h]”(hŒôCurrently, the behavior of binfmt_misc is to calculate the credentials and security token of the new process according to the interpreter. When this flag is included, these attributes are calculated according to the binary. It also implies the ”…”�”}”(hjûh²hh³Nh´Nubhä)�”}”(hŒ``O``”h]”hŒO”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjûubhŒš flag. This feature should be used with care as the interpreter will run with root permissions when a setuid binary owned by root is run with binfmt_misc.”…”�”}”(hjûh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KQhjøubah}”(h]”h ]”h"]”h$]”h&]”uh1jÐhjØubeh}”(h]”h ]”h"]”h$]”h&]”uh1j±h³hÊh´KVhj§ubj²)�”}”(hX¤``F`` - fix binary The usual behaviour of binfmt_misc is to spawn the binary lazily when the misc format file is invoked. However, this doesn't work very well in the face of mount namespaces and changeroots, so the ``F`` mode opens the binary as soon as the emulation is installed and uses the opened image to spawn the emulator, meaning it is always available once installed, regardless of how the environment changes.”h]”(j¸)�”}”(hŒ``F`` - fix binary”h]”(hä)�”}”(hŒ``F``”h]”hŒF”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj+ubhŒ - fix binary”…”�”}”(hj+h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1j·h³hÊh´K^hj'ubjÑ)�”}”(hhh]”hÌ)�”}”(hX‘The usual behaviour of binfmt_misc is to spawn the binary lazily when the misc format file is invoked. However, this doesn't work very well in the face of mount namespaces and changeroots, so the ``F`` mode opens the binary as soon as the emulation is installed and uses the opened image to spawn the emulator, meaning it is always available once installed, regardless of how the environment changes.”h]”(hŒÇThe usual behaviour of binfmt_misc is to spawn the binary lazily when the misc format file is invoked. However, this doesn’t work very well in the face of mount namespaces and changeroots, so the ”…”�”}”(hjJh²hh³Nh´Nubhä)�”}”(hŒ``F``”h]”hŒF”…”�”}”(hjRh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjJubhŒÇ mode opens the binary as soon as the emulation is installed and uses the opened image to spawn the emulator, meaning it is always available once installed, regardless of how the environment changes.”…”�”}”(hjJh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KYhjGubah}”(h]”h ]”h"]”h$]”h&]”uh1jÐhj'ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j±h³hÊh´K^hj§ubj²)�”}”(hXù``T`` - transparent Run the interpreter transparently. The binary is handed to the interpreter through ``AT_EXECFD`` (``T`` implies ``O``), the argument vector is left exactly as the caller built it and the kernel labels ``/proc/pid/exe`` with the binary instead of the interpreter. The interpreter has to load the binary from ``AT_EXECFD`` and follow the ``AT_FLAGS_TRANSPARENT_INTERP`` contract. Combining ``T`` with ``P`` is rejected: transparency preserves the whole argument vector, argv[0] included.”h]”(j¸)�”}”(hŒ``T`` - transparent”h]”(hä)�”}”(hŒ``T``”h]”hŒT”…”�”}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjzubhŒ - transparent”…”�”}”(hjzh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1j·h³hÊh´KhhjvubjÑ)�”}”(hhh]”hÌ)�”}”(hXåRun the interpreter transparently. The binary is handed to the interpreter through ``AT_EXECFD`` (``T`` implies ``O``), the argument vector is left exactly as the caller built it and the kernel labels ``/proc/pid/exe`` with the binary instead of the interpreter. The interpreter has to load the binary from ``AT_EXECFD`` and follow the ``AT_FLAGS_TRANSPARENT_INTERP`` contract. Combining ``T`` with ``P`` is rejected: transparency preserves the whole argument vector, argv[0] included.”h]”(hŒSRun the interpreter transparently. The binary is handed to the interpreter through ”…”�”}”(hj™h²hh³Nh´Nubhä)�”}”(hŒ ``AT_EXECFD``”h]”hŒ AT_EXECFD”…”�”}”(hj¡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj™ubhŒ (”…”�”}”(hj™h²hh³Nh´Nubhä)�”}”(hŒ``T``”h]”hŒT”…”�”}”(hj³h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj™ubhŒ implies ”…”�”}”(hj™h²hh³Nh´Nubhä)�”}”(hŒ``O``”h]”hŒO”…”�”}”(hjÅh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj™ubhŒT), the argument vector is left exactly as the caller built it and the kernel labels ”…”�”}”(hj™h²hh³Nh´Nubhä)�”}”(hŒ``/proc/pid/exe``”h]”hŒ /proc/pid/exe”…”�”}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj™ubhŒY with the binary instead of the interpreter. The interpreter has to load the binary from ”…”�”}”(hj™h²hh³Nh´Nubhä)�”}”(hŒ ``AT_EXECFD``”h]”hŒ AT_EXECFD”…”�”}”(hjéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj™ubhŒ and follow the ”…”�”}”(hj™h²hh³Nh´Nubhä)�”}”(hŒ``AT_FLAGS_TRANSPARENT_INTERP``”h]”hŒAT_FLAGS_TRANSPARENT_INTERP”…”�”}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj™ubhŒ contract. Combining ”…”�”}”(hj™h²hh³Nh´Nubhä)�”}”(hŒ``T``”h]”hŒT”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj™ubhŒ with ”…”�”}”(hj™h²hh³Nh´Nubhä)�”}”(hŒ``P``”h]”hŒP”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj™ubhŒQ is rejected: transparency preserves the whole argument vector, argv[0] included.”…”�”}”(hj™h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kahj–ubah}”(h]”h ]”h"]”h$]”h&]”uh1jÐhjvubeh}”(h]”h ]”h"]”h$]”h&]”uh1j±h³hÊh´Khhj§ubj²)�”}”(hX7``L`` - loader substitution Do not run the interpreter on the binary at all: load the binary itself as a fully native exec and substitute the interpreter for the loader named in the binary's ``PT_INTERP``. See the "Loader substitution" section below. ``L`` rejects ``T``, ``P``, ``O`` and ``C``; ``F`` composes.”h]”(j¸)�”}”(hŒ``L`` - loader substitution”h]”(hä)�”}”(hŒ``L``”h]”hŒL”…”�”}”(hjKh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjGubhŒ - loader substitution”…”�”}”(hjGh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1j·h³hÊh´KohjCubjÑ)�”}”(hhh]”hÌ)�”}”(hXDo not run the interpreter on the binary at all: load the binary itself as a fully native exec and substitute the interpreter for the loader named in the binary's ``PT_INTERP``. See the "Loader substitution" section below. ``L`` rejects ``T``, ``P``, ``O`` and ``C``; ``F`` composes.”h]”(hŒ¥Do not run the interpreter on the binary at all: load the binary itself as a fully native exec and substitute the interpreter for the loader named in the binary’s ”…”�”}”(hjfh²hh³Nh´Nubhä)�”}”(hŒ ``PT_INTERP``”h]”hŒ PT_INTERP”…”�”}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjfubhŒ3. See the “Loader substitutionâ€� section below. ”…”�”}”(hjfh²hh³Nh´Nubhä)�”}”(hŒ``L``”h]”hŒL”…”�”}”(hj€h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjfubhŒ rejects ”…”�”}”(hjfh²hh³Nh´Nubhä)�”}”(hŒ``T``”h]”hŒT”…”�”}”(hj’h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjfubhŒ, ”…”�”}”(hjfh²hh³Nh´Nubhä)�”}”(hŒ``P``”h]”hŒP”…”�”}”(hj¤h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjfubhŒ, ”…”�”}”hjfsbhä)�”}”(hŒ``O``”h]”hŒO”…”�”}”(hj¶h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjfubhŒ and ”…”�”}”(hjfh²hh³Nh´Nubhä)�”}”(hŒ``C``”h]”hŒC”…”�”}”(hjÈh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjfubhŒ; ”…”�”}”(hjfh²hh³Nh´Nubhä)�”}”(hŒ``F``”h]”hŒF”…”�”}”(hjÚh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjfubhŒ composes.”…”�”}”(hjfh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kkhjcubah}”(h]”h ]”h"]”h$]”h&]”uh1jÐhjCubeh}”(h]”h ]”h"]”h$]”h&]”uh1j±h³hÊh´Kohj§ubj²)�”}”(hXó``D`` - registered disabled The entry is created disabled instead of being matchable at once, and has to be enabled by writing ``1`` to its file before it dispatches anything. This splits a registration into creating the entry and activating it, leaving room to configure it in between - which is what a ``B`` entry that binds interpreters needs; see the bpf section below. The flag is spent on the registration and is not read back: what an entry file reports afterwards is whether it is enabled. ”h]”(j¸)�”}”(hŒ``D`` - registered disabled”h]”(hä)�”}”(hŒ``D``”h]”hŒD”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjubhŒ - registered disabled”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1j·h³hÊh´KzhjþubjÑ)�”}”(hhh]”hÌ)�”}”(hXÕThe entry is created disabled instead of being matchable at once, and has to be enabled by writing ``1`` to its file before it dispatches anything. This splits a registration into creating the entry and activating it, leaving room to configure it in between - which is what a ``B`` entry that binds interpreters needs; see the bpf section below. The flag is spent on the registration and is not read back: what an entry file reports afterwards is whether it is enabled.”h]”(hŒcThe entry is created disabled instead of being matchable at once, and has to be enabled by writing ”…”�”}”(hj!h²hh³Nh´Nubhä)�”}”(hŒ``1``”h]”hŒ1”…”�”}”(hj)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj!ubhŒ¬ to its file before it dispatches anything. This splits a registration into creating the entry and activating it, leaving room to configure it in between - which is what a ”…”�”}”(hj!h²hh³Nh´Nubhä)�”}”(hŒ``B``”h]”hŒB”…”�”}”(hj;h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj!ubhŒ¼ entry that binds interpreters needs; see the bpf section below. The flag is spent on the registration and is not read back: what an entry file reports afterwards is whether it is enabled.”…”�”}”(hj!h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Krhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jÐhjþubeh}”(h]”h ]”h"]”h$]”h&]”uh1j±h³hÊh´Kzhj§ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj£ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¡h³hÊh´K>hj�ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jÐhjuubeh}”(h]”h ]”h"]”h$]”h&]”uh1j±h³hÊh´Kzhjrubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjnubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj£h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1j¡h³hÊh´Khh·h²hubhÌ)�”}”(hŒThere are some restrictions:”h]”hŒThere are some restrictions:”…”�”}”(hj‹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K|hh·h²hubj¢)�”}”(hX/- the whole register string may not exceed 1920 characters - the magic must reside in the first 128 bytes of the file, i.e. offset+size(magic) has to be less than 128 - the interpreter string may not exceed 127 characters - an interpreter used with ``C`` or ``L`` but without ``F`` has to be named by an absolute path. It is opened when the binary is executed, so a relative one would be resolved against the working directory of whoever runs the binary - the amount of pre-opened interpreters by ``F``, or bound to a ``B`` entry is limited by the ``/proc/sys/user/max_binfmt_misc_interpreters`` sysctl. A registration past the limit is refused with ``-ENOSPC``. This limits an unprivileged namespace pinning files. A nested namespace can raise only its own limit and every ancestor is charged too ”h]”j¢)�”}”(hhh]”(j§)�”}”(hŒ8the whole register string may not exceed 1920 characters”h]”hÌ)�”}”(hj¢h]”hŒ8the whole register string may not exceed 1920 characters”…”�”}”(hj¤h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K~hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj�ubj§)�”}”(hŒithe magic must reside in the first 128 bytes of the file, i.e. offset+size(magic) has to be less than 128”h]”hÌ)�”}”(hŒithe magic must reside in the first 128 bytes of the file, i.e. offset+size(magic) has to be less than 128”h]”hŒithe magic must reside in the first 128 bytes of the file, i.e. offset+size(magic) has to be less than 128”…”�”}”(hj»h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khj·ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj�ubj§)�”}”(hŒ4the interpreter string may not exceed 127 characters”h]”hÌ)�”}”(hjÑh]”hŒ4the interpreter string may not exceed 127 characters”…”�”}”(hjÓh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K�hjÏubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj�ubj§)�”}”(hŒåan interpreter used with ``C`` or ``L`` but without ``F`` has to be named by an absolute path. It is opened when the binary is executed, so a relative one would be resolved against the working directory of whoever runs the binary”h]”hÌ)�”}”(hŒåan interpreter used with ``C`` or ``L`` but without ``F`` has to be named by an absolute path. It is opened when the binary is executed, so a relative one would be resolved against the working directory of whoever runs the binary”h]”(hŒan interpreter used with ”…”�”}”(hjêh²hh³Nh´Nubhä)�”}”(hŒ``C``”h]”hŒC”…”�”}”(hjòh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjêubhŒ or ”…”�”}”(hjêh²hh³Nh´Nubhä)�”}”(hŒ``L``”h]”hŒL”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjêubhŒ but without ”…”�”}”(hjêh²hh³Nh´Nubhä)�”}”(hŒ``F``”h]”hŒF”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjêubhŒ¬ has to be named by an absolute path. It is opened when the binary is executed, so a relative one would be resolved against the working directory of whoever runs the binary”…”�”}”(hjêh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K‚hjæubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj�ubj§)�”}”(hXWthe amount of pre-opened interpreters by ``F``, or bound to a ``B`` entry is limited by the ``/proc/sys/user/max_binfmt_misc_interpreters`` sysctl. A registration past the limit is refused with ``-ENOSPC``. This limits an unprivileged namespace pinning files. A nested namespace can raise only its own limit and every ancestor is charged too ”h]”hÌ)�”}”(hXUthe amount of pre-opened interpreters by ``F``, or bound to a ``B`` entry is limited by the ``/proc/sys/user/max_binfmt_misc_interpreters`` sysctl. A registration past the limit is refused with ``-ENOSPC``. This limits an unprivileged namespace pinning files. A nested namespace can raise only its own limit and every ancestor is charged too”h]”(hŒ)the amount of pre-opened interpreters by ”…”�”}”(hj8 h²hh³Nh´Nubhä)�”}”(hŒ``F``”h]”hŒF”…”�”}”(hj@ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj8 ubhŒ, or bound to a ”…”�”}”(hj8 h²hh³Nh´Nubhä)�”}”(hŒ``B``”h]”hŒB”…”�”}”(hjR h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj8 ubhŒ entry is limited by the ”…”�”}”(hj8 h²hh³Nh´Nubhä)�”}”(hŒ/``/proc/sys/user/max_binfmt_misc_interpreters``”h]”hŒ+/proc/sys/user/max_binfmt_misc_interpreters”…”�”}”(hjd h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj8 ubhŒ7 sysctl. A registration past the limit is refused with ”…”�”}”(hj8 h²hh³Nh´Nubhä)�”}”(hŒ ``-ENOSPC``”h]”hŒ-ENOSPC”…”�”}”(hjv h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj8 ubhŒˆ. This limits an unprivileged namespace pinning files. A nested namespace can raise only its own limit and every ancestor is charged too”…”�”}”(hj8 h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K†hj4 ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj�ubeh}”(h]”h ]”h"]”h$]”h&]”j‰jŠuh1j¡h³hÊh´K~hj™ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¡h³hÊh´K~hh·h²hubhÌ)�”}”(hXTo use binfmt_misc you have to mount it first. You can mount it with ``mount -t binfmt_misc none /proc/sys/fs/binfmt_misc`` command, or you can add a line ``none /proc/sys/fs/binfmt_misc binfmt_misc defaults 0 0`` to your ``/etc/fstab`` so it auto mounts on boot.”h]”(hŒETo use binfmt_misc you have to mount it first. You can mount it with ”…”�”}”(hj  h²hh³Nh´Nubhä)�”}”(hŒ6``mount -t binfmt_misc none /proc/sys/fs/binfmt_misc``”h]”hŒ2mount -t binfmt_misc none /proc/sys/fs/binfmt_misc”…”�”}”(hj¨ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj  ubhŒ command, or you can add a line ”…”�”}”(hj  h²hh³Nh´Nubhä)�”}”(hŒ;``none /proc/sys/fs/binfmt_misc binfmt_misc defaults 0 0``”h]”hŒ7none /proc/sys/fs/binfmt_misc binfmt_misc defaults 0 0”…”�”}”(hjº h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj  ubhŒ to your ”…”�”}”(hj  h²hh³Nh´Nubhä)�”}”(hŒ``/etc/fstab``”h]”hŒ /etc/fstab”…”�”}”(hjÌ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj  ubhŒ so it auto mounts on boot.”…”�”}”(hj  h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K�hh·h²hubhÌ)�”}”(hŒ¢You may want to add the binary formats in one of your ``/etc/rc`` scripts during boot-up. Read the manual of your init program to figure out how to do this right.”h]”(hŒ6You may want to add the binary formats in one of your ”…”�”}”(hjä h²hh³Nh´Nubhä)�”}”(hŒ ``/etc/rc``”h]”hŒ/etc/rc”…”�”}”(hjì h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjä ubhŒa scripts during boot-up. Read the manual of your init program to figure out how to do this right.”…”�”}”(hjä h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K’hh·h²hubhÌ)�”}”(hŒOThink about the order of adding entries! Later added entries are matched first!”h]”hŒOThink about the order of adding entries! Later added entries are matched first!”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K–hh·h²hubhÌ)�”}”(hŒAA few examples (assumed you are in ``/proc/sys/fs/binfmt_misc``):”h]”(hŒ#A few examples (assumed you are in ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ``/proc/sys/fs/binfmt_misc``”h]”hŒ/proc/sys/fs/binfmt_misc”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhŒ):”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K™hh·h²hubj¢)�”}”(hhh]”(j§)�”}”(hX´enable support for em86 (like binfmt_em86, for Alpha AXP only):: echo ':i386:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff:/bin/em86:' > register echo ':i486:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff:/bin/em86:' > register ”h]”(hÌ)�”}”(hŒ@enable support for em86 (like binfmt_em86, for Alpha AXP only)::”h]”hŒ?enable support for em86 (like binfmt_em86, for Alpha AXP only):”…”�”}”(hj9 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K›hj5 ubj)�”}”(hXmecho ':i386:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff:/bin/em86:' > register echo ':i486:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff:/bin/em86:' > register”h]”hXmecho ':i386:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff:/bin/em86:' > register echo ':i486:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff:/bin/em86:' > register”…”�”}”hjG sbah}”(h]”h ]”h"]”h$]”h&]”j-j.uh1jh³hÊh´K�hj5 ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj2 h²hh³hÊh´Nubj§)�”}”(hŒ‡enable support for packed DOS applications (pre-configured dosemu hdimages):: echo ':DEXE:M::\x0eDEX::/usr/bin/dosexec:' > register ”h]”(hÌ)�”}”(hŒMenable support for packed DOS applications (pre-configured dosemu hdimages)::”h]”hŒLenable support for packed DOS applications (pre-configured dosemu hdimages):”…”�”}”(hj_ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hj[ ubj)�”}”(hŒ5echo ':DEXE:M::\x0eDEX::/usr/bin/dosexec:' > register”h]”hŒ5echo ':DEXE:M::\x0eDEX::/usr/bin/dosexec:' > register”…”�”}”hjm sbah}”(h]”h ]”h"]”h$]”h&]”j-j.uh1jh³hÊh´K¢hj[ ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj2 h²hh³hÊh´Nubj§)�”}”(hŒmenable support for Windows executables using wine:: echo ':DOSWin:M::MZ::/usr/local/bin/wine:' > register ”h]”(hÌ)�”}”(hŒ3enable support for Windows executables using wine::”h]”hŒ2enable support for Windows executables using wine:”…”�”}”(hj… h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¤hj� ubj)�”}”(hŒ5echo ':DOSWin:M::MZ::/usr/local/bin/wine:' > register”h]”hŒ5echo ':DOSWin:M::MZ::/usr/local/bin/wine:' > register”…”�”}”hj“ sbah}”(h]”h ]”h"]”h$]”h&]”j-j.uh1jh³hÊh´K¦hj� ubeh}”(h]”h ]”h"]”h$]”h&]”uh1j¦hj2 h²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”j‰jŠuh1j¡h³hÊh´K›hh·h²hubhÌ)�”}”(hŒ7For java support see Documentation/admin-guide/java.rst”h]”hŒ7For java support see Documentation/admin-guide/java.rst”…”�”}”(hj­ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¨hh·h²hubhÌ)�”}”(hŒîYou can enable/disable binfmt_misc or one binary type by echoing 0 (to disable) or 1 (to enable) to ``/proc/sys/fs/binfmt_misc/status`` or ``/proc/.../the_name``. Catting the file tells you the current status of ``binfmt_misc/the_entry``.”h]”(hŒdYou can enable/disable binfmt_misc or one binary type by echoing 0 (to disable) or 1 (to enable) to ”…”�”}”(hj» h²hh³Nh´Nubhä)�”}”(hŒ#``/proc/sys/fs/binfmt_misc/status``”h]”hŒ/proc/sys/fs/binfmt_misc/status”…”�”}”(hjà h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj» ubhŒ or ”…”�”}”(hj» h²hh³Nh´Nubhä)�”}”(hŒ``/proc/.../the_name``”h]”hŒ/proc/.../the_name”…”�”}”(hjÕ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj» ubhŒ3. Catting the file tells you the current status of ”…”�”}”(hj» h²hh³Nh´Nubhä)�”}”(hŒ``binfmt_misc/the_entry``”h]”hŒbinfmt_misc/the_entry”…”�”}”(hjç h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj» ubhŒ.”…”�”}”(hj» h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K«hh·h²hubhÌ)�”}”(hŒÏYou can remove one entry or all entries by echoing -1 to ``/proc/.../the_name`` or ``/proc/sys/fs/binfmt_misc/status``. A single entry can also be removed by simply unlinking (``rm``) ``/proc/.../the_name``.”h]”(hŒ9You can remove one entry or all entries by echoing -1 to ”…”�”}”(hjÿ h²hh³Nh´Nubhä)�”}”(hŒ``/proc/.../the_name``”h]”hŒ/proc/.../the_name”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÿ ubhŒ or ”…”�”}”(hjÿ h²hh³Nh´Nubhä)�”}”(hŒ#``/proc/sys/fs/binfmt_misc/status``”h]”hŒ/proc/sys/fs/binfmt_misc/status”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÿ ubhŒ:. A single entry can also be removed by simply unlinking (”…”�”}”(hjÿ h²hh³Nh´Nubhä)�”}”(hŒ``rm``”h]”hŒrm”…”�”}”(hj+ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÿ ubhŒ) ”…”�”}”(hjÿ h²hh³Nh´Nubhä)�”}”(hŒ``/proc/.../the_name``”h]”hŒ/proc/.../the_name”…”�”}”(hj= h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÿ ubhŒ.”…”�”}”(hjÿ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K°hh·h²hubh¶)�”}”(hhh]”(h»)�”}”(hŒbpf-backed handlers”h]”hŒbpf-backed handlers”…”�”}”(hjX h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjU h²hh³hÊh´K¶ubhÌ)�”}”(hX¤With ``CONFIG_BINFMT_MISC_BPF`` both the matching and the interpreter selection can be delegated to bpf programs. A handler is an instance of the ``binfmt_misc_ops`` struct_ops with a ``match`` and a ``load`` program and a ``name``. Once the struct_ops map is registered the handler can be activated with a ``B`` entry that references it by name in the ``interpreter`` field and carries neither offset, magic, nor mask::”h]”(hŒWith ”…”�”}”(hjf h²hh³Nh´Nubhä)�”}”(hŒ``CONFIG_BINFMT_MISC_BPF``”h]”hŒCONFIG_BINFMT_MISC_BPF”…”�”}”(hjn h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjf ubhŒs both the matching and the interpreter selection can be delegated to bpf programs. A handler is an instance of the ”…”�”}”(hjf h²hh³Nh´Nubhä)�”}”(hŒ``binfmt_misc_ops``”h]”hŒbinfmt_misc_ops”…”�”}”(hj€ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjf ubhŒ struct_ops with a ”…”�”}”(hjf h²hh³Nh´Nubhä)�”}”(hŒ ``match``”h]”hŒmatch”…”�”}”(hj’ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjf ubhŒ and a ”…”�”}”(hjf h²hh³Nh´Nubhä)�”}”(hŒ``load``”h]”hŒload”…”�”}”(hj¤ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjf ubhŒ program and a ”…”�”}”(hjf h²hh³Nh´Nubhä)�”}”(hŒ``name``”h]”hŒname”…”�”}”(hj¶ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjf ubhŒL. Once the struct_ops map is registered the handler can be activated with a ”…”�”}”(hjf h²hh³Nh´Nubhä)�”}”(hŒ``B``”h]”hŒB”…”�”}”(hjÈ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjf ubhŒ) entry that references it by name in the ”…”�”}”(hjf h²hh³Nh´Nubhä)�”}”(hŒ``interpreter``”h]”hŒ interpreter”…”�”}”(hjÚ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjf ubhŒ3 field and carries neither offset, magic, nor mask:”…”�”}”(hjf h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K¸hjU h²hubj)�”}”(hŒ(echo ':qemu:B::::my_handler:' > register”h]”hŒ(echo ':qemu:B::::my_handler:' > register”…”�”}”hjò sbah}”(h]”h ]”h"]”h$]”h&]”j-j.uh1jh³hÊh´K¿hjU h²hubhÌ)�”}”(hXŠBoth programs receive the ``linux_binprm`` of the binary and both can sleep. The ``match`` program decides whether the handler applies: it is consulted during the entry walk exactly like magic and extension matching, in the same registration order with the same first-match-wins semantics. Unlike static matching it is not limited to the prefetched first bytes of the file in ``bprm->buf``: it can read the file, e.g. to parse ELF program headers whose data sits at arbitrary offsets. It only decides, though: the selection kfuncs below are rejected in it. The ``load`` program of the matched handler then selects the interpreter: it can equally read the file and derive the interpreter from the binary's location. It selects the interpreter by calling the ``bpf_binprm_set_interp()`` kfunc with an absolute path and returning ``0``. A match is committed: a failing ``load`` fails the exec with its error instead of falling through to later entries; ``-ENOEXEC`` lets the remaining binary formats have a go. A path selected this way is opened with the credentials of the task doing the exec, exactly as a statically registered interpreter without ``F`` would be.”h]”(hŒBoth programs receive the ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ``linux_binprm``”h]”hŒ linux_binprm”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhŒ' of the binary and both can sleep. The ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ ``match``”h]”hŒmatch”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhX program decides whether the handler applies: it is consulted during the entry walk exactly like magic and extension matching, in the same registration order with the same first-match-wins semantics. Unlike static matching it is not limited to the prefetched first bytes of the file in ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ ``bprm->buf``”h]”hŒ bprm->buf”…”�”}”(hj, h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhŒ¬: it can read the file, e.g. to parse ELF program headers whose data sits at arbitrary offsets. It only decides, though: the selection kfuncs below are rejected in it. The ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ``load``”h]”hŒload”…”�”}”(hj> h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhŒ¾ program of the matched handler then selects the interpreter: it can equally read the file and derive the interpreter from the binary’s location. It selects the interpreter by calling the ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ``bpf_binprm_set_interp()``”h]”hŒbpf_binprm_set_interp()”…”�”}”(hjP h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhŒ+ kfunc with an absolute path and returning ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ``0``”h]”hŒ0”…”�”}”(hjb h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhŒ". A match is committed: a failing ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ``load``”h]”hŒload”…”�”}”(hjt h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhŒL fails the exec with its error instead of falling through to later entries; ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ ``-ENOEXEC``”h]”hŒ-ENOEXEC”…”�”}”(hj† h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhŒ¹ lets the remaining binary formats have a go. A path selected this way is opened with the credentials of the task doing the exec, exactly as a statically registered interpreter without ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ``F``”h]”hŒF”…”�”}”(hj˜ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhŒ would be.”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÁhjU h²hubhÌ)�”}”(hŒüAn entry can instead bind the interpreters its handler may use, so that no path is resolved at exec time at all. An entry registered with ``D`` is not matchable yet, which is what leaves it open to being given them, one ``+name path`` write at a time::”h]”(hŒŠAn entry can instead bind the interpreters its handler may use, so that no path is resolved at exec time at all. An entry registered with ”…”�”}”(hj° h²hh³Nh´Nubhä)�”}”(hŒ``D``”h]”hŒD”…”�”}”(hj¸ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj° ubhŒM is not matchable yet, which is what leaves it open to being given them, one ”…”�”}”(hj° h²hh³Nh´Nubhä)�”}”(hŒ``+name path``”h]”hŒ +name path”…”�”}”(hjÊ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj° ubhŒ write at a time:”…”�”}”(hj° h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÓhjU h²hubj)�”}”(hŒ‰echo ':qemu:B::::my_handler:D' > register echo '+aarch64 /usr/bin/qemu-aarch64' > qemu echo '+arm /usr/bin/qemu-arm' > qemu echo 1 > qemu”h]”hŒ‰echo ':qemu:B::::my_handler:D' > register echo '+aarch64 /usr/bin/qemu-aarch64' > qemu echo '+arm /usr/bin/qemu-arm' > qemu echo 1 > qemu”…”�”}”hjâ sbah}”(h]”h ]”h"]”h$]”h&]”j-j.uh1jh³hÊh´KØhjU h²hubhÌ)�”}”(hXEach path is opened during its write, in the writing process's context and with the credentials the entry file was opened with, exactly the way ``F`` pre-opens a static entry's interpreter; the paths must be absolute. The path is everything past the first space, so there is nothing it cannot express, and no interpreter has to fit in a register string. An entry binds at most 100 interpreters, and each one is charged against ``max_binfmt_misc_interpreters`` like any other binding. A write past either limit is refused with ``-ENOSPC``.”•_Žh]”(hŒ’Each path is opened during its write, in the writing process’s context and with the credentials the entry file was opened with, exactly the way ”…”�”}”(hjð h²hh³Nh´Nubhä)�”}”(hŒ``F``”h]”hŒF”…”�”}”(hjø h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjð ubhX pre-opens a static entry’s interpreter; the paths must be absolute. The path is everything past the first space, so there is nothing it cannot express, and no interpreter has to fit in a register string. An entry binds at most 100 interpreters, and each one is charged against ”…”�”}”(hjð h²hh³Nh´Nubhä)�”}”(hŒ ``max_binfmt_misc_interpreters``”h]”hŒmax_binfmt_misc_interpreters”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjð ubhŒC like any other binding. A write past either limit is refused with ”…”�”}”(hjð h²hh³Nh´Nubhä)�”}”(hŒ ``-ENOSPC``”h]”hŒ-ENOSPC”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjð ubhŒ.”…”�”}”(hjð h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KÝhjU h²hubhÌ)�”}”(hXuThe ``load`` program then selects one per exec by name with the ``bpf_binprm_select_interp()`` kfunc, and every exec runs a clone of the file that was opened. The path decides which file is bound and nothing else: it is not resolved again, in any namespace, so what it holds later - or what it holds in the namespace of whoever runs the binary - no longer decides anything.”h]”(hŒThe ”…”�”}”(hj4 h²hh³Nh´Nubhä)�”}”(hŒ``load``”h]”hŒload”…”�”}”(hj< h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj4 ubhŒ4 program then selects one per exec by name with the ”…”�”}”(hj4 h²hh³Nh´Nubhä)�”}”(hŒ``bpf_binprm_select_interp()``”h]”hŒbpf_binprm_select_interp()”…”�”}”(hjN h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj4 ubhX kfunc, and every exec runs a clone of the file that was opened. The path decides which file is bound and nothing else: it is not resolved again, in any namespace, so what it holds later - or what it holds in the namespace of whoever runs the binary - no longer decides anything.”…”�”}”(hj4 h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KæhjU h²hubhÌ)�”}”(hX~Enabling the entry ends this. Its interpreters are read at exec time with nothing but a reference held on the entry, so an entry that has ever been matchable can never have its set changed again: the first ``1`` seals it, from then on ``+`` is refused with ``-EBUSY``, and an entry registered without ``D`` is sealed from the start. Binding a name twice is refused with ``-EEXIST``.”h]”(hŒÎEnabling the entry ends this. Its interpreters are read at exec time with nothing but a reference held on the entry, so an entry that has ever been matchable can never have its set changed again: the first ”…”�”}”(hjf h²hh³Nh´Nubhä)�”}”(hŒ``1``”h]”hŒ1”…”�”}”(hjn h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjf ubhŒ seals it, from then on ”…”�”}”(hjf h²hh³Nh´Nubhä)�”}”(hŒ``+``”h]”hŒ+”…”�”}”(hj€ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjf ubhŒ is refused with ”…”�”}”(hjf h²hh³Nh´Nubhä)�”}”(hŒ ``-EBUSY``”h]”hŒ-EBUSY”…”�”}”(hj’ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjf ubhŒ", and an entry registered without ”…”�”}”(hjf h²hh³Nh´Nubhä)�”}”(hŒ``D``”h]”hŒD”…”�”}”(hj¤ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjf ubhŒ@ is sealed from the start. Binding a name twice is refused with ”…”�”}”(hjf h²hh³Nh´Nubhä)�”}”(hŒ ``-EEXIST``”h]”hŒ-EEXIST”…”�”}”(hj¶ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjf ubhŒ.”…”�”}”(hjf h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KíhjU h²hubhÌ)�”}”(hX­Selection is by name so that the configuration and the program need not agree on an order, and so that a handler is not tied to where a distribution puts its interpreters. A name is a single word of printable ASCII, at most 32 characters; a name the entry did not bind gives the program ``-ENOENT``, which it can act on or return. The interpreter runs under the path it was registered under, and the entry reports what it bound::”h]”(hXSelection is by name so that the configuration and the program need not agree on an order, and so that a handler is not tied to where a distribution puts its interpreters. A name is a single word of printable ASCII, at most 32 characters; a name the entry did not bind gives the program ”…”�”}”(hjÎ h²hh³Nh´Nubhä)�”}”(hŒ ``-ENOENT``”h]”hŒ-ENOENT”…”�”}”(hjÖ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÎ ubhŒ‚, which it can act on or return. The interpreter runs under the path it was registered under, and the entry reports what it bound:”…”�”}”(hjÎ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KôhjU h²hubj)�”}”(hŒ•$ cat /proc/sys/fs/binfmt_misc/qemu enabled bpf my_handler bpf-interpreter aarch64 /usr/bin/qemu-aarch64 bpf-interpreter arm /usr/bin/qemu-arm flags:”h]”hŒ•$ cat /proc/sys/fs/binfmt_misc/qemu enabled bpf my_handler bpf-interpreter aarch64 /usr/bin/qemu-aarch64 bpf-interpreter arm /usr/bin/qemu-arm flags:”…”�”}”hjî sbah}”(h]”h ]”h"]”h$]”h&]”j-j.uh1jh³hÊh´KûhjU h²hubhÌ)�”}”(hŒÓThe path reported is the one the interpreter was bound under, which named the file at that moment; it is not re-resolved, so it is a record of what was bound rather than a promise about what that path holds now.”h]”hŒÓThe path reported is the one the interpreter was bound under, which named the file at that moment; it is not re-resolved, so it is a record of what was bound rather than a promise about what that path holds now.”…”�”}”(hjü h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjU h²hubhÌ)�”}”(hXkThe ``load`` program can also pass a single argument to the interpreter with the ``bpf_binprm_set_interp_arg()`` kfunc. It is inserted between the interpreter and the binary, exactly like the optional argument of a ``#!`` interpreter line, e.g. for a handler that resolves ``$ORIGIN`` in a script's ``#!`` path and needs to preserve the argument that followed it.”h]”(hŒThe ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ``load``”h]”hŒload”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhŒE program can also pass a single argument to the interpreter with the ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ``bpf_binprm_set_interp_arg()``”h]”hŒbpf_binprm_set_interp_arg()”…”�”}”(hj$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhŒg kfunc. It is inserted between the interpreter and the binary, exactly like the optional argument of a ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ``#!``”h]”hŒ#!”…”�”}”(hj6h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhŒ4 interpreter line, e.g. for a handler that resolves ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ ``$ORIGIN``”h]”hŒ$ORIGIN”…”�”}”(hjHh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhŒ in a script’s ”…”�”}”(hj h²hh³Nh´Nubhä)�”}”(hŒ``#!``”h]”hŒ#!”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj ubhŒ: path and needs to preserve the argument that followed it.”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MhjU h²hubhÌ)�”}”(hXThe invocation flags a static entry fixes at registration - ``P``, ``C``, ``O``, ``T`` and ``L`` - are per-exec choices for a bpf handler, made by the ``load`` program with the ``bpf_binprm_set_flags()`` kfunc, so a single handler can decide them differently for each binary it handles:”h]”(hŒWith the ``T`` flag or ``BPF_BINPRM_TRANSPARENT`` the dispatch is invisible to the resulting process. The argument vector is left exactly as the caller built it. The binary is passed through ``AT_EXECFD``. The kernel also labels ``/proc/pid/exe`` correctly. The binary's file is write-denied while the process runs and the interpreter's is not, exactly as if the binary had been executed directly. A transparent entry does not change how credentials are derived. As with any other entry, set*id bits of the binary are only honored with ``C`` (or ``BPF_BINPRM_CREDENTIALS``).”h]”(hŒ With the ”…”�”}”(hj†h²hh³Nh´Nubhä)�”}”(hŒ``T``”h]”hŒT”…”�”}”(hjŽh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj†ubhŒ flag or ”…”�”}”(hj†h²hh³Nh´Nubhä)�”}”(hŒ``BPF_BINPRM_TRANSPARENT``”h]”hŒBPF_BINPRM_TRANSPARENT”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj†ubhŒŽ the dispatch is invisible to the resulting process. The argument vector is left exactly as the caller built it. The binary is passed through ”…”�”}”(hj†h²hh³Nh´Nubhä)�”}”(hŒ ``AT_EXECFD``”h]”hŒ AT_EXECFD”…”�”}”(hj²h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj†ubhŒ. The kernel also labels ”…”�”}”(hj†h²hh³Nh´Nubhä)�”}”(hŒ``/proc/pid/exe``”h]”hŒ /proc/pid/exe”…”�”}”(hjÄh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj†ubhX& correctly. The binary’s file is write-denied while the process runs and the interpreter’s is not, exactly as if the binary had been executed directly. A transparent entry does not change how credentials are derived. As with any other entry, set*id bits of the binary are only honored with ”…”�”}”(hj†h²hh³Nh´Nubhä)�”}”(hŒ``C``”h]”hŒC”…”�”}”(hjÖh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj†ubhŒ (or ”…”�”}”(hj†h²hh³Nh´Nubhä)�”}”(hŒ``BPF_BINPRM_CREDENTIALS``”h]”hŒBPF_BINPRM_CREDENTIALS”…”�”}”(hjèh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj†ubhŒ).”…”�”}”(hj†h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M8hjuh²hubhÌ)�”}”(hX&The interpreter has to be built for this contract. The kernel announces it with ``AT_FLAGS_TRANSPARENT_INTERP`` in the ``AT_FLAGS`` aux vector entry next to ``AT_EXECFD``. The argument vector belongs entirely to the program, nothing was spliced in, so the interpreter doesn't consume arguments and simply loads the program from the descriptor. The bit is also the loader's license to finish the identity. After mapping the program it may retarget the ``AT_PHDR``/``AT_ENTRY``/``AT_BASE`` entries of ``/proc/pid/auxv`` and the code/data statistics markers via one ``PR_SET_MM_MAP`` which completes what attaching debuggers observe. What remains visibly different from a direct execution is the address space layout. The interpreter occupies the main-image position and the program lives in the mmap region.”h]”(hŒPThe interpreter has to be built for this contract. The kernel announces it with ”…”�”}”(hjh²hh³Nh´Nubhä)�”}”(hŒ``AT_FLAGS_TRANSPARENT_INTERP``”h]”hŒAT_FLAGS_TRANSPARENT_INTERP”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjubhŒ in the ”…”�”}”(hjh²hh³Nh´Nubhä)�”}”(hŒ ``AT_FLAGS``”h]”hŒAT_FLAGS”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjubhŒ aux vector entry next to ”…”�”}”(hjh²hh³Nh´Nubhä)�”}”(hŒ ``AT_EXECFD``”h]”hŒ AT_EXECFD”…”�”}”(hj,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjubhX. The argument vector belongs entirely to the program, nothing was spliced in, so the interpreter doesn’t consume arguments and simply loads the program from the descriptor. The bit is also the loader’s license to finish the identity. After mapping the program it may retarget the ”…”�”}”(hjh²hh³Nh´Nubhä)�”}”(hŒ ``AT_PHDR``”h]”hŒAT_PHDR”…”�”}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjubhŒ/”…”�”}”(hjh²hh³Nh´Nubhä)�”}”(hŒ ``AT_ENTRY``”h]”hŒAT_ENTRY”…”�”}”(hjPh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjubhŒ/”…”�”}”hjsbhä)�”}”(hŒ ``AT_BASE``”h]”hŒAT_BASE”…”�”}”(hjbh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjubhŒ entries of ”…”�”}”(hjh²hh³Nh´Nubhä)�”}”(hŒ``/proc/pid/auxv``”h]”hŒ/proc/pid/auxv”…”�”}”(hjth²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjubhŒ. and the code/data statistics markers via one ”…”�”}”(hjh²hh³Nh´Nubhä)�”}”(hŒ``PR_SET_MM_MAP``”h]”hŒ PR_SET_MM_MAP”…”�”}”(hj†h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjubhŒâ which completes what attaching debuggers observe. What remains visibly different from a direct execution is the address space layout. The interpreter occupies the main-image position and the program lives in the mmap region.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MBhjuh²hubeh}”(h]”Œtransparent-interpreters”ah ]”h"]”Œtransparent interpreters”ah$]”h&]”uh1hµhh·h²hh³hÊh´M6ubh¶)�”}”(hhh]”(h»)�”}”(hŒLoader substitution”h]”hŒLoader substitution”…”�”}”(hj©h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj¦h²hh³hÊh´MPubhÌ)�”}”(hXThe ``L`` flag turns the execution model around. Instead of running the registered interpreter with the binary as its payload the kernel loads the matched binary itself as the main image and substitutes the registered interpreter for the loader named in the binary's ``PT_INTERP``.”h]”(hŒThe ”…”�”}”(hj·h²hh³Nh´Nubhä)�”}”(hŒ``L``”h]”hŒL”…”�”}”(hj¿h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj·ubhX flag turns the execution model around. Instead of running the registered interpreter with the binary as its payload the kernel loads the matched binary itself as the main image and substitutes the registered interpreter for the loader named in the binary’s ”…”�”}”(hj·h²hh³Nh´Nubhä)�”}”(hŒ ``PT_INTERP``”h]”hŒ PT_INTERP”…”�”}”(hjÑh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj·ubhŒ.”…”�”}”(hj·h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MRhj¦h²hubhÌ)�”}”(hXôBecause the exec is native, there is no dispatch identity to reconstruct and no contract the substitute has to implement. A stock dynamic loader works unchanged. The argument vector is untouched, credentials and ``AT_SECURE`` derive from the binary, there is no ``AT_EXECFD`` and no marker in the aux vector, the binary sits in the main-image slot with the native brk placement so ``/proc/pid/maps``, core dumps and perf mmap records have the native shape, and the identity is already complete when ``PTRACE_EVENT_EXEC`` stops the tracee. So launching under a debugger works, not just attaching. ``L`` entries are for ELF binaries of a native architecture. Foreign-arch emulation and non-ELF payloads remain the domain of the classic and transparent modes.”h]”(hŒÔBecause the exec is native, there is no dispatch identity to reconstruct and no contract the substitute has to implement. A stock dynamic loader works unchanged. The argument vector is untouched, credentials and ”…”�”}”(hjéh²hh³Nh´Nubhä)�”}”(hŒ ``AT_SECURE``”h]”hŒ AT_SECURE”…”�”}”(hjñh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjéubhŒ% derive from the binary, there is no ”…”�”}”(hjéh²hh³Nh´Nubhä)�”}”(hŒ ``AT_EXECFD``”h]”hŒ AT_EXECFD”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjéubhŒj and no marker in the aux vector, the binary sits in the main-image slot with the native brk placement so ”…”�”}”(hjéh²hh³Nh´Nubhä)�”}”(hŒ``/proc/pid/maps``”h]”hŒ/proc/pid/maps”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjéubhŒd, core dumps and perf mmap records have the native shape, and the identity is already complete when ”…”�”}”(hjéh²hh³Nh´Nubhä)�”}”(hŒ``PTRACE_EVENT_EXEC``”h]”hŒPTRACE_EVENT_EXEC”…”�”}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjéubhŒL stops the tracee. So launching under a debugger works, not just attaching. ”…”�”}”(hjéh²hh³Nh´Nubhä)�”}”(hŒ``L``”h]”hŒL”…”�”}”(hj9h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjéubhŒ› entries are for ELF binaries of a native architecture. Foreign-arch emulation and non-ELF payloads remain the domain of the classic and transparent modes.”…”�”}”(hjéh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MWhj¦h²hubhÌ)�”}”(hXnThe override applies when the format that finally claims the file is ELF with a ``PT_INTERP``. A matched binary without one or an interpreter-less ``ET_DYN`` drops the override and runs natively. A file claimed by another format - a ``#!`` script, say - is handled by that format as if the entry had not matched. ``L`` is therefore not an enforcement mechanism: it decides how a binary that asks for a loader is run, it does not guarantee that everything matching the entry runs under the substitute. A format that cannot consume the override at all instead refuses the exec with ``ENOEXEC`` before the point of no return.”h]”(hŒPThe override applies when the format that finally claims the file is ELF with a ”…”�”}”(hjQh²hh³Nh´Nubhä)�”}”(hŒ ``PT_INTERP``”h]”hŒ PT_INTERP”…”�”}”(hjYh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjQubhŒ6. A matched binary without one or an interpreter-less ”…”�”}”(hjQh²hh³Nh´Nubhä)�”}”(hŒ ``ET_DYN``”h]”hŒET_DYN”…”�”}”(hjkh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjQubhŒL drops the override and runs natively. A file claimed by another format - a ”…”�”}”(hjQh²hh³Nh´Nubhä)�”}”(hŒ``#!``”h]”hŒ#!”…”�”}”(hj}h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjQubhŒJ script, say - is handled by that format as if the entry had not matched. ”…”�”}”(hjQh²hh³Nh´Nubhä)�”}”(hŒ``L``”h]”hŒL”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjQubhX is therefore not an enforcement mechanism: it decides how a binary that asks for a loader is run, it does not guarantee that everything matching the entry runs under the substitute. A format that cannot consume the override at all instead refuses the exec with ”…”�”}”(hjQh²hh³Nh´Nubhä)�”}”(hŒ ``ENOEXEC``”h]”hŒENOEXEC”…”�”}”(hj¡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjQubhŒ before the point of no return.”…”�”}”(hjQh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mdhj¦h²hubhÌ)�”}”(hX%A wrong-architecture ELF fails the whole exec with ``ENOEXEC`` exactly as if no entry had matched. A substitute that is not ELF of the right architecture fails with ``ELIBBAD``. The usual ``PT_INTERP`` sanity checks on the binary still apply. But the segment's content is otherwise irrelevant.”h]”(hŒ3A wrong-architecture ELF fails the whole exec with ”…”�”}”(hj¹h²hh³Nh´Nubhä)�”}”(hŒ ``ENOEXEC``”h]”hŒENOEXEC”…”�”}”(hjÁh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj¹ubhŒg exactly as if no entry had matched. A substitute that is not ELF of the right architecture fails with ”…”�”}”(hj¹h²hh³Nh´Nubhä)�”}”(hŒ ``ELIBBAD``”h]”hŒELIBBAD”…”�”}”(hjÓh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj¹ubhŒ . The usual ”…”�”}”(hj¹h²hh³Nh´Nubhä)�”}”(hŒ ``PT_INTERP``”h]”hŒ PT_INTERP”…”�”}”(hjåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhj¹ubhŒ^ sanity checks on the binary still apply. But the segment’s content is otherwise irrelevant.”…”�”}”(hj¹h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mnhj¦h²hubhÌ)�”}”(hX``L`` rejects the classic-dispatch flags ``T``, ``P``, ``O`` and ``C`` at registration. ``F`` composes and is valuable: with it the substitute is opened at registration time, so later mount namespace or path changes cannot redirect it. Without it the substitute is opened when the binary is executed, and the path is resolved in the mount namespace and root of whoever runs the binary, which is why it has to be absolute. As with ``C``, register only trusted interpreters. The substituted loader runs with credentials derived from the binary.”h]”(hä)�”}”(hŒ``L``”h]”hŒL”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjýubhŒ$ rejects the classic-dispatch flags ”…”�”}”(hjýh²hh³Nh´Nubhä)�”}”(hŒ``T``”h]”hŒT”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjýubhŒ, ”…”�”}”(hjýh²hh³Nh´Nubhä)�”}”(hŒ``P``”h]”hŒP”…”�”}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjýubhŒ, ”…”�”}”hjýsbhä)�”}”(hŒ``O``”h]”hŒO”…”�”}”(hj7h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjýubhŒ and ”…”�”}”(hjýh²hh³Nh´Nubhä)�”}”(hŒ``C``”h]”hŒC”…”�”}”(hjIh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjýubhŒ at registration. ”…”�”}”(hjýh²hh³Nh´Nubhä)�”}”(hŒ``F``”h]”hŒF”…”�”}”(hj[h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjýubhXQ composes and is valuable: with it the substitute is opened at registration time, so later mount namespace or path changes cannot redirect it. Without it the substitute is opened when the binary is executed, and the path is resolved in the mount namespace and root of whoever runs the binary, which is why it has to be absolute. As with ”…”�”}”(hjýh²hh³Nh´Nubhä)�”}”(hŒ``C``”h]”hŒC”…”�”}”(hjmh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjýubhŒk, register only trusted interpreters. The substituted loader runs with credentials derived from the binary.”…”�”}”(hjýh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Mthj¦h²hubeh}”(h]”Œloader-substitution”ah ]”h"]”Œloader substitution”ah$]”h&]”uh1hµhh·h²hh³hÊh´MPubh¶)�”}”(hhh]”(h»)�”}”(hŒHints”h]”hŒHints”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj�h²hh³hÊh´MubhÌ)�”}”(hŒ¨If you want to pass special arguments to your interpreter, you can write a wrapper script for it. See :doc:`Documentation/admin-guide/java.rst <./java>` for an example.”h]”(hŒfIf you want to pass special arguments to your interpreter, you can write a wrapper script for it. See ”…”�”}”(hjžh²hh³Nh´Nubh)�”}”(hŒ2:doc:`Documentation/admin-guide/java.rst <./java>`”h]”hŒinline”“”)�”}”(hj¨h]”hŒ"Documentation/admin-guide/java.rst”…”�”}”(hj¬h²hh³Nh´Nubah}”(h]”h ]”(Œxref”Œstd”Œstd-doc”eh"]”h$]”h&]”uh1jªhj¦ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”Œadmin-guide/binfmt-misc”Œ refdomain”j·Œreftype”Œdoc”Œ refexplicit”ˆŒrefwarn”ˆŒ reftarget”Œ./java”uh1hh³hÊh´M�hjžubhŒ for an example.”…”�”}”(hjžh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M�hj�h²hubhÌ)�”}”(hŒÔYour interpreter should NOT look in the PATH for the filename; the kernel passes it the full filename (or the file descriptor) to use. Using ``$PATH`` can cause unexpected behaviour and can be a security hazard.”h]”(hŒŽYour interpreter should NOT look in the PATH for the filename; the kernel passes it the full filename (or the file descriptor) to use. Using ”…”�”}”(hjÕh²hh³Nh´Nubhä)�”}”(hŒ ``$PATH``”h]”hŒ$PATH”…”�”}”(hjÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hãhjÕubhŒ= can cause unexpected behaviour and can be a security hazard.”…”�”}”(hjÕh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´M…hj�h²hubhÌ)�”}”(hŒ6Richard Günther ”h]”(hŒRichard Günther <”…”�”}”(hjõh²hh³Nh´NubhŒ reference”“”)�”}”(hŒ#rguenth@tat.physik.uni-tuebingen.de”h]”hŒ#rguenth@tat.physik.uni-tuebingen.de”…”�”}”(hjÿh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œ*mailto:rguenth@tat.physik.uni-tuebingen.de”uh1jýhjõubhŒ>”…”�”}”(hjõh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´MŠhj�h²hubeh}”(h]”Œhints”ah ]”h"]”Œhints”ah$]”h&]”uh1hµhh·h²hh³hÊh´Mubeh}”(h]”Œ;kernel-support-for-miscellaneous-binary-formats-binfmt-misc”ah ]”h"]”Œ=kernel support for miscellaneous binary formats (binfmt_misc)”ah$]”h&]”uh1hµhhh²hh³hÊh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÊuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)�”}”(hºNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jLŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÊŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(j&j#jrjoj£j jŠj‡jjuŒ nametypes”}”(j&‰jr‰j£‰jЉj‰uh}”(j#h·jojU j juj‡j¦jj�uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.