diff options
| author | Andrey Konovalov <andreyknvl@gmail.com> | 2017-07-24 16:43:50 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-24 16:43:50 +0200 |
| commit | 6bbb0ce7e4e15656bb20f434583cc56e2acb492e (patch) | |
| tree | 9624bcd0cecae843b31216fa5de7978d6d675572 | |
| parent | 1e06f3e00fe12ed48282e1c896f57b0c2874eb44 (diff) | |
| parent | 2b21a445652488099a64067e13b98576f78f0363 (diff) | |
Merge pull request #297 from xairy/up-fix-enconding
prog: return error instead of panic when parsing
| -rw-r--r-- | executor/syscalls.h | 3 | ||||
| -rw-r--r-- | prog/encoding.go | 2 | ||||
| -rw-r--r-- | prog/encoding_test.go | 30 | ||||
| -rw-r--r-- | sys/sys_amd64.go | 33 | ||||
| -rw-r--r-- | sys/sys_arm64.go | 33 | ||||
| -rw-r--r-- | sys/sys_ppc64le.go | 33 | ||||
| -rw-r--r-- | sys/test.txt | 13 |
7 files changed, 146 insertions, 1 deletions
diff --git a/executor/syscalls.h b/executor/syscalls.h index 7f6388789..535926cc6 100644 --- a/executor/syscalls.h +++ b/executor/syscalls.h @@ -1468,6 +1468,7 @@ static call_t syscalls[] = { {"syz_test$recur1", 1000001}, {"syz_test$recur2", 1000001}, {"syz_test$regression0", 1000001}, + {"syz_test$struct", 1000001}, {"syz_test$text_x86_16", 1000001}, {"syz_test$text_x86_32", 1000001}, {"syz_test$text_x86_64", 1000001}, @@ -2979,6 +2980,7 @@ static call_t syscalls[] = { {"syz_test$recur1", 1000001}, {"syz_test$recur2", 1000001}, {"syz_test$regression0", 1000001}, + {"syz_test$struct", 1000001}, {"syz_test$text_x86_16", 1000001}, {"syz_test$text_x86_32", 1000001}, {"syz_test$text_x86_64", 1000001}, @@ -4490,6 +4492,7 @@ static call_t syscalls[] = { {"syz_test$recur1", 1000001}, {"syz_test$recur2", 1000001}, {"syz_test$regression0", 1000001}, + {"syz_test$struct", 1000001}, {"syz_test$text_x86_16", 1000001}, {"syz_test$text_x86_32", 1000001}, {"syz_test$text_x86_64", 1000001}, diff --git a/prog/encoding.go b/prog/encoding.go index 93af09457..c9d5d40c5 100644 --- a/prog/encoding.go +++ b/prog/encoding.go @@ -216,7 +216,7 @@ func parseArg(typ sys.Type, p *parser, vars map[string]Arg) (Arg, error) { case *sys.VmaType: arg = pointerArg(typ, 0, 0, 0, nil) default: - panic(fmt.Sprintf("bad const type %+v", typ)) + return nil, fmt.Errorf("bad const type %+v", typ) } case 'r': id := p.Ident() diff --git a/prog/encoding_test.go b/prog/encoding_test.go index f23a92cc7..f4036b458 100644 --- a/prog/encoding_test.go +++ b/prog/encoding_test.go @@ -6,6 +6,7 @@ package prog import ( "fmt" "reflect" + "regexp" "sort" "testing" ) @@ -93,3 +94,32 @@ func TestCallSetRandom(t *testing.T) { } } } + +func TestDeserialize(t *testing.T) { + tests := []struct { + data string + err *regexp.Regexp + }{ + { + "syz_test$struct(&(0x7f0000000000)={0x0, {0x0}})", + nil, + }, + { + "syz_test$struct(&(0x7f0000000000)=0x0)", + regexp.MustCompile(`bad const type.*`), + }, + } + for _, test := range tests { + _, err := Deserialize([]byte(test.data)) + if err != nil { + if test.err == nil { + t.Fatalf("deserialization failed with\n%s\ndata:\n%s\n", err, test.data) + } + if !test.err.MatchString(err.Error()) { + t.Fatalf("deserialization failed with\n%s\nwhich doesn't match\n%s\ndata:\n%s\n", err, test.err, test.data) + } + } else if test.err != nil { + t.Fatalf("deserialization should have failed with:\n%s\ndata:\n%s\n", test.err, test.data) + } + } +} diff --git a/sys/sys_amd64.go b/sys/sys_amd64.go index 9f8013528..8ae510019 100644 --- a/sys/sys_amd64.go +++ b/sys/sys_amd64.go @@ -685,6 +685,8 @@ var structArray = []Type{ &StructType{TypeCommon: TypeCommon{TypeName: "syz_recur_2", IsOptional: false}}, &StructType{TypeCommon: TypeCommon{TypeName: "syz_recur_2_0", IsOptional: false}}, &StructType{TypeCommon: TypeCommon{TypeName: "syz_regression0_struct", IsOptional: false}}, + &StructType{TypeCommon: TypeCommon{TypeName: "syz_struct0", IsOptional: false}}, + &StructType{TypeCommon: TypeCommon{TypeName: "syz_struct1", IsOptional: false}}, &UnionType{TypeCommon: TypeCommon{TypeName: "syz_union0", IsOptional: false}}, &StructType{TypeCommon: TypeCommon{TypeName: "syz_union0_struct", IsOptional: false}}, &UnionType{TypeCommon: TypeCommon{TypeName: "syz_union1", IsOptional: false}}, @@ -19176,6 +19178,36 @@ var structFields = []struct { {structKey{"syz_regression0_struct", "", DirOut}, []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "f0", ArgDir: DirOut, IsOptional: false}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "f0", ArgDir: DirOut, IsOptional: false}, Kind: BufferBlobRand}}, }}, + {structKey{"syz_struct0", "", DirIn}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f0", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, + getStruct(structKey{"syz_struct1", "f1", DirIn}), + }}, + {structKey{"syz_struct0", "", DirInOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f0", ArgDir: DirInOut, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, + getStruct(structKey{"syz_struct1", "f1", DirInOut}), + }}, + {structKey{"syz_struct0", "", DirOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f0", ArgDir: DirOut, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, + getStruct(structKey{"syz_struct1", "f1", DirOut}), + }}, + {structKey{"syz_struct1", "", DirIn}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirIn, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "", DirInOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirInOut, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "", DirOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirOut, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "f1", DirIn}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirIn, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "f1", DirInOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirInOut, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "f1", DirOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirOut, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, {structKey{"syz_union0", "", DirIn}, []Type{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f0", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "f1", ArgDir: DirIn, IsOptional: false}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, Kind: ArrayRangeLen, RangeBegin: 10, RangeEnd: 10}, @@ -22904,6 +22936,7 @@ var Calls = []*Call{ &Call{Name: "syz_test$recur1", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: getStruct(structKey{"syz_recur_1", "", DirInOut})}}, NR: 1000001}, &Call{Name: "syz_test$recur2", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: getStruct(structKey{"syz_recur_2", "", DirInOut})}}, NR: 1000001}, &Call{Name: "syz_test$regression0", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: getStruct(structKey{"syz_regression0_struct", "", DirInOut})}}, NR: 1000001}, + &Call{Name: "syz_test$struct", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: getStruct(structKey{"syz_struct0", "", DirIn})}}, NR: 1000001}, &Call{Name: "syz_test$text_x86_16", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "text", FldName: "", ArgDir: DirIn, IsOptional: false}, Kind: BufferText, Text: Text_x86_16}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "a1", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}, Buf: "a0", ByteSize: 0}}, NR: 1000001}, &Call{Name: "syz_test$text_x86_32", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "text", FldName: "", ArgDir: DirIn, IsOptional: false}, Kind: BufferText, Text: Text_x86_32}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "a1", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}, Buf: "a0", ByteSize: 0}}, NR: 1000001}, &Call{Name: "syz_test$text_x86_64", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "text", FldName: "", ArgDir: DirIn, IsOptional: false}, Kind: BufferText, Text: Text_x86_64}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "a1", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}, Buf: "a0", ByteSize: 0}}, NR: 1000001}, diff --git a/sys/sys_arm64.go b/sys/sys_arm64.go index 3a99368ad..08d6d18f4 100644 --- a/sys/sys_arm64.go +++ b/sys/sys_arm64.go @@ -685,6 +685,8 @@ var structArray = []Type{ &StructType{TypeCommon: TypeCommon{TypeName: "syz_recur_2", IsOptional: false}}, &StructType{TypeCommon: TypeCommon{TypeName: "syz_recur_2_0", IsOptional: false}}, &StructType{TypeCommon: TypeCommon{TypeName: "syz_regression0_struct", IsOptional: false}}, + &StructType{TypeCommon: TypeCommon{TypeName: "syz_struct0", IsOptional: false}}, + &StructType{TypeCommon: TypeCommon{TypeName: "syz_struct1", IsOptional: false}}, &UnionType{TypeCommon: TypeCommon{TypeName: "syz_union0", IsOptional: false}}, &StructType{TypeCommon: TypeCommon{TypeName: "syz_union0_struct", IsOptional: false}}, &UnionType{TypeCommon: TypeCommon{TypeName: "syz_union1", IsOptional: false}}, @@ -19176,6 +19178,36 @@ var structFields = []struct { {structKey{"syz_regression0_struct", "", DirOut}, []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "f0", ArgDir: DirOut, IsOptional: false}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "f0", ArgDir: DirOut, IsOptional: false}, Kind: BufferBlobRand}}, }}, + {structKey{"syz_struct0", "", DirIn}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f0", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, + getStruct(structKey{"syz_struct1", "f1", DirIn}), + }}, + {structKey{"syz_struct0", "", DirInOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f0", ArgDir: DirInOut, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, + getStruct(structKey{"syz_struct1", "f1", DirInOut}), + }}, + {structKey{"syz_struct0", "", DirOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f0", ArgDir: DirOut, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, + getStruct(structKey{"syz_struct1", "f1", DirOut}), + }}, + {structKey{"syz_struct1", "", DirIn}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirIn, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "", DirInOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirInOut, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "", DirOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirOut, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "f1", DirIn}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirIn, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "f1", DirInOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirInOut, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "f1", DirOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirOut, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, {structKey{"syz_union0", "", DirIn}, []Type{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f0", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "f1", ArgDir: DirIn, IsOptional: false}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, Kind: ArrayRangeLen, RangeBegin: 10, RangeEnd: 10}, @@ -22904,6 +22936,7 @@ var Calls = []*Call{ &Call{Name: "syz_test$recur1", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: getStruct(structKey{"syz_recur_1", "", DirInOut})}}, NR: 1000001}, &Call{Name: "syz_test$recur2", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: getStruct(structKey{"syz_recur_2", "", DirInOut})}}, NR: 1000001}, &Call{Name: "syz_test$regression0", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: getStruct(structKey{"syz_regression0_struct", "", DirInOut})}}, NR: 1000001}, + &Call{Name: "syz_test$struct", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: getStruct(structKey{"syz_struct0", "", DirIn})}}, NR: 1000001}, &Call{Name: "syz_test$text_x86_16", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "text", FldName: "", ArgDir: DirIn, IsOptional: false}, Kind: BufferText, Text: Text_x86_16}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "a1", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}, Buf: "a0", ByteSize: 0}}, NR: 1000001}, &Call{Name: "syz_test$text_x86_32", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "text", FldName: "", ArgDir: DirIn, IsOptional: false}, Kind: BufferText, Text: Text_x86_32}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "a1", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}, Buf: "a0", ByteSize: 0}}, NR: 1000001}, &Call{Name: "syz_test$text_x86_64", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "text", FldName: "", ArgDir: DirIn, IsOptional: false}, Kind: BufferText, Text: Text_x86_64}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "a1", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}, Buf: "a0", ByteSize: 0}}, NR: 1000001}, diff --git a/sys/sys_ppc64le.go b/sys/sys_ppc64le.go index 69fae9ea2..cf33cd926 100644 --- a/sys/sys_ppc64le.go +++ b/sys/sys_ppc64le.go @@ -685,6 +685,8 @@ var structArray = []Type{ &StructType{TypeCommon: TypeCommon{TypeName: "syz_recur_2", IsOptional: false}}, &StructType{TypeCommon: TypeCommon{TypeName: "syz_recur_2_0", IsOptional: false}}, &StructType{TypeCommon: TypeCommon{TypeName: "syz_regression0_struct", IsOptional: false}}, + &StructType{TypeCommon: TypeCommon{TypeName: "syz_struct0", IsOptional: false}}, + &StructType{TypeCommon: TypeCommon{TypeName: "syz_struct1", IsOptional: false}}, &UnionType{TypeCommon: TypeCommon{TypeName: "syz_union0", IsOptional: false}}, &StructType{TypeCommon: TypeCommon{TypeName: "syz_union0_struct", IsOptional: false}}, &UnionType{TypeCommon: TypeCommon{TypeName: "syz_union1", IsOptional: false}}, @@ -19176,6 +19178,36 @@ var structFields = []struct { {structKey{"syz_regression0_struct", "", DirOut}, []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "f0", ArgDir: DirOut, IsOptional: false}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "f0", ArgDir: DirOut, IsOptional: false}, Kind: BufferBlobRand}}, }}, + {structKey{"syz_struct0", "", DirIn}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f0", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, + getStruct(structKey{"syz_struct1", "f1", DirIn}), + }}, + {structKey{"syz_struct0", "", DirInOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f0", ArgDir: DirInOut, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, + getStruct(structKey{"syz_struct1", "f1", DirInOut}), + }}, + {structKey{"syz_struct0", "", DirOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f0", ArgDir: DirOut, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, + getStruct(structKey{"syz_struct1", "f1", DirOut}), + }}, + {structKey{"syz_struct1", "", DirIn}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirIn, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "", DirInOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirInOut, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "", DirOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirOut, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "f1", DirIn}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirIn, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "f1", DirInOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirInOut, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, + {structKey{"syz_struct1", "f1", DirOut}, []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f0", ArgDir: DirOut, IsOptional: false}, TypeSize: 1, BigEndian: false, BitfieldLen: 0}}, + }}, {structKey{"syz_union0", "", DirIn}, []Type{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f0", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "f1", ArgDir: DirIn, IsOptional: false}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, Kind: ArrayRangeLen, RangeBegin: 10, RangeEnd: 10}, @@ -22904,6 +22936,7 @@ var Calls = []*Call{ &Call{Name: "syz_test$recur1", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: getStruct(structKey{"syz_recur_1", "", DirInOut})}}, NR: 1000001}, &Call{Name: "syz_test$recur2", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: getStruct(structKey{"syz_recur_2", "", DirInOut})}}, NR: 1000001}, &Call{Name: "syz_test$regression0", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: getStruct(structKey{"syz_regression0_struct", "", DirInOut})}}, NR: 1000001}, + &Call{Name: "syz_test$struct", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: getStruct(structKey{"syz_struct0", "", DirIn})}}, NR: 1000001}, &Call{Name: "syz_test$text_x86_16", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "text", FldName: "", ArgDir: DirIn, IsOptional: false}, Kind: BufferText, Text: Text_x86_16}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "a1", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}, Buf: "a0", ByteSize: 0}}, NR: 1000001}, &Call{Name: "syz_test$text_x86_32", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "text", FldName: "", ArgDir: DirIn, IsOptional: false}, Kind: BufferText, Text: Text_x86_32}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "a1", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}, Buf: "a0", ByteSize: 0}}, NR: 1000001}, &Call{Name: "syz_test$text_x86_64", CallName: "syz_test", Native: false, Args: []Type{&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "text", FldName: "", ArgDir: DirIn, IsOptional: false}, Kind: BufferText, Text: Text_x86_64}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "a1", ArgDir: DirIn, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}, Buf: "a0", ByteSize: 0}}, NR: 1000001}, diff --git a/sys/test.txt b/sys/test.txt index 5072cff97..af664e4d6 100644 --- a/sys/test.txt +++ b/sys/test.txt @@ -95,6 +95,19 @@ syz_align6 { f1 array[int32] } +# Structs + +syz_test$struct(a0 ptr[in, syz_struct0]) + +syz_struct0 { + f0 int64 + f1 syz_struct1 +} + +syz_struct1 { + f0 int8 +} + # Unions syz_test$union0(a0 ptr[in, syz_union0_struct]) |
