~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/admin-guide/binfmt-misc.rst

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/admin-guide/binfmt-misc.rst (Version linux-6.11.5) and /Documentation/admin-guide/binfmt-misc.rst (Version linux-2.6.32.71)


  1 Kernel Support for miscellaneous Binary Format    
  2 ==============================================    
  3                                                   
  4 This Kernel feature allows you to invoke almos    
  5 every program by simply typing its name in the    
  6 This includes for example compiled Java(TM), P    
  7                                                   
  8 To achieve this you must tell binfmt_misc whic    
  9 with which binary. Binfmt_misc recognises the     
 10 at the beginning of the file with a magic byte    
 11 bits) you have supplied. Binfmt_misc can also     
 12 aka ``.com`` or ``.exe``.                         
 13                                                   
 14 First you must mount binfmt_misc::                
 15                                                   
 16         mount binfmt_misc -t binfmt_misc /proc    
 17                                                   
 18 To actually register a new binary type, you ha    
 19 ``:name:type:offset:magic:mask:interpreter:fla    
 20 ``:`` upon your needs) and echo it to ``/proc/    
 21                                                   
 22 Here is what the fields mean:                     
 23                                                   
 24 - ``name``                                        
 25    is an identifier string. A new /proc file w    
 26    name below ``/proc/sys/fs/binfmt_misc``; ca    
 27    obvious reasons.                               
 28 - ``type``                                        
 29    is the type of recognition. Give ``M`` for     
 30 - ``offset``                                      
 31    is the offset of the magic/mask in the file    
 32    defaults to 0 if you omit it (i.e. you writ    
 33    Ignored when using filename extension match    
 34 - ``magic``                                       
 35    is the byte sequence binfmt_misc is matchin    
 36    may contain hex-encoded characters like ``\    
 37    must escape any NUL bytes; parsing halts at    
 38    environment you might have to write ``\\x0a    
 39    eating your ``\``.                             
 40    If you chose filename extension matching, t    
 41    recognised (without the ``.``, the ``\x0a``    
 42    Extension    matching is case sensitive, an    
 43 - ``mask``                                        
 44    is an (optional, defaults to all 0xff) mask    
 45    bits from matching by supplying a string li    
 46    The mask is anded with the byte sequence of    
 47    escape any NUL bytes; parsing halts at the     
 48    filename extension matching.                   
 49 - ``interpreter``                                 
 50    is the program that should be invoked with     
 51    argument (specify the full path)               
 52 - ``flags``                                       
 53    is an optional field that controls several     
 54    of the interpreter. It is a string of capit    
 55    certain aspect. The following flags are sup    
 56                                                   
 57       ``P`` - preserve-argv[0]                    
 58             Legacy behavior of binfmt_misc is     
 59             the original argv[0] with the full    
 60             flag is included, binfmt_misc will    
 61             vector for this purpose, thus pres    
 62             e.g. If your interp is set to ``/b    
 63             (which is in ``/usr/local/bin``),     
 64             ``/bin/foo`` with ``argv[]`` set t    
 65             execute ``/usr/local/bin/blah``       
 66             with ``argv[]`` set to ``["blah"]`    
 67       ``O`` - open-binary                         
 68             Legacy behavior of binfmt_misc is     
 69             of the binary to the interpreter a    
 70             included, binfmt_misc will open th    
 71             descriptor as an argument, instead    
 72             the interpreter to execute non-rea    
 73             should be used with care - the int    
 74             emit the contents of the non-reada    
 75       ``C`` - credentials                         
 76             Currently, the behavior of binfmt_    
 77             the credentials and security token    
 78             the interpreter. When this flag is    
 79             calculated according to the binary    
 80             This feature should be used with c    
 81             will run with root permissions whe    
 82             is run with binfmt_misc.              
 83       ``F`` - fix binary                          
 84             The usual behaviour of binfmt_misc    
 85             binary lazily when the misc format    
 86             this doesn't work very well in the    
 87             changeroots, so the ``F`` mode ope    
 88             emulation is installed and uses th    
 89             emulator, meaning it is always ava    
 90             regardless of how the environment     
 91                                                   
 92                                                   
 93 There are some restrictions:                      
 94                                                   
 95  - the whole register string may not exceed 19    
 96  - the magic must reside in the first 128 byte    
 97    offset+size(magic) has to be less than 128     
 98  - the interpreter string may not exceed 127 c    
 99                                                   
100 To use binfmt_misc you have to mount it first.    
101 ``mount -t binfmt_misc none /proc/sys/fs/binfm    
102 a line ``none  /proc/sys/fs/binfmt_misc binfmt    
103 ``/etc/fstab`` so it auto mounts on boot.         
104                                                   
105 You may want to add the binary formats in one     
106 boot-up. Read the manual of your init program     
107 right.                                            
108                                                   
109 Think about the order of adding entries! Later    
110                                                   
111                                                   
112 A few examples (assumed you are in ``/proc/sys    
113                                                   
114 - enable support for em86 (like binfmt_em86, f    
115                                                   
116     echo ':i386:M::\x7fELF\x01\x00\x00\x00\x00    
117     echo ':i486:M::\x7fELF\x01\x00\x00\x00\x00    
118                                                   
119 - enable support for packed DOS applications (    
120                                                   
121     echo ':DEXE:M::\x0eDEX::/usr/bin/dosexec:'    
122                                                   
123 - enable support for Windows executables using    
124                                                   
125     echo ':DOSWin:M::MZ::/usr/local/bin/wine:'    
126                                                   
127 For java support see Documentation/admin-guide    
128                                                   
129                                                   
130 You can enable/disable binfmt_misc or one bina    
131 or 1 (to enable) to ``/proc/sys/fs/binfmt_misc    
132 ``/proc/.../the_name``.                           
133 Catting the file tells you the current status     
134                                                   
135 You can remove one entry or all entries by ech    
136 or ``/proc/sys/fs/binfmt_misc/status``.           
137                                                   
138                                                   
139 Hints                                             
140 -----                                             
141                                                   
142 If you want to pass special arguments to your     
143 write a wrapper script for it.                    
144 See :doc:`Documentation/admin-guide/java.rst <    
145                                                   
146 Your interpreter should NOT look in the PATH f    
147 passes it the full filename (or the file descr    
148 cause unexpected behaviour and can be a securi    
149                                                   
150                                                   
151 Richard Günther <rguenth@tat.physik.uni-tuebin    
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php