aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux/amd64.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-11-28 14:27:28 +0100
committerDmitry Vyukov <dvyukov@google.com>2017-11-28 14:55:21 +0100
commitac93d7e1d83ffac19983e9d754a47e7808f1230e (patch)
tree3fa594e98d47bd7e23d64594e196bc6c6a4bf408 /sys/linux/amd64.go
parentafba0b55e6d3692ac33c71553cb4cf61fc6a53e4 (diff)
pkg/compiler: add check that len does not refer to array with varlen elements
This [almost] always means a bug in descriptions. Fix all bugs identified by the check.
Diffstat (limited to 'sys/linux/amd64.go')
-rw-r--r--sys/linux/amd64.go34
1 files changed, 17 insertions, 17 deletions
diff --git a/sys/linux/amd64.go b/sys/linux/amd64.go
index 28f6800e6..ba9b4939e 100644
--- a/sys/linux/amd64.go
+++ b/sys/linux/amd64.go
@@ -1601,7 +1601,7 @@ var structDescs_amd64 = []*KeyedStruct{
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 2}}, IsPad: true},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "flags", TypeSize: 4}}},
}}},
- {Key: StructKey{Name: "hidp_conninfo"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "hidp_conninfo"}, Fields: []Type{
+ {Key: StructKey{Name: "hidp_conninfo"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "hidp_conninfo", TypeSize: 148}, Fields: []Type{
&StructType{Key: StructKey{Name: "bdaddr"}, FldName: "addr"},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 2}}, IsPad: true},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "flags", TypeSize: 4}}},
@@ -1609,9 +1609,9 @@ var structDescs_amd64 = []*KeyedStruct{
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "vendor", TypeSize: 2}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "product", TypeSize: 2}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "ver", TypeSize: 2}}},
- &BufferType{TypeCommon: TypeCommon{TypeName: "array", FldName: "name"}},
+ &BufferType{TypeCommon: TypeCommon{TypeName: "array", FldName: "name", TypeSize: 128}, Kind: 1, RangeBegin: 128, RangeEnd: 128},
}}},
- {Key: StructKey{Name: "hidp_conninfo", Dir: 1}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "hidp_conninfo", ArgDir: 1}, Fields: []Type{
+ {Key: StructKey{Name: "hidp_conninfo", Dir: 1}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "hidp_conninfo", TypeSize: 148, ArgDir: 1}, Fields: []Type{
&StructType{Key: StructKey{Name: "bdaddr", Dir: 1}, FldName: "addr"},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 2}}, IsPad: true},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "flags", TypeSize: 4, ArgDir: 1}}},
@@ -1619,7 +1619,7 @@ var structDescs_amd64 = []*KeyedStruct{
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "vendor", TypeSize: 2, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "product", TypeSize: 2, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "ver", TypeSize: 2, ArgDir: 1}}},
- &BufferType{TypeCommon: TypeCommon{TypeName: "array", FldName: "name", ArgDir: 1}},
+ &BufferType{TypeCommon: TypeCommon{TypeName: "array", FldName: "name", TypeSize: 128, ArgDir: 1}, Kind: 1, RangeBegin: 128, RangeEnd: 128},
}}},
{Key: StructKey{Name: "hidp_connlist_req"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "hidp_connlist_req", TypeSize: 16}, Fields: []Type{
&LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "cnum", TypeSize: 4}}, Buf: "ci"},
@@ -3065,7 +3065,7 @@ var structDescs_amd64 = []*KeyedStruct{
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "unusabl", TypeSize: 1, ArgDir: 1}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "padding", TypeSize: 1, ArgDir: 1}}},
}}},
- {Key: StructKey{Name: "kvm_setup_opt_arm64"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "kvm_setup_opt_arm64"}, Fields: []Type{
+ {Key: StructKey{Name: "kvm_setup_opt_arm64"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "kvm_setup_opt_arm64", TypeSize: 16}, Fields: []Type{
&StructType{Key: StructKey{Name: "kvm_setup_opt_feature"}, FldName: "featur1"},
&StructType{Key: StructKey{Name: "kvm_setup_opt_feature"}, FldName: "featur2"},
}}},
@@ -3116,7 +3116,7 @@ var structDescs_amd64 = []*KeyedStruct{
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "pad2", TypeSize: 8}, BitfieldOff: 15, BitfieldLen: 1, BitfieldMdl: true}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "val", TypeSize: 8}, BitfieldOff: 16, BitfieldLen: 48}},
}}},
- {Key: StructKey{Name: "kvm_setup_opt_x86"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "kvm_setup_opt_x86"}, Fields: []Type{
+ {Key: StructKey{Name: "kvm_setup_opt_x86"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "kvm_setup_opt_x86", TypeSize: 16}, Fields: []Type{
&StructType{Key: StructKey{Name: "kvm_setup_opt_cr0"}, FldName: "cr0"},
&StructType{Key: StructKey{Name: "kvm_setup_opt_cr4"}, FldName: "cr4"},
&StructType{Key: StructKey{Name: "kvm_setup_opt_efer"}, FldName: "efer"},
@@ -3176,7 +3176,7 @@ var structDescs_amd64 = []*KeyedStruct{
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "text", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "text"}, Kind: 4, Text: 4}},
&LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "size", TypeSize: 8}}, Buf: "text"},
}}},
- {Key: StructKey{Name: "kvm_text_x86"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "kvm_text_x86"}, Fields: []Type{
+ {Key: StructKey{Name: "kvm_text_x86"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "kvm_text_x86", TypeSize: 24}, Fields: []Type{
&StructType{Key: StructKey{Name: "kvm_text_x86_real"}, FldName: "textreal"},
&StructType{Key: StructKey{Name: "kvm_text_x86_16"}, FldName: "text16"},
&StructType{Key: StructKey{Name: "kvm_text_x86_32"}, FldName: "text32"},
@@ -3880,7 +3880,7 @@ var structDescs_amd64 = []*KeyedStruct{
}}},
{Key: StructKey{Name: "sctp_getaddrs_old", Dir: 2}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "sctp_getaddrs_old", TypeSize: 16, ArgDir: 2}, Fields: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "assoc_id", FldName: "assoc_id", TypeSize: 4, ArgDir: 2}},
- &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "addr_num", TypeSize: 4, ArgDir: 2}}, Buf: "addrs"},
+ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "addr_num", TypeSize: 4, ArgDir: 2}}, ByteSize: 1, Buf: "addrs"},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "addrs", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array"}, Type: &UnionType{Key: StructKey{Name: "sockaddr_sctp"}}}},
}}},
{Key: StructKey{Name: "sctp_hmacalgo"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "sctp_hmacalgo"}, Fields: []Type{
@@ -12853,21 +12853,21 @@ var syscalls_amd64 = []*Syscall{
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "level", TypeSize: 8}}, Val: 132},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "opt", TypeSize: 8}}, Val: 101},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "val", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array"}, Type: &UnionType{Key: StructKey{Name: "sockaddr_sctp"}}}},
- &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "val"},
+ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "len", TypeSize: 8}}, ByteSize: 1, Buf: "val"},
}},
{ID: 1243, NR: 54, Name: "setsockopt$inet_sctp6_SCTP_SOCKOPT_CONNECTX", CallName: "setsockopt", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "sock_sctp6", FldName: "fd", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "level", TypeSize: 8}}, Val: 132},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "opt", TypeSize: 8}}, Val: 110},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "val", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array"}, Type: &UnionType{Key: StructKey{Name: "sockaddr_sctp"}}}},
- &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "val"},
+ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "len", TypeSize: 8}}, ByteSize: 1, Buf: "val"},
}},
{ID: 1244, NR: 54, Name: "setsockopt$inet_sctp6_SCTP_SOCKOPT_CONNECTX_OLD", CallName: "setsockopt", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "sock_sctp6", FldName: "fd", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "level", TypeSize: 8}}, Val: 132},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "opt", TypeSize: 8}}, Val: 107},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "val", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array"}, Type: &UnionType{Key: StructKey{Name: "sockaddr_sctp"}}}},
- &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "val"},
+ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "len", TypeSize: 8}}, ByteSize: 1, Buf: "val"},
}},
{ID: 1245, NR: 54, Name: "setsockopt$inet_sctp_SCTP_ADAPTATION_LAYER", CallName: "setsockopt", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "sock_sctp", FldName: "fd", TypeSize: 4}},
@@ -13126,21 +13126,21 @@ var syscalls_amd64 = []*Syscall{
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "level", TypeSize: 8}}, Val: 132},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "opt", TypeSize: 8}}, Val: 101},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "val", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array"}, Type: &UnionType{Key: StructKey{Name: "sockaddr_sctp"}}}},
- &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "val"},
+ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "len", TypeSize: 8}}, ByteSize: 1, Buf: "val"},
}},
{ID: 1282, NR: 54, Name: "setsockopt$inet_sctp_SCTP_SOCKOPT_CONNECTX", CallName: "setsockopt", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "sock_sctp", FldName: "fd", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "level", TypeSize: 8}}, Val: 132},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "opt", TypeSize: 8}}, Val: 110},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "val", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array"}, Type: &UnionType{Key: StructKey{Name: "sockaddr_sctp"}}}},
- &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "val"},
+ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "len", TypeSize: 8}}, ByteSize: 1, Buf: "val"},
}},
{ID: 1283, NR: 54, Name: "setsockopt$inet_sctp_SCTP_SOCKOPT_CONNECTX_OLD", CallName: "setsockopt", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "sock_sctp", FldName: "fd", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "level", TypeSize: 8}}, Val: 132},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "opt", TypeSize: 8}}, Val: 107},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "val", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array"}, Type: &UnionType{Key: StructKey{Name: "sockaddr_sctp"}}}},
- &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "val"},
+ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "len", TypeSize: 8}}, ByteSize: 1, Buf: "val"},
}},
{ID: 1284, NR: 54, Name: "setsockopt$inet_tcp_TCP_CONGESTION", CallName: "setsockopt", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "sock_tcp", FldName: "fd", TypeSize: 4}},
@@ -13909,14 +13909,14 @@ var syscalls_amd64 = []*Syscall{
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "text", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 24}, Type: &StructType{Key: StructKey{Name: "kvm_text_arm64"}}, Kind: 1, RangeBegin: 1, RangeEnd: 1}},
&LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "ntext", TypeSize: 8}}, Buf: "text"},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "flags", TypeSize: 8}}},
- &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "opts", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array"}, Type: &UnionType{Key: StructKey{Name: "kvm_setup_opt_arm64"}}, Kind: 1, RangeBegin: 1, RangeEnd: 1}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "opts", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 16}, Type: &UnionType{Key: StructKey{Name: "kvm_setup_opt_arm64"}}, Kind: 1, RangeBegin: 1, RangeEnd: 1}},
&LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "nopt", TypeSize: 8}}, Buf: "opts"},
}},
{ID: 1417, NR: 1000004, Name: "syz_kvm_setup_cpu$x86", CallName: "syz_kvm_setup_cpu", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd_kvmvm", FldName: "fd", TypeSize: 4}},
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd_kvmcpu", FldName: "cpufd", TypeSize: 4}},
&VmaType{TypeCommon: TypeCommon{TypeName: "vma", FldName: "usermem", TypeSize: 8}, RangeBegin: 24, RangeEnd: 24},
- &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "text", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array"}, Type: &UnionType{Key: StructKey{Name: "kvm_text_x86"}}, Kind: 1, RangeBegin: 1, RangeEnd: 1}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "text", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 24}, Type: &UnionType{Key: StructKey{Name: "kvm_text_x86"}}, Kind: 1, RangeBegin: 1, RangeEnd: 1}},
&LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "ntext", TypeSize: 8}}, Buf: "text"},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "kvm_setup_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{1, 2, 4, 8, 16, 32, 64}},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "opts", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array"}, Type: &UnionType{Key: StructKey{Name: "kvm_setup_opt_x86"}}, Kind: 1, RangeEnd: 2}},
@@ -17551,4 +17551,4 @@ var consts_amd64 = []ConstValue{
{Name: "__WNOTHREAD", Value: 536870912},
}
-const revision_amd64 = "d326eae46892a5fa16a8984a340fbdfbd08bbd4e"
+const revision_amd64 = "44a617dd53e5c99fdec4cae657e0b3cf03cd022b"