aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler/testdata
Commit message (Collapse)AuthorAgeFilesLines
...
* pkg/compiler: special BASE argument in templatesPaul Chaignon2019-11-012-7/+21
| | | | Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
* pkg/compiler: check range is consistent with base typePaul Chaignon2019-10-252-1/+14
| | | | | | For any intN, values in the range [-MAX_INTN:MAX_INTN] are accepted. Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
* prog, pkg/compiler: alignment for integer rangesPaul Chaignon2019-10-254-1/+14
| | | | | | | | | 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>
* pkg/compiler: check first int arg is rangePaul Chaignon2019-10-251-1/+1
| | | | Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
* pkg/compiler: fix root node not visited in typedef checksPaul Chaignon2019-10-231-0/+2
| | | | | | | | | | Without this fix, the compiler throws an error 'template argument BASE is not used' for the following typedef. type templ1[BASE] BASE foo(a ptr[in, templ1[int64]]) Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
* pkg/compiler: detect unused template paramsAndrey Konovalov2019-09-041-2/+2
|
* pkg/compiler: add offsetof typeDmitry Vyukov2019-05-162-0/+4
| | | | | | 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-142-1/+4
| | | | This allows to use len[syscall:arg] expressions.
* pkg/compiler: support complex len targetsDmitry Vyukov2019-05-143-4/+62
| | | | | | | | | | 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.
* pkg/compiler: make buffer alias to ptr[array[int8]]Dmitry Vyukov2019-04-012-3/+5
| | | | | | | | | | | 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
* pkg/compiler: don't warn about the same len twiceDmitry Vyukov2019-01-311-0/+21
| | | | Also add tests for warnings while we are here.
* executor: fix handling of big-endian bitfieldsDmitry Vyukov2018-12-081-0/+1
| | | | | Currently we apply big-endian-ness and bitfield-ness in the wrong order in copyin. This leads to totally bogus result. Fix this.
* pkg/compiler: add vma64 typeDmitry Vyukov2018-11-171-0/+7
| | | | 8-byte vma is needed in several places in linux descriptions.
* pkg/compiler: prohibit subargsDmitry Vyukov2018-08-101-0/+2
|
* pkg/compiler: refactor checkTypeDmitry Vyukov2018-08-021-1/+1
| | | | | | | checkType is too long and complex. Move basic type checks and args checks into separate functions. Update #538
* pkg/compiler: support negative integersDmitry Vyukov2018-07-093-2/+10
| | | | | | 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-082-0/+25
| | | | | fmt type allows to convert intergers and resources to string representation.
* pkg/compiler: check for unused declarationsDmitry Vyukov2018-06-303-0/+51
| | | | | Error on unused structs/unions/resources/flags. Finds tons of bugs.
* pkg/compiler: add optional builtin templateDmitry Vyukov2018-05-171-0/+1
| | | | | | | type optional[T] [ val T void void ] [varlen]
* pkg/compiler: detect duplicate fields in template structsDmitry Vyukov2018-05-171-0/+1
|
* pkg/ast: support char constantsDmitry Vyukov2018-04-292-3/+4
| | | | | | | Frequently it's useful to do something like: int8['a':'z'] punctuation = ',', '-', ':'
* pkg/compiler: support size attribute for unionsDmitry Vyukov2018-03-051-0/+8
|
* pkg/compiler: add size attribute for structsDmitry Vyukov2018-03-054-2/+42
| | | | The size attribute allows to pad a struct up to the specified size.
* pkg/compiler: switch attributes from Ident to TypeDmitry Vyukov2018-03-051-0/+12
| | | | | This allows parametrized attributes like size[10]. But this is not used for now.
* pkg/compiler: prohibit len of other union optionsDmitry Vyukov2018-02-231-0/+6
|
* pkg/compiler: allow unions as syscall argumentsDmitry Vyukov2018-02-233-14/+39
| | | | | If all union options can be syscall arguments, allow the union itself as syscall argument.
* pkg/compiler: support template template argumentsDmitry Vyukov2018-02-172-0/+37
| | | | Can be useful for netfilter descriptions.
* pkg/compiler: allow len of var-len arraysDmitry Vyukov2018-02-172-2/+2
| | | | | All netfilter subsystems use this unfortunately, so demote this to a warning.
* pkg/compiler: allow unions with only 1 fieldDmitry Vyukov2018-01-272-8/+13
| | | | | | | | | | | | | Unions with only 1 field are not actually unions, and can always be replaced with the option type. However, they are still useful when there will be more options in future but currently only 1 is described. Alternatives are: - not using union (but then all existing programs will be broken when union is finally introduced) - adding a fake field (ugly and reduces fuzzer efficiency) Allow unions with only 1 field.
* pkg/compiler: fix len of parent template structDmitry Vyukov2018-01-231-0/+14
| | | | | | | | | | | | | | | | | | | | | Consider the following example: type len_templ1[DATA1, DATA2] { data DATA1 inner len_temp2[DATA2] } type len_temp2[DATA] { data DATA len len[len_templ1, int8] } Here len refers to a parent struct, but the struct is a template, so it's actual name is something like "len_templ1[int8, int16]". Currently this does not work as compiler barks at incorrect len target. Make this work.
* pkg/compiler: allow use of empty stringsDmitry Vyukov2018-01-231-2/+9
| | | | This comes up in several contexts in netfilter.
* pkg/compiler: allow strings as template argumentsDmitry Vyukov2018-01-232-1/+2
| | | | Needed for netfilter descriptions.
* pkg/compiler: support non-zero-terminated stringsDmitry Vyukov2018-01-182-2/+15
| | | | Add stringnoz type.
* pkg/compiler: support void typeDmitry Vyukov2018-01-132-2/+56
| | | | | | "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-134-22/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-8/+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/+63
| | | | | | | | | | | | | | | | | | | | | | 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.
* prog: support opt for proc typesDmitry Vyukov2018-01-061-0/+1
|
* pkg/compiler: add bitsize typeDmitry Vyukov2018-01-061-0/+1
| | | | This is need for few crypto/xfrm descriptions.
* pkg/compiler: add check that len does not refer to array with varlen elementsDmitry Vyukov2017-11-281-0/+2
| | | | | This [almost] always means a bug in descriptions. Fix all bugs identified by the check.
* pkg/compiler: don't genererate missing syscallsDmitry Vyukov2017-09-151-1/+2
| | | | | | | | We used to generate them only because manager had no idea what arch it is testing. So syscalls numbers had to match between all arches. This is not needed anymore. Also don't generate unreferenced structs/resources.
* sys, pkg/compiler: move padding computation to compilerDmitry Vyukov2017-09-041-0/+46
| | | | This makes types constant during execution, everything is precomputed.
* pkg/compiler: prohibit arrays of size 0Dmitry Vyukov2017-09-041-0/+3
| | | | This is pointless and the only case that can yield 0 static type size.
* pkg/compiler: prohibit bitfields of size 0Dmitry Vyukov2017-09-041-1/+1
| | | | | They don't work the way C bitfields work. So this will lead to confusion at least.
* pkg/compiler: don't allow bitfields in unions, args and anon typesDmitry Vyukov2017-09-041-2/+8
|
* pkg/compiler: prohibit bitfields in syscall argsDmitry Vyukov2017-09-041-0/+1
|
* pkg/compiler: reserve in/out/inout/opt namesDmitry Vyukov2017-09-041-0/+15
|
* pkg/compiler: detect resources without ctorsDmitry Vyukov2017-09-043-60/+87
| | | | Fixes #217
* pkg/compiler: verify validity of len targetsDmitry Vyukov2017-09-043-35/+63
| | | | Update #217
* pkg/compiler: detect recursive struct declarationsDmitry Vyukov2017-09-041-0/+31
| | | | Update #217