github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/test/expressions.txt (about) 1 # Copyright 2023 syzkaller project authors. All rights reserved. 2 # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 # Syscalls used for testing conditional expressions. 5 6 define FIELD_FLAG1 2 7 define FIELD_FLAG2 4 8 9 field1 { 10 f1 const[0xffffffff, int32] 11 } 12 13 conditional_struct { 14 mask int32 15 f1 field1 (if[value[mask] & FIELD_FLAG1]) 16 f2 int64 (if[value[mask] & FIELD_FLAG2]) 17 } [packed] 18 19 test$conditional_struct(a ptr[in, conditional_struct]) 20 21 parent_conditions { 22 mask int32 23 u parent_conditions_nested_union 24 s parent_conditions_nested_struct 25 } [packed] 26 27 parent_conditions_nested_union [ 28 with_flag1 int32 (if[value[parent:parent:mask] & FIELD_FLAG1]) 29 without_flag1 int64 30 ] 31 32 parent_conditions_nested_struct { 33 f0 int64 34 f1 int32 (if[value[parent_conditions:mask] & FIELD_FLAG2]) 35 } 36 37 test$parent_conditions(a ptr[in, parent_conditions]) 38 39 condition_and_align { 40 f0 int8 41 f1 int32 (if[value[f0] == 1]) 42 f2 int8 43 } [packed, align[4]] 44 45 condition_parent_align { 46 f0 int8 47 f1 condition_and_align 48 f2 int8 49 } [packed, align[4]] 50 51 conditional_struct_minimize { 52 havef0 int8 53 f0 int8 (if[value[havef0] == 1]) 54 havef1 int8 55 f1 int8 (if[value[havef1] == 1]) 56 } [packed] 57 58 test$conditional_struct_minimize(a ptr[in, conditional_struct_minimize]) 59 60 conditional_union [ 61 u1 int8 (if[value[conditional_union_parent:f1] == 0]) 62 u2 int8 63 ] 64 65 conditional_union_parent { 66 f1 int8:1 67 f2 conditional_union 68 } 69 70 test$conditional_union(a ptr[in, conditional_union_parent]) 71 72 resource cond_res[int32] 73 74 test$create_cond_resource() cond_res 75 76 conditional_resouce_struct { 77 f0 int8 78 f1 cond_res (if[value[f0] == 1]) 79 } 80 81 test$use_cond_resource(a ptr[in, conditional_resouce_struct])