aboutsummaryrefslogtreecommitdiffstats
path: root/prog/expr.go
Commit message (Collapse)AuthorAgeFilesLines
* prog: use consistent default values for conditional unionsAleksandr Nogikh2025-06-241-1/+4
| | | | | | | | | | | | | | | | We used to assume that the default value was the last, yet when it was not specified in the serialized program, the first union option whose condition is satisfied was chosen. Let's be consistent and use the last value in both cases. Also, remember that there's a case when there's no valid default value - this happens when pkg/compiler wraps a conditional field into a union with two conditional fields. Explicitly check for this case and assume that, whatever value is set, is the correct default because in this particular case the conditions of the two union options must be mutually exclusive. Fixes #6105.
* all: fix recvcheck errorsTaras Madan2025-02-071-1/+1
|
* all: support || operator in syzlang if conditionJiao, Joey2024-11-131-0/+5
| | | | | | | | | | | ex. f3 field has logic or operator in if condition: conditional_struct { mask int32 f1 field1 (if[value[mask] & FIELD_FLAG1]) f2 int64 (if[value[mask] & FIELD_FLAG2]) f3 int64 (if[value[mask] == FIELD_FLAG1 || value[mask] == FIELD_FLAG2]) } [packed]
* prog: allow deeper nesting of conditional fields patchingAleksandr Nogikh2024-09-111-5/+8
| | | | | | | | | | | | There is a totally valid situation when we could be recursively patching conditional fields: if by changing a field's value we insert new resource constructor calls. It's a bug to skip conditional field patching for them. Allow up to 2 nested patchConditionalFields() calls and panic if there happen to be more. Add a test that reproduces the situation described above.
* prog: collect parents during arg traversalAleksandr Nogikh2024-03-211-60/+46
| | | | | This spares the need to construct a parents map for len[A, T] and conditional fields calculations.
* prog: auto-set proper conditional fields in Deserialize()Aleksandr Nogikh2024-03-131-3/+9
| | | | | | | | | Treat all default union arguments as transient and reevaluate them after the call was fully parsed. Before conditional field patching, we do need to have performed arg validation, which also reevaluates conditions. To break the cycle, make validation configurable.
* Revert "prog: auto-set proper conditional fields in Deserialize()"Aleksandr Nogikh2024-03-081-9/+3
| | | | This reverts commit 8e75c913b6f9b09cab2ad31fd7d66ea0d1703de8.
* prog: auto-set proper conditional fields in Deserialize()Aleksandr Nogikh2024-03-081-3/+9
| | | | | | | | | Treat all default union arguments as transient and reevaluate them after the call was fully parsed. Before conditional field patching, we do need to have performed arg validation, which also reevaluates conditions. To break the cycle, make validation configurable.
* prog: handle multiple matching union fieldsAleksandr Nogikh2024-02-191-32/+48
| | | | | | | | If conditions of several union fields are satisfied, select one randomly. This would be a more logical semantics. When conditional struct fields are translated to unions, negate the condition for the union alternative.
* prog: support conditional fieldsAleksandr Nogikh2024-02-191-0/+209
pkg/compiler restructures conditional fields in structures into unions, so we only have to implement the support for unions. Semantics is as follows: If a union has conditions, syzkaller picks the first field whose condition matches. Since we require the last union field to have no conditions, we can always construct an object. Changes from this commit aim at ensuring that the selected union fields always follow the rule above.