diff options
| author | Andrey Konovalov <andreyknvl@google.com> | 2017-08-01 18:30:20 +0200 |
|---|---|---|
| committer | Andrey Konovalov <andreyknvl@google.com> | 2017-08-01 18:38:20 +0200 |
| commit | 1172db0ccf077bbfef7ddd176ced61c7140cb698 (patch) | |
| tree | d488163d92a1212d94bb8f6f65be7e9b8172cb7e /sys | |
| parent | 0b4392111b2785bac5b780848a5a88cc87bfd419 (diff) | |
prog: fix encoding for exec of result args
ResultArg might have const value.
Also add a test.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/sys_amd64.go | 3 | ||||
| -rw-r--r-- | sys/sys_arm64.go | 3 | ||||
| -rw-r--r-- | sys/sys_ppc64le.go | 3 | ||||
| -rw-r--r-- | sys/test.txt | 7 |
4 files changed, 16 insertions, 0 deletions
diff --git a/sys/sys_amd64.go b/sys/sys_amd64.go index 8ae510019..7c45588f9 100644 --- a/sys/sys_amd64.go +++ b/sys/sys_amd64.go @@ -85,6 +85,7 @@ var resourceArray = []*ResourceDesc{ &ResourceDesc{Name: "sock_udp", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"fd", "sock", "sock_in", "sock_udp"}, Values: []uintptr{0xffffffffffffffff, 18446744073709551516}}, &ResourceDesc{Name: "sock_udp6", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"fd", "sock", "sock_in6", "sock_udp6"}, Values: []uintptr{0xffffffffffffffff, 18446744073709551516}}, &ResourceDesc{Name: "sock_unix", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"fd", "sock", "sock_unix"}, Values: []uintptr{0xffffffffffffffff, 18446744073709551516}}, + &ResourceDesc{Name: "syz_res", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"syz_res"}, Values: []uintptr{0xffff}}, &ResourceDesc{Name: "tcp_seq_num", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"tcp_seq_num"}, Values: []uintptr{0x42424242}}, &ResourceDesc{Name: "te_session_id", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"te_session_id"}, Values: []uintptr{0}}, &ResourceDesc{Name: "time_nsec", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"time_nsec"}, Values: []uintptr{0}}, @@ -22936,6 +22937,8 @@ 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$res0", CallName: "syz_test", Native: false, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "syz_res", FldName: "ret", ArgDir: DirOut, IsOptional: false}, Desc: resource("syz_res")}, Args: []Type{}, NR: 1000001}, + &Call{Name: "syz_test$res1", CallName: "syz_test", Native: false, Args: []Type{&ResourceType{TypeCommon: TypeCommon{TypeName: "syz_res", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Desc: resource("syz_res")}}, 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}, diff --git a/sys/sys_arm64.go b/sys/sys_arm64.go index 08d6d18f4..a293fcfed 100644 --- a/sys/sys_arm64.go +++ b/sys/sys_arm64.go @@ -85,6 +85,7 @@ var resourceArray = []*ResourceDesc{ &ResourceDesc{Name: "sock_udp", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"fd", "sock", "sock_in", "sock_udp"}, Values: []uintptr{0xffffffffffffffff, 18446744073709551516}}, &ResourceDesc{Name: "sock_udp6", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"fd", "sock", "sock_in6", "sock_udp6"}, Values: []uintptr{0xffffffffffffffff, 18446744073709551516}}, &ResourceDesc{Name: "sock_unix", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"fd", "sock", "sock_unix"}, Values: []uintptr{0xffffffffffffffff, 18446744073709551516}}, + &ResourceDesc{Name: "syz_res", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"syz_res"}, Values: []uintptr{0xffff}}, &ResourceDesc{Name: "tcp_seq_num", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"tcp_seq_num"}, Values: []uintptr{0x42424242}}, &ResourceDesc{Name: "te_session_id", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"te_session_id"}, Values: []uintptr{0}}, &ResourceDesc{Name: "time_nsec", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"time_nsec"}, Values: []uintptr{0}}, @@ -22936,6 +22937,8 @@ 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$res0", CallName: "syz_test", Native: false, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "syz_res", FldName: "ret", ArgDir: DirOut, IsOptional: false}, Desc: resource("syz_res")}, Args: []Type{}, NR: 1000001}, + &Call{Name: "syz_test$res1", CallName: "syz_test", Native: false, Args: []Type{&ResourceType{TypeCommon: TypeCommon{TypeName: "syz_res", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Desc: resource("syz_res")}}, 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}, diff --git a/sys/sys_ppc64le.go b/sys/sys_ppc64le.go index cf33cd926..f1664a27f 100644 --- a/sys/sys_ppc64le.go +++ b/sys/sys_ppc64le.go @@ -85,6 +85,7 @@ var resourceArray = []*ResourceDesc{ &ResourceDesc{Name: "sock_udp", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"fd", "sock", "sock_in", "sock_udp"}, Values: []uintptr{0xffffffffffffffff, 18446744073709551516}}, &ResourceDesc{Name: "sock_udp6", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"fd", "sock", "sock_in6", "sock_udp6"}, Values: []uintptr{0xffffffffffffffff, 18446744073709551516}}, &ResourceDesc{Name: "sock_unix", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"fd", "sock", "sock_unix"}, Values: []uintptr{0xffffffffffffffff, 18446744073709551516}}, + &ResourceDesc{Name: "syz_res", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"syz_res"}, Values: []uintptr{0xffff}}, &ResourceDesc{Name: "tcp_seq_num", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"tcp_seq_num"}, Values: []uintptr{0x42424242}}, &ResourceDesc{Name: "te_session_id", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 4, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"te_session_id"}, Values: []uintptr{0}}, &ResourceDesc{Name: "time_nsec", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "resource-type", ArgDir: DirInOut, IsOptional: false}, TypeSize: 8, BigEndian: false, BitfieldLen: 0}}, Kind: []string{"time_nsec"}, Values: []uintptr{0}}, @@ -22936,6 +22937,8 @@ 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$res0", CallName: "syz_test", Native: false, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "syz_res", FldName: "ret", ArgDir: DirOut, IsOptional: false}, Desc: resource("syz_res")}, Args: []Type{}, NR: 1000001}, + &Call{Name: "syz_test$res1", CallName: "syz_test", Native: false, Args: []Type{&ResourceType{TypeCommon: TypeCommon{TypeName: "syz_res", FldName: "a0", ArgDir: DirIn, IsOptional: false}, Desc: resource("syz_res")}}, 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}, diff --git a/sys/test.txt b/sys/test.txt index af664e4d6..b0d1a7f79 100644 --- a/sys/test.txt +++ b/sys/test.txt @@ -507,3 +507,10 @@ syz_recur_2 { syz_test$recur0(a0 ptr[inout, syz_recur_0]) syz_test$recur1(a0 ptr[inout, syz_recur_1]) syz_test$recur2(a0 ptr[inout, syz_recur_2]) + +# Resources. + +resource syz_res[int32]: 0xffff + +syz_test$res0() syz_res +syz_test$res1(a0 syz_res) |
