diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-09-27 14:47:44 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-09-27 14:18:05 +0000 |
| commit | 2fd13b4d7c0a65ab26933e97ffad53e6c27fa739 (patch) | |
| tree | 9d37153e0596c6b1ff5c1db5dbbf551cb7016627 /sys | |
| parent | 95d40a21f5c6887f4108ab117ce6fb1de8a2fe64 (diff) | |
sys/linux: add descriptions for binfmt_misc register/formats
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/linux/binfmt.txt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/linux/binfmt.txt b/sys/linux/binfmt.txt index 3833860d8..98a67336f 100644 --- a/sys/linux/binfmt.txt +++ b/sys/linux/binfmt.txt @@ -6,6 +6,8 @@ include <uapi/linux/elf.h> include <linux/fcntl.h> resource fd_binfmt[fd] +resource fd_binfmt_register[fd] +resource fd_binfmt_format[fd] resource ptr_binfmt_file[intptr] syz_create_resource$binfmt(file ptr[in, filename]) ptr_binfmt_file @@ -24,6 +26,12 @@ write$binfmt_elf64(fd fd_binfmt, data ptr[in, binfmt_elf64], len bytesize[data]) close$binfmt(fd fd_binfmt) +openat$binfmt_register(fd const[AT_FDCWD], file ptr[in, string["/proc/sys/fs/binfmt_misc/register"]], flags const[O_WRONLY], mode const[0]) fd_binfmt_register +write$binfmt_register(fd fd_binfmt_register, data ptr[in, binfmt_register], len bytesize[data]) + +openat$binfmt_format(fd const[AT_FDCWD], file ptr[in, string[binfmt_format_files]], flags const[O_RDWR], mode const[0]) fd_binfmt_format +write$binfmt_format(fd fd_binfmt_format, data ptr[in, string[binfmt_format_cmd]], len bytesize[data]) + define BINFMT_OPEN_FLAGS O_WRONLY | O_CREAT argv_array { @@ -31,6 +39,32 @@ argv_array { z const[0, intptr] } [packed] +# For details of the format see: +# Documentation/admin-guide/binfmt-misc.rst +binfmt_register { + colon0 const[':', int8] + name stringnoz[binfmt_names] + colon1 const[':', int8] + type stringnoz[binfmt_types] + colon2 const[':', int8] + offset fmt[dec, int64] + colon3 const[':', int8] + magic stringnoz + colon4 const[':', int8] + mask stringnoz + colon5 const[':', int8] + interpreter stringnoz[filename] + colon6 const[':', int8] + flags array[flags[binfmt_flags, int8]] +} [packed] + +# syz0/1 are pre-registered by executor, but we can delete them and them re-create. +binfmt_names = "syz0", "syz1", "syz2", "syz3" +binfmt_types = "M", "E" +binfmt_flags = 'P', 'O', 'C', 'F' +binfmt_format_cmd = "0", "1", "-1" +binfmt_format_files = "/proc/sys/fs/binfmt_misc/syz0", "/proc/sys/fs/binfmt_misc/syz1", "/proc/sys/fs/binfmt_misc/syz2", "/proc/sys/fs/binfmt_misc/syz3" + binfmt_script { hdr stringnoz["#! "] bin stringnoz[filename] |
