aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/compiler/testdata/errors.txt
Commit message (Collapse)AuthorAgeFilesLines
* pkg/compiler: prohibit use of direction attribute on union fieldsDmitry Vyukov2022-01-111-0/+5
| | | | | | 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-0/+21
|
* pkg/compiler: warn about confusing comments that fake directivesDmitry Vyukov2021-11-121-0/+5
| | | | | | | | It's a somewhat common mistake to write comments instead of directives: #include <foo> #define FOO BAR because that's how it's done in C. Warn about such cases.
* pkg/compiler: add more tests for templatesDmitry Vyukov2021-10-051-0/+20
| | | | Add 2 more tests for recursive templates.
* pkg/compiler: fix infinite recursion in template instantiationDmitry Vyukov2021-10-051-0/+5
| | | | | | | | | | | | | Fix a bug found by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=17240 We handled the case of infinite recursion in templates but only if the full type name matches precisely (A -> B -> A). In this case the name constantly changes due to different template arguments. Per se this is a not an error (and we have real cases that use this, e.g. when an nlattr_t contains nested nlattr_t's), but it's an error if it recurses infinitely. Restrict recursion on the same template to 10 levels.
* pkg/compiler: add glob typeJoey Jiaojg2021-05-261-1/+6
| | | | | | | | | | | | | | | | | | | | * 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
* pkg, prog: add per-field direction attributeNecip Fazil Yildiran2020-08-131-0/+10
|
* pkg/compiler: simplify and enhance handling of builtinsDmitry Vyukov2020-05-051-2/+2
| | | | | | | | | Currently we have special support for each type of builtin node. This is complex and does not scale (we may want other types in future). Prepend the builtin descriptions to the user descriptions instead. This requires a bit of special support, like not reporting any builtin descriptions as unused, but otherwise much simpler and more flexible. Does not produce any diff in generated descriptions.
* pkg/compiler: error on duplicate attributesDmitry Vyukov2020-04-191-0/+1
|
* prog: introduce call attributesDmitry Vyukov2020-04-191-0/+3
| | | | | | Add common infrastructure for syscall attributes. Add few attributes we want, but they are not implemented for now (don't affect behavior, this will follow).
* pkg/compiler: refactor attribute handlingDmitry Vyukov2020-04-191-10/+2
| | | | | | | | | | | | 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].
* pkg/compiler: add tests for generation phaseDmitry Vyukov2020-03-171-0/+2
| | | | | | Add errors3.txt with tests for errors that are produced during generation phase. Refactor tests to reduce duplication. Tidy struct/union size errors: better locations and make testable.
* pkg/compiler: define fileoff templatePaul Chaignon2019-11-011-2/+2
| | | | Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
* pkg/compiler: special BASE argument in templatesPaul Chaignon2019-11-011-4/+14
| | | | Signed-off-by: Paul Chaignon <paul.chaignon@orange.com>
* prog, pkg/compiler: alignment for integer rangesPaul Chaignon2019-10-251-0/+1
| | | | | | | | | 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: detect unused template paramsAndrey Konovalov2019-09-041-2/+2
|
* pkg/compiler: support complex len targetsDmitry Vyukov2019-05-141-1/+4
| | | | | | | | | | 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-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
* 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: 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-091-0/+1
| | | | | | 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/+12
| | | | | fmt type allows to convert intergers and resources to string representation.
* pkg/compiler: detect duplicate fields in template structsDmitry Vyukov2018-05-171-0/+1
|
* pkg/compiler: add size attribute for structsDmitry Vyukov2018-03-051-2/+14
| | | | 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: allow unions as syscall argumentsDmitry Vyukov2018-02-231-12/+22
| | | | | If all union options can be syscall arguments, allow the union itself as syscall argument.
* pkg/compiler: support template template argumentsDmitry Vyukov2018-02-171-0/+17
| | | | Can be useful for netfilter descriptions.
* pkg/compiler: allow unions with only 1 fieldDmitry Vyukov2018-01-271-8/+7
| | | | | | | | | | | | | 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: allow strings as template argumentsDmitry Vyukov2018-01-231-1/+0
| | | | Needed for netfilter descriptions.
* pkg/compiler: support non-zero-terminated stringsDmitry Vyukov2018-01-181-2/+4
| | | | Add stringnoz type.
* pkg/compiler: support void typeDmitry Vyukov2018-01-131-2/+3
| | | | | | "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-21/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: 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: verify validity of len targetsDmitry Vyukov2017-09-041-35/+3
| | | | Update #217
* pkg/compiler: detect recursive struct declarationsDmitry Vyukov2017-09-041-0/+31
| | | | Update #217
* sys: support ptr64 typeDmitry Vyukov2017-09-021-0/+4
| | | | | | 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-25/+112
| | | | | | Move most of the logic from sysgen to pkg/compiler. Update #217
* pkg/compiler: more static error checkingDmitry Vyukov2017-08-271-0/+63
Update #217