aboutsummaryrefslogtreecommitdiffstats
path: root/docs/syscall_descriptions_syntax.md
Commit message (Collapse)AuthorAgeFilesLines
* pkg/compiler: require stricter resource constructorsDmitry Vyukov2022-01-111-0/+4
| | | | | | | | | | | | | Don't consider syscalls that return resources in unions/arrays as constructors. Unions and arrays are problematic because we don't have directed generation in prog.randGen.createResource() and can fail to generate a syscall that returns a particular resource (generate a wrong union option that does not contain the necessary resource). This leads to the following panics: panic: failed to create a resource ifindex with ioctl$sock_SIOCGIFCONF Require each resource to have a constructor syscall that returns the resource outside of unions/arrays.
* pkg/compiler: prohibit use of direction attribute on union fieldsDmitry Vyukov2022-01-111-3/+1
| | | | | | Direction attributes on unions work in a confusing way and don't do what users may think they do. Now we have out_overlay attribute for structs that allows to have overlapping input and output fields.
* pkg/compiler: add out_overlay field attributeDmitry Vyukov2022-01-111-2/+25
|
* all: support exclude globs in descriptorJoey Jiao2021-06-021-1/+2
|
* all: minor glob fixesDmitry Vyukov2021-05-261-2/+3
|
* pkg/compiler: add glob typeJoey Jiaojg2021-05-261-1/+3
| | | | | | | | | | | | | | | | | | | | * all: add new typename dirname The current way to check files under sysfs or proc is: - define a string to represent each file - open the file - pass the fd to write / read / close The issues above are: - Need to know what file present on target device - Need to write openat for each file With dirname added, which will open one file in the directory randomly and then pass the fd to write/read/close. * all: use typename glob to match filename Fixes #481
* tools/check-whitespace.sh: check for trailing whitespacesDmitry Vyukov2020-09-141-1/+1
| | | | | | File types that we don't format automatically can end up with such basic untidiness as trailing whitespaces. Check for these. Remove all existing precedents.
* pkg, prog: add per-field direction attributeNecip Fazil Yildiran2020-08-131-2/+24
|
* docs: add explanation of flags typeDmitry Vyukov2020-07-091-1/+3
| | | | | * docs: add explanation of flags type * Apply suggestions from code review Co-authored-by: Marco Elver <marco.elver@gmail.com>
* Update syscall_descriptions_syntax.mdAndrey Konovalov2020-06-101-4/+4
|
* docs: suggested changes for pull-request 1797Ricardo Cañuelo2020-06-081-19/+8
| | | | https://github.com/google/syzkaller/pull/1797
* docs: more info about resources and the "enable_sysaclls" config optionRicardo Cañuelo2020-06-081-1/+32
| | | | | | | - Give some extra clarifications and examples about resources in syscall descriptions. - More details about how to use the "enable_syscalls" option. - Mention pseudo-syscalls in the general syscall description doc file.
* docs: clarify struct/union attributes in syzlangDmitry Vyukov2020-04-281-9/+5
|
* prog: add ignore_return and breaks_returns call attribtuesDmitry Vyukov2020-04-191-2/+6
| | | | | We had these hard-coded for fuchsia and linux accordingly. Replace with call attributes.
* sys/linux: add timeout call attributesDmitry Vyukov2020-04-191-1/+10
| | | | | | | Move additional call/prog timeouts to descriptions. Due to this logic duplication executor used 50ms for syz_mount_image, while pkg/csource used 100ms.
* pkg/compiler: refactor attribute handlingDmitry Vyukov2020-04-191-3/+3
| | | | | | | | | | | | Introduce common infrastructure for describing and parsing attribute instead of custom per-attribute code scattered across several locations. Change align attribute syntax from the weird align_N to align[N]. This also allows to use literal constants as N. Introduce notion of builtin constants. Currently we have only PTR_SIZE, which is needed to replace align_ptr with align[PTR_SIZE].
* docs: minor formatting in syscall_descriptions_syntax.mdDmitry Vyukov2020-02-161-1/+2
|
* pkg/ast: introduce hex-encoded string literalsDmitry Vyukov2020-02-101-4/+2
| | | | | | | | | | | | | The stringnozescapes does not make sense with filename, also we may need similar escaping for string flags. Handle escaped strings on ast level instead. This avoids introducing new type and works seamleassly with flags. As alternative I've also tried using strconv.Quote/Unquote but it leads to ugly half-escaped strings: "\xb0\x80s\xe8\xd4N\x91\xe3ڒ,\"C\x82D\xbb\x88\\i\xe2i\xc8\xe9\xd85\xb1\x14):M\xdcn" Make hex-encoded strings a separate string format instead.
* pkg/compiler: allow for escaped stringsJason A. Donenfeld2020-02-101-0/+2
| | | | | This adds stringnozescapes to allow parsing of escape sequences in strings.
* README: add proper syzkaller pronunciationDmitry Vyukov2020-02-011-1/+1
| | | | On popular request...
* docs: give syscall description language a nameDmitry Vyukov2020-02-011-1/+1
| | | | | | It is a real language. We have a real compiler. It deserves a name. Also useful for shorter references. I hereby give it a name: syzlang.
* pkg/compiler: define fileoff templatePaul Chaignon2019-11-011-1/+2
| | | | Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
* prog, pkg/compiler: alignment for integer rangesPaul Chaignon2019-10-251-3/+5
| | | | | | | | | Enables the syntax intN[start:end, alignment] for integer ranges. For instance, int32[0:10, 2] represents even 32-bit numbers between 0 and 10 included. With this change, two NEED tags in syscall descriptions can be addressed. Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
* docs: fix description of ptr typeDmitry Vyukov2019-07-221-2/+2
| | | | ptr has direction as the first argument.
* pkg/compiler: add offsetof typeDmitry Vyukov2019-05-161-0/+2
| | | | | | Similar to C offsetof gives offset of a field from the beginning of the parent struct. We have several TODOs in descriptions asking for this.
* pkg/compiler: allow to refer to syscall arguments in len pathsDmitry Vyukov2019-05-141-4/+10
| | | | This allows to use len[syscall:arg] expressions.
* pkg/compiler: support complex len targetsDmitry Vyukov2019-05-141-7/+40
| | | | | | | | | | This change adds compiler support for complex path expressions in len targets. E.g. it allows to refer to a sibling field as len[parent_struct:field:another_field]. See the docs change for details. This is just a compiler change. The feature is not yet supported by the prog package.
* Fixed a tiny typo (#1114)Yu Hao2019-04-051-1/+1
|
* pkg/compiler: make buffer alias to ptr[array[int8]]Dmitry Vyukov2019-04-011-3/+3
| | | | | | | | | | | Ptr type has special handling of direction (pointers are always input). But buffer type missed this special case all the time. Make buffer less special by aliasing to the ptr[array[int8]] type. As the result buffer type can't have optional trailing "opt" attribute because we don't have such support for templates yet. Change such cases to use ptr type directly. Fixes #1097
* docs/syscall_descriptions_syntax.md: update syntax about unionhoujingyi2019-01-171-6/+8
| | | | | | | | * Update syscall_descriptions_syntax.md * Update syscall_descriptions_syntax.md * Update syscall_descriptions_syntax.md
* Fixed a tiny typoSergey Koulikov2018-11-201-1/+1
|
* pkg/compiler: add vma64 typeDmitry Vyukov2018-11-171-1/+2
| | | | 8-byte vma is needed in several places in linux descriptions.
* pkg/compiler: support negative integersDmitry Vyukov2018-07-091-2/+3
| | | | | | Currently we have to use 0xffffffffffffffff to represent -1, and we can't express e.g. -20:20 int range. Support negative consts to fix both problems.
* prog, pkg/compiler: support fmt typeDmitry Vyukov2018-07-081-0/+3
| | | | | fmt type allows to convert intergers and resources to string representation.
* Update syscall_descriptions_syntax.mdDmitry Vyukov2018-06-041-4/+3
| | | extend resource description
* Update syscall_descriptions_syntax.mdDmitry Vyukov2018-06-041-2/+2
| | | clarify size of intptr
* pkg/compiler: add optional builtin templateDmitry Vyukov2018-05-171-4/+8
| | | | | | | type optional[T] [ val T void void ] [varlen]
* pkg/ast: support char constantsDmitry Vyukov2018-04-291-0/+15
| | | | | | | Frequently it's useful to do something like: int8['a':'z'] punctuation = ',', '-', ':'
* pkg/compiler: support non-zero terminated filenamesDmitry Vyukov2018-04-021-4/+3
| | | | | | | | | | | | | | | Now file names become: string[filename] with a possibility of using other string features: stringnoz[filename] string[filename, CONST_SIZE] and filename is left as type alias as it is commonly used: type filename string[filename]
* pkg/compiler: allow specifying static size for filename'sDmitry Vyukov2018-03-051-1/+3
| | | | Sometimes filenames are embed into structs and need to take fixed space.
* pkg/compiler: add size attribute for structsDmitry Vyukov2018-03-051-2/+11
| | | | The size attribute allows to pad a struct up to the specified size.
* pkg/compiler: support non-zero-terminated stringsDmitry Vyukov2018-01-181-0/+3
| | | | Add stringnoz type.
* pkg/compiler: support void typeDmitry Vyukov2018-01-131-0/+2
| | | | | | "void": type with static size 0 mostly useful inside of templates and varlen unions can't be syscall argument
* pkg/compiler: support type templatesDmitry Vyukov2018-01-131-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Netlink descriptions contain tons of code duplication, and need much more for proper descriptions. Introduce type templates to simplify writing such descriptions and remove code duplication. Note: type templates are experimental, have poor error handling and are subject to change. Type templates can be declared as follows: ``` type buffer[DIR] ptr[DIR, array[int8]] type fileoff[BASE] BASE type nlattr[TYPE, PAYLOAD] { nla_len len[parent, int16] nla_type const[TYPE, int16] payload PAYLOAD } [align_4] ``` and later used as follows: ``` syscall(a buffer[in], b fileoff[int64], c ptr[in, nlattr[FOO, int32]]) ```
* pkg/compiler: add builtin bool type aliasesDmitry Vyukov2018-01-081-0/+9
| | | | | | | | | | | | | | | | This adds builtin: type bool8 int8[0:1] type bool16 int16[0:1] type bool32 int32[0:1] type bool64 int64[0:1] type boolptr intptr[0:1] We used to use just int's for bools. But bool types provide several advantages: - make true/false probability equal - improve description expressiveness - reduce search space (we will take advantage of this later)
* sys: support type aliases (aka typedefs)Dmitry Vyukov2018-01-081-0/+22
| | | | | | | | | | | | | | | | | | | | | | Complex types that are often repeated can be given short type aliases using the following syntax: ``` type identifier underlying_type ``` For example: ``` type signalno int32[0:65] type net_port proc[20000, 4, int16be] ``` Then, type alias can be used instead of the underlying type in any contexts. Underlying type needs to be described as if it's a struct field, that is, with the base type if it's required. However, type alias can be used as syscall arguments as well. Underlying types are currently restricted to integer types, `ptr`, `ptr64`, `const`, `flags` and `proc` types.
* pkg/compiler: add bitsize typeDmitry Vyukov2018-01-061-2/+4
| | | | This is need for few crypto/xfrm descriptions.
* Update syscall_descriptions_syntax.mdDmitry Vyukov2017-09-131-1/+1
|
* sys: support ptr64 typeDmitry Vyukov2017-09-021-1/+2
| | | | | | ptr64 is like ptr, but always takes 8 bytes of space. Needed for some APIs. Unfortunately, most of these APIs use buffer type, so we can't use ptr64 immidiately.
* pkg/compiler: check and generate typesDmitry Vyukov2017-09-021-1/+2
| | | | | | Move most of the logic from sysgen to pkg/compiler. Update #217