From ac93d7e1d83ffac19983e9d754a47e7808f1230e Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 28 Nov 2017 14:27:28 +0100 Subject: 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. --- sys/netbsd/amd64.go | 6 +++--- sys/netbsd/socket.txt | 2 +- sys/netbsd/socket_unix.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'sys/netbsd') diff --git a/sys/netbsd/amd64.go b/sys/netbsd/amd64.go index 84acc31e3..96d9280c2 100644 --- a/sys/netbsd/amd64.go +++ b/sys/netbsd/amd64.go @@ -136,7 +136,7 @@ var structDescs_amd64 = []*KeyedStruct{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "vec", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array"}, Type: &StructType{Key: StructKey{Name: "iovec_in"}}}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "vlen", TypeSize: 8}}, Buf: "vec"}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "ctrl", TypeSize: 8, IsOptional: true}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array"}, Type: &UnionType{Key: StructKey{Name: "cmsghdr_un"}}}}, - &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "ctrllen", TypeSize: 8}}, Buf: "ctrl"}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "ctrllen", TypeSize: 8}}, ByteSize: 1, Buf: "ctrl"}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "send_flags", FldName: "f", TypeSize: 4}}, Vals: []uint64{1, 2, 4, 8, 1024}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 4}}, IsPad: true}, }}}, @@ -219,7 +219,7 @@ var structDescs_amd64 = []*KeyedStruct{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "msg_iov", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array"}, Type: &StructType{Key: StructKey{Name: "iovec_in"}}}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "msg_iovlen", TypeSize: 8}}, Buf: "msg_iov"}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "msg_control", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array"}, Type: &StructType{Key: StructKey{Name: "cmsghdr"}}}}, - &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "msg_controllen", TypeSize: 8}}, Buf: "msg_control"}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "msg_controllen", TypeSize: 8}}, ByteSize: 1, Buf: "msg_control"}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "send_flags", FldName: "msg_flags", TypeSize: 4}}, Vals: []uint64{1, 2, 4, 8, 1024}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 4}}, IsPad: true}, }}}, @@ -1674,4 +1674,4 @@ var consts_amd64 = []ConstValue{ {Name: "WUNTRACED", Value: 2}, } -const revision_amd64 = "b8cf507bff6e073c3fe77c8ab8b9a47cbcf66359" +const revision_amd64 = "ca4e4e7a0242c62214994f9291c68aa68bccd07c" diff --git a/sys/netbsd/socket.txt b/sys/netbsd/socket.txt index 466b8ee10..af6de88e7 100644 --- a/sys/netbsd/socket.txt +++ b/sys/netbsd/socket.txt @@ -70,7 +70,7 @@ send_msghdr { msg_iov ptr[in, array[iovec_in]] msg_iovlen len[msg_iov, intptr] msg_control ptr[in, array[cmsghdr]] - msg_controllen len[msg_control, intptr] + msg_controllen bytesize[msg_control, intptr] msg_flags flags[send_flags, int32] } diff --git a/sys/netbsd/socket_unix.txt b/sys/netbsd/socket_unix.txt index c0be688b0..4a42c5845 100644 --- a/sys/netbsd/socket_unix.txt +++ b/sys/netbsd/socket_unix.txt @@ -52,7 +52,7 @@ msghdr_un { vec ptr[in, array[iovec_in]] vlen len[vec, intptr] ctrl ptr[in, array[cmsghdr_un], opt] - ctrllen len[ctrl, intptr] + ctrllen bytesize[ctrl, intptr] f flags[send_flags, int32] } -- cgit mrf-deployment