From f2635abc2ab7c5581a369c7907278190e72520cc Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Fri, 18 Oct 2019 14:46:02 +0200 Subject: sys/linux: use alignment in integer ranges Signed-off-by: Paul Chaignon --- sys/linux/gen/386.go | 6 +++--- sys/linux/gen/amd64.go | 6 +++--- sys/linux/gen/arm.go | 6 +++--- sys/linux/gen/arm64.go | 6 +++--- sys/linux/gen/ppc64le.go | 6 +++--- sys/linux/sys.txt | 3 +-- sys/linux/trusty.txt | 5 +---- 7 files changed, 17 insertions(+), 21 deletions(-) (limited to 'sys/linux') diff --git a/sys/linux/gen/386.go b/sys/linux/gen/386.go index e8001c366..c11ae12fe 100644 --- a/sys/linux/gen/386.go +++ b/sys/linux/gen/386.go @@ -26725,7 +26725,7 @@ var structDescs_386 = []*KeyedStruct{ {Key: StructKey{Name: "trusty_storage_rpmb_send_req"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "trusty_storage_rpmb_send_req", IsVarlen: true}, Fields: []Type{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "reliable_write_size", TypeSize: 4}}, BitSize: 8, Path: []string{"reliable_write"}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "write_size", TypeSize: 4}}, BitSize: 8, Path: []string{"write"}}, - &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "trusty_storage_rpmb_read_size", FldName: "read_size", TypeSize: 4}}, Vals: []uint64{0, 512, 1024, 1536, 1536, 2048, 2560, 3072, 3584, 4096}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "read_size", TypeSize: 4}}, Kind: 2, RangeEnd: 4096, Align: 512}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "__reserved", TypeSize: 4}}}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "reliable_write", IsVarlen: true}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 512}, Type: &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", TypeSize: 1}}}, Kind: 1, RangeBegin: 512, RangeEnd: 512}}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "write", IsVarlen: true}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 512}, Type: &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", TypeSize: 1}}}, Kind: 1, RangeBegin: 512, RangeEnd: 512}}, @@ -40411,7 +40411,7 @@ var syscalls_386 = []*Syscall{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "mmap_prot", FldName: "prot", TypeSize: 4}}, Vals: []uint64{0, 4, 1, 2, 8, 16777216, 33554432}, BitMask: true}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "mmap_flags", FldName: "flags", TypeSize: 4}}, Vals: []uint64{1, 2, 64, 32, 2048, 4096, 0, 16, 256, 262144, 8192, 65536, 16384, 32768, 131072, 67108864, 3, 524288, 1048576}}, &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "fileoff", FldName: "offset", TypeSize: 4}}, Kind: 1}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "offset", TypeSize: 4}}, Kind: 2, RangeEnd: 4294967295, Align: 4096}, }}, {NR: 192, Name: "mmap$IORING_OFF_CQ_RING", CallName: "mmap", Args: []Type{ &VmaType{TypeCommon: TypeCommon{TypeName: "vma", FldName: "addr", TypeSize: 4}}, @@ -55311,4 +55311,4 @@ var consts_386 = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_386 = "07d86c3f647f9f23764e76ca3b6358da485b0edf" +const revision_386 = "62db5366763f1982ca11f98512d25b5bdc3d2bb7" diff --git a/sys/linux/gen/amd64.go b/sys/linux/gen/amd64.go index 6a9bb9cba..c2514622a 100644 --- a/sys/linux/gen/amd64.go +++ b/sys/linux/gen/amd64.go @@ -27106,7 +27106,7 @@ var structDescs_amd64 = []*KeyedStruct{ {Key: StructKey{Name: "trusty_storage_rpmb_send_req"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "trusty_storage_rpmb_send_req", IsVarlen: true}, Fields: []Type{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "reliable_write_size", TypeSize: 4}}, BitSize: 8, Path: []string{"reliable_write"}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "write_size", TypeSize: 4}}, BitSize: 8, Path: []string{"write"}}, - &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "trusty_storage_rpmb_read_size", FldName: "read_size", TypeSize: 4}}, Vals: []uint64{0, 512, 1024, 1536, 1536, 2048, 2560, 3072, 3584, 4096}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "read_size", TypeSize: 4}}, Kind: 2, RangeEnd: 4096, Align: 512}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "__reserved", TypeSize: 4}}}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "reliable_write", IsVarlen: true}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 512}, Type: &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", TypeSize: 1}}}, Kind: 1, RangeBegin: 512, RangeEnd: 512}}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "write", IsVarlen: true}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 512}, Type: &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", TypeSize: 1}}}, Kind: 1, RangeBegin: 512, RangeEnd: 512}}, @@ -40944,7 +40944,7 @@ var syscalls_amd64 = []*Syscall{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "mmap_prot", FldName: "prot", TypeSize: 8}}, Vals: []uint64{0, 4, 1, 2, 8, 16777216, 33554432}, BitMask: true}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "mmap_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{1, 2, 64, 32, 2048, 4096, 0, 16, 256, 262144, 8192, 65536, 16384, 32768, 131072, 67108864, 3, 524288, 1048576}}, &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "fileoff", FldName: "offset", TypeSize: 8}}, Kind: 1}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "offset", TypeSize: 4}}, Kind: 2, RangeEnd: 4294967295, Align: 4096}, }}, {NR: 9, Name: "mmap$IORING_OFF_CQ_RING", CallName: "mmap", Args: []Type{ &VmaType{TypeCommon: TypeCommon{TypeName: "vma", FldName: "addr", TypeSize: 8}}, @@ -55864,4 +55864,4 @@ var consts_amd64 = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_amd64 = "61cefedaffe10e3c08dc9bcfcf85397650bb5877" +const revision_amd64 = "43a3e8550111471672b78179c471457922e21124" diff --git a/sys/linux/gen/arm.go b/sys/linux/gen/arm.go index 09fb7f93d..7bd1e17f7 100644 --- a/sys/linux/gen/arm.go +++ b/sys/linux/gen/arm.go @@ -26547,7 +26547,7 @@ var structDescs_arm = []*KeyedStruct{ {Key: StructKey{Name: "trusty_storage_rpmb_send_req"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "trusty_storage_rpmb_send_req", IsVarlen: true}, Fields: []Type{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "reliable_write_size", TypeSize: 4}}, BitSize: 8, Path: []string{"reliable_write"}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "write_size", TypeSize: 4}}, BitSize: 8, Path: []string{"write"}}, - &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "trusty_storage_rpmb_read_size", FldName: "read_size", TypeSize: 4}}, Vals: []uint64{0, 512, 1024, 1536, 1536, 2048, 2560, 3072, 3584, 4096}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "read_size", TypeSize: 4}}, Kind: 2, RangeEnd: 4096, Align: 512}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "__reserved", TypeSize: 4}}}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "reliable_write", IsVarlen: true}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 512}, Type: &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", TypeSize: 1}}}, Kind: 1, RangeBegin: 512, RangeEnd: 512}}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "write", IsVarlen: true}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 512}, Type: &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", TypeSize: 1}}}, Kind: 1, RangeBegin: 512, RangeEnd: 512}}, @@ -40092,7 +40092,7 @@ var syscalls_arm = []*Syscall{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "mmap_prot", FldName: "prot", TypeSize: 4}}, Vals: []uint64{0, 4, 1, 2, 8, 16777216, 33554432}, BitMask: true}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "mmap_flags", FldName: "flags", TypeSize: 4}}, Vals: []uint64{1, 2, 0, 32, 2048, 4096, 0, 16, 256, 262144, 8192, 65536, 16384, 32768, 131072, 67108864, 3, 524288, 1048576}}, &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "fileoff", FldName: "offset", TypeSize: 4}}, Kind: 1}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "offset", TypeSize: 4}}, Kind: 2, RangeEnd: 4294967295, Align: 4096}, }}, {NR: 192, Name: "mmap$IORING_OFF_CQ_RING", CallName: "mmap", Args: []Type{ &VmaType{TypeCommon: TypeCommon{TypeName: "vma", FldName: "addr", TypeSize: 4}}, @@ -54888,4 +54888,4 @@ var consts_arm = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_arm = "008d84593d74a8baa23360409ccf2f4e8d3ccb88" +const revision_arm = "615558b36c9ad2e530802282fad4be50ce1d155e" diff --git a/sys/linux/gen/arm64.go b/sys/linux/gen/arm64.go index da74d6900..371415c30 100644 --- a/sys/linux/gen/arm64.go +++ b/sys/linux/gen/arm64.go @@ -26923,7 +26923,7 @@ var structDescs_arm64 = []*KeyedStruct{ {Key: StructKey{Name: "trusty_storage_rpmb_send_req"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "trusty_storage_rpmb_send_req", IsVarlen: true}, Fields: []Type{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "reliable_write_size", TypeSize: 4}}, BitSize: 8, Path: []string{"reliable_write"}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "write_size", TypeSize: 4}}, BitSize: 8, Path: []string{"write"}}, - &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "trusty_storage_rpmb_read_size", FldName: "read_size", TypeSize: 4}}, Vals: []uint64{0, 512, 1024, 1536, 1536, 2048, 2560, 3072, 3584, 4096}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "read_size", TypeSize: 4}}, Kind: 2, RangeEnd: 4096, Align: 512}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "__reserved", TypeSize: 4}}}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "reliable_write", IsVarlen: true}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 512}, Type: &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", TypeSize: 1}}}, Kind: 1, RangeBegin: 512, RangeEnd: 512}}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "write", IsVarlen: true}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 512}, Type: &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", TypeSize: 1}}}, Kind: 1, RangeBegin: 512, RangeEnd: 512}}, @@ -40506,7 +40506,7 @@ var syscalls_arm64 = []*Syscall{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "mmap_prot", FldName: "prot", TypeSize: 8}}, Vals: []uint64{0, 4, 1, 2, 8, 16777216, 33554432}, BitMask: true}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "mmap_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{1, 2, 0, 32, 2048, 4096, 0, 16, 256, 262144, 8192, 65536, 16384, 32768, 131072, 67108864, 3, 524288, 1048576}}, &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "fileoff", FldName: "offset", TypeSize: 8}}, Kind: 1}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "offset", TypeSize: 4}}, Kind: 2, RangeEnd: 4294967295, Align: 4096}, }}, {NR: 222, Name: "mmap$IORING_OFF_CQ_RING", CallName: "mmap", Args: []Type{ &VmaType{TypeCommon: TypeCommon{TypeName: "vma", FldName: "addr", TypeSize: 8}}, @@ -55216,4 +55216,4 @@ var consts_arm64 = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_arm64 = "7af507d1c0859392a0b22965950b9036e835c058" +const revision_arm64 = "8c48fa45a9c66f266934d403e9d96d15e7d088d7" diff --git a/sys/linux/gen/ppc64le.go b/sys/linux/gen/ppc64le.go index cd975d7e9..7eac3ecaf 100644 --- a/sys/linux/gen/ppc64le.go +++ b/sys/linux/gen/ppc64le.go @@ -26793,7 +26793,7 @@ var structDescs_ppc64le = []*KeyedStruct{ {Key: StructKey{Name: "trusty_storage_rpmb_send_req"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "trusty_storage_rpmb_send_req", IsVarlen: true}, Fields: []Type{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "reliable_write_size", TypeSize: 4}}, BitSize: 8, Path: []string{"reliable_write"}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bytesize", FldName: "write_size", TypeSize: 4}}, BitSize: 8, Path: []string{"write"}}, - &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "trusty_storage_rpmb_read_size", FldName: "read_size", TypeSize: 4}}, Vals: []uint64{0, 512, 1024, 1536, 1536, 2048, 2560, 3072, 3584, 4096}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "read_size", TypeSize: 4}}, Kind: 2, RangeEnd: 4096, Align: 512}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "__reserved", TypeSize: 4}}}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "reliable_write", IsVarlen: true}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 512}, Type: &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", TypeSize: 1}}}, Kind: 1, RangeBegin: 512, RangeEnd: 512}}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "write", IsVarlen: true}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 512}, Type: &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", TypeSize: 1}}}, Kind: 1, RangeBegin: 512, RangeEnd: 512}}, @@ -40407,7 +40407,7 @@ var syscalls_ppc64le = []*Syscall{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "mmap_prot", FldName: "prot", TypeSize: 8}}, Vals: []uint64{0, 4, 1, 2, 8, 16777216, 33554432}, BitMask: true}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "mmap_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{1, 2, 0, 32, 2048, 4096, 0, 16, 256, 262144, 128, 65536, 64, 32768, 131072, 67108864, 3, 524288, 1048576}}, &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "fileoff", FldName: "offset", TypeSize: 8}}, Kind: 1}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "offset", TypeSize: 4}}, Kind: 2, RangeEnd: 4294967295, Align: 4096}, }}, {NR: 90, Name: "mmap$IORING_OFF_CQ_RING", CallName: "mmap", Args: []Type{ &VmaType{TypeCommon: TypeCommon{TypeName: "vma", FldName: "addr", TypeSize: 8}}, @@ -55181,4 +55181,4 @@ var consts_ppc64le = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_ppc64le = "4b60aa3d6a89c24150c24d466057ea8e974cc9ac" +const revision_ppc64le = "9345b989fb1c1c30c8bf871a5378b6c8b5503850" diff --git a/sys/linux/sys.txt b/sys/linux/sys.txt index 28ff45ac6..e32d3d338 100644 --- a/sys/linux/sys.txt +++ b/sys/linux/sys.txt @@ -123,8 +123,7 @@ eventfd2(initval int32, flags flags[eventfd_flags]) fd_event read$eventfd(fd fd_event, val ptr[out, int64], len len[val]) write$eventfd(fd fd_event, val ptr[in, int64], len len[val]) -# NEED: offset must be page-aligned. Or does the syscall even accept offset in pages? -mmap(addr vma, len len[addr], prot flags[mmap_prot], flags flags[mmap_flags], fd fd, offset fileoff) +mmap(addr vma, len len[addr], prot flags[mmap_prot], flags flags[mmap_flags], fd fd, offset int32[0:0xffffffff, 0x1000]) munmap(addr vma, len len[addr]) mremap(addr vma, len len[addr], newlen len[newaddr], flags flags[mremap_flags], newaddr vma) remap_file_pages(addr vma, size len[addr], prot flags[mmap_prot], pgoff intptr, flags flags[mmap_flags]) diff --git a/sys/linux/trusty.txt b/sys/linux/trusty.txt index 9020f93c5..07104cbfb 100644 --- a/sys/linux/trusty.txt +++ b/sys/linux/trusty.txt @@ -457,15 +457,12 @@ trusty_storage_file_set_size_req { trusty_storage_rpmb_send_req { reliable_write_size bytesize[reliable_write, int32] write_size bytesize[write, int32] - read_size flags[trusty_storage_rpmb_read_size, int32] + read_size int32[0:4096, 512] __reserved const[0, int32] reliable_write array[array[const[0, int8], 512]] write array[array[const[0, int8], 512]] } [packed] -# NEED: this should be a 512-aligned int in range [0:4096] -trusty_storage_rpmb_read_size = 0, 512, 1024, 1536, 1536, 2048, 2560, 3072, 3584, 4096 - ### hwkey ### resource fd_trusty_hwkey[fd_trusty] -- cgit mrf-deployment