diff options
author | Mike Frysinger <vapier@gentoo.org> | 2014-10-13 18:52:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-13 20:18:16 -0400 |
commit | 43bd40e5b6eab989a2186b09d45b8ff8efd127b2 (patch) | |
tree | 922129fa1f1d53b230b543b8c7960223b5415698 /Documentation/binfmt_misc.txt | |
parent | bbaecc088245e840e59a5abe23d69cf7748b3c88 (diff) |
binfmt_misc: touch up documentation a bit
Line wrap the content to 80 cols, and add more details to various fields
to match the code. Drop reference to a website that does not exist
anymore.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/binfmt_misc.txt')
-rw-r--r-- | Documentation/binfmt_misc.txt | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/Documentation/binfmt_misc.txt b/Documentation/binfmt_misc.txt index f64372b284e8..6b1de7058371 100644 --- a/Documentation/binfmt_misc.txt +++ b/Documentation/binfmt_misc.txt | |||
@@ -15,39 +15,50 @@ First you must mount binfmt_misc: | |||
15 | mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc | 15 | mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc |
16 | 16 | ||
17 | To actually register a new binary type, you have to set up a string looking like | 17 | To actually register a new binary type, you have to set up a string looking like |
18 | :name:type:offset:magic:mask:interpreter:flags (where you can choose the ':' upon | 18 | :name:type:offset:magic:mask:interpreter:flags (where you can choose the ':' |
19 | your needs) and echo it to /proc/sys/fs/binfmt_misc/register. | 19 | upon your needs) and echo it to /proc/sys/fs/binfmt_misc/register. |
20 | |||
20 | Here is what the fields mean: | 21 | Here is what the fields mean: |
21 | - 'name' is an identifier string. A new /proc file will be created with this | 22 | - 'name' is an identifier string. A new /proc file will be created with this |
22 | name below /proc/sys/fs/binfmt_misc | 23 | name below /proc/sys/fs/binfmt_misc; cannot contain slashes '/' for obvious |
24 | reasons. | ||
23 | - 'type' is the type of recognition. Give 'M' for magic and 'E' for extension. | 25 | - 'type' is the type of recognition. Give 'M' for magic and 'E' for extension. |
24 | - 'offset' is the offset of the magic/mask in the file, counted in bytes. This | 26 | - 'offset' is the offset of the magic/mask in the file, counted in bytes. This |
25 | defaults to 0 if you omit it (i.e. you write ':name:type::magic...') | 27 | defaults to 0 if you omit it (i.e. you write ':name:type::magic...'). Ignored |
28 | when using filename extension matching. | ||
26 | - 'magic' is the byte sequence binfmt_misc is matching for. The magic string | 29 | - 'magic' is the byte sequence binfmt_misc is matching for. The magic string |
27 | may contain hex-encoded characters like \x0a or \xA4. In a shell environment | 30 | may contain hex-encoded characters like \x0a or \xA4. Note that you must |
28 | you will have to write \\x0a to prevent the shell from eating your \. | 31 | escape any NUL bytes; parsing halts at the first one. In a shell environment |
32 | you might have to write \\x0a to prevent the shell from eating your \. | ||
29 | If you chose filename extension matching, this is the extension to be | 33 | If you chose filename extension matching, this is the extension to be |
30 | recognised (without the '.', the \x0a specials are not allowed). Extension | 34 | recognised (without the '.', the \x0a specials are not allowed). Extension |
31 | matching is case sensitive! | 35 | matching is case sensitive, and slashes '/' are not allowed! |
32 | - 'mask' is an (optional, defaults to all 0xff) mask. You can mask out some | 36 | - 'mask' is an (optional, defaults to all 0xff) mask. You can mask out some |
33 | bits from matching by supplying a string like magic and as long as magic. | 37 | bits from matching by supplying a string like magic and as long as magic. |
34 | The mask is anded with the byte sequence of the file. | 38 | The mask is anded with the byte sequence of the file. Note that you must |
39 | escape any NUL bytes; parsing halts at the first one. Ignored when using | ||
40 | filename extension matching. | ||
35 | - 'interpreter' is the program that should be invoked with the binary as first | 41 | - 'interpreter' is the program that should be invoked with the binary as first |
36 | argument (specify the full path) | 42 | argument (specify the full path) |
37 | - 'flags' is an optional field that controls several aspects of the invocation | 43 | - 'flags' is an optional field that controls several aspects of the invocation |
38 | of the interpreter. It is a string of capital letters, each controls a certain | 44 | of the interpreter. It is a string of capital letters, each controls a |
39 | aspect. The following flags are supported - | 45 | certain aspect. The following flags are supported - |
40 | 'P' - preserve-argv[0]. Legacy behavior of binfmt_misc is to overwrite the | 46 | 'P' - preserve-argv[0]. Legacy behavior of binfmt_misc is to overwrite |
41 | original argv[0] with the full path to the binary. When this flag is | 47 | the original argv[0] with the full path to the binary. When this |
42 | included, binfmt_misc will add an argument to the argument vector for | 48 | flag is included, binfmt_misc will add an argument to the argument |
43 | this purpose, thus preserving the original argv[0]. | 49 | vector for this purpose, thus preserving the original argv[0]. |
50 | e.g. If your interp is set to /bin/foo and you run `blah` (which is | ||
51 | in /usr/local/bin), then the kernel will execute /bin/foo with | ||
52 | argv[] set to ["/bin/foo", "/usr/local/bin/blah", "blah"]. The | ||
53 | interp has to be aware of this so it can execute /usr/local/bin/blah | ||
54 | with argv[] set to ["blah"]. | ||
44 | 'O' - open-binary. Legacy behavior of binfmt_misc is to pass the full path | 55 | 'O' - open-binary. Legacy behavior of binfmt_misc is to pass the full path |
45 | of the binary to the interpreter as an argument. When this flag is | 56 | of the binary to the interpreter as an argument. When this flag is |
46 | included, binfmt_misc will open the file for reading and pass its | 57 | included, binfmt_misc will open the file for reading and pass its |
47 | descriptor as an argument, instead of the full path, thus allowing | 58 | descriptor as an argument, instead of the full path, thus allowing |
48 | the interpreter to execute non-readable binaries. This feature should | 59 | the interpreter to execute non-readable binaries. This feature |
49 | be used with care - the interpreter has to be trusted not to emit | 60 | should be used with care - the interpreter has to be trusted not to |
50 | the contents of the non-readable binary. | 61 | emit the contents of the non-readable binary. |
51 | 'C' - credentials. Currently, the behavior of binfmt_misc is to calculate | 62 | 'C' - credentials. Currently, the behavior of binfmt_misc is to calculate |
52 | the credentials and security token of the new process according to | 63 | the credentials and security token of the new process according to |
53 | the interpreter. When this flag is included, these attributes are | 64 | the interpreter. When this flag is included, these attributes are |
@@ -110,7 +121,4 @@ passes it the full filename (or the file descriptor) to use. Using $PATH can | |||
110 | cause unexpected behaviour and can be a security hazard. | 121 | cause unexpected behaviour and can be a security hazard. |
111 | 122 | ||
112 | 123 | ||
113 | There is a web page about binfmt_misc at | ||
114 | http://www.tat.physik.uni-tuebingen.de | ||
115 | |||
116 | Richard Günther <rguenth@tat.physik.uni-tuebingen.de> | 124 | Richard Günther <rguenth@tat.physik.uni-tuebingen.de> |