From 4fc13fd6ae51fdf3230dde4f31a32feb4861ca37 Mon Sep 17 00:00:00 2001 From: Shankara Pailoor Date: Mon, 12 Nov 2018 04:10:17 -0800 Subject: 1) making bpf_insn varlen, 2) changing bpf_generic to match the struct definition in linux to make trace2syz generation simpler --- sys/linux/bpf.txt | 5 +++-- sys/linux/gen/386.go | 7 ++++--- sys/linux/gen/amd64.go | 7 ++++--- sys/linux/gen/arm.go | 7 ++++--- sys/linux/gen/arm64.go | 7 ++++--- sys/linux/gen/ppc64le.go | 7 ++++--- 6 files changed, 23 insertions(+), 17 deletions(-) (limited to 'sys/linux') diff --git a/sys/linux/bpf.txt b/sys/linux/bpf.txt index fad2eba57..e25709bab 100644 --- a/sys/linux/bpf.txt +++ b/sys/linux/bpf.txt @@ -121,11 +121,12 @@ bpf_insn [ exit bpf_insn_exit initr0 bpf_insn_init_r0 map bpf_insn_map -] +] [varlen] bpf_insn_generic { code int8 - regs int8 + dst int8:4 + src int8:4 off int16 imm int32 } diff --git a/sys/linux/gen/386.go b/sys/linux/gen/386.go index 447a0d260..aafc6658e 100644 --- a/sys/linux/gen/386.go +++ b/sys/linux/gen/386.go @@ -780,7 +780,7 @@ var structDescs_386 = []*KeyedStruct{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 4}}, Buf: "info"}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr64", FldName: "info", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "bpf_prog_info", Dir: 1}}}, }}}, - {Key: StructKey{Name: "bpf_insn"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn", TypeSize: 16}, Fields: []Type{ + {Key: StructKey{Name: "bpf_insn"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn", IsVarlen: true}, Fields: []Type{ &StructType{Key: StructKey{Name: "bpf_insn_generic"}, FldName: "generic"}, &StructType{Key: StructKey{Name: "bpf_insn_ldst"}, FldName: "ldst"}, &StructType{Key: StructKey{Name: "bpf_insn_alu"}, FldName: "alu"}, @@ -813,7 +813,8 @@ var structDescs_386 = []*KeyedStruct{ }}}, {Key: StructKey{Name: "bpf_insn_generic"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn_generic", TypeSize: 8}, Fields: []Type{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "code", TypeSize: 1}}}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "regs", TypeSize: 1}}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "dst", TypeSize: 1}, BitfieldLen: 4, BitfieldMdl: true}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "src", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "off", TypeSize: 2}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "imm", TypeSize: 4}}}, }}}, @@ -42019,4 +42020,4 @@ var consts_386 = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_386 = "d69c26c32ab1efa5ec8fb5120cb6c8932bc3d4e5" +const revision_386 = "71fbeb78059512031b845005efbca319a297c232" diff --git a/sys/linux/gen/amd64.go b/sys/linux/gen/amd64.go index d714539ac..0fa462ad8 100644 --- a/sys/linux/gen/amd64.go +++ b/sys/linux/gen/amd64.go @@ -788,7 +788,7 @@ var structDescs_amd64 = []*KeyedStruct{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 4}}, Buf: "info"}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr64", FldName: "info", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "bpf_prog_info", Dir: 1}}}, }}}, - {Key: StructKey{Name: "bpf_insn"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn", TypeSize: 16}, Fields: []Type{ + {Key: StructKey{Name: "bpf_insn"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn", IsVarlen: true}, Fields: []Type{ &StructType{Key: StructKey{Name: "bpf_insn_generic"}, FldName: "generic"}, &StructType{Key: StructKey{Name: "bpf_insn_ldst"}, FldName: "ldst"}, &StructType{Key: StructKey{Name: "bpf_insn_alu"}, FldName: "alu"}, @@ -821,7 +821,8 @@ var structDescs_amd64 = []*KeyedStruct{ }}}, {Key: StructKey{Name: "bpf_insn_generic"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn_generic", TypeSize: 8}, Fields: []Type{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "code", TypeSize: 1}}}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "regs", TypeSize: 1}}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "dst", TypeSize: 1}, BitfieldLen: 4, BitfieldMdl: true}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "src", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "off", TypeSize: 2}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "imm", TypeSize: 4}}}, }}}, @@ -42722,4 +42723,4 @@ var consts_amd64 = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_amd64 = "b8d0f6910233ab190009de819a4853e63f2f4815" +const revision_amd64 = "3568116ea3bce127670798b143ae62fe18332fe8" diff --git a/sys/linux/gen/arm.go b/sys/linux/gen/arm.go index 1f8cb4de8..2681665c6 100644 --- a/sys/linux/gen/arm.go +++ b/sys/linux/gen/arm.go @@ -785,7 +785,7 @@ var structDescs_arm = []*KeyedStruct{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 4}}, Buf: "info"}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr64", FldName: "info", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "bpf_prog_info", Dir: 1}}}, }}}, - {Key: StructKey{Name: "bpf_insn"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn", TypeSize: 16}, Fields: []Type{ + {Key: StructKey{Name: "bpf_insn"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn", IsVarlen: true}, Fields: []Type{ &StructType{Key: StructKey{Name: "bpf_insn_generic"}, FldName: "generic"}, &StructType{Key: StructKey{Name: "bpf_insn_ldst"}, FldName: "ldst"}, &StructType{Key: StructKey{Name: "bpf_insn_alu"}, FldName: "alu"}, @@ -818,7 +818,8 @@ var structDescs_arm = []*KeyedStruct{ }}}, {Key: StructKey{Name: "bpf_insn_generic"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn_generic", TypeSize: 8}, Fields: []Type{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "code", TypeSize: 1}}}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "regs", TypeSize: 1}}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "dst", TypeSize: 1}, BitfieldLen: 4, BitfieldMdl: true}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "src", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "off", TypeSize: 2}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "imm", TypeSize: 4}}}, }}}, @@ -41890,4 +41891,4 @@ var consts_arm = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_arm = "6d05eb9f9f4fa3945a1afcb4135f09a083278faf" +const revision_arm = "77dfb16e9b6dba5aa341366466d3d7d9953c36e4" diff --git a/sys/linux/gen/arm64.go b/sys/linux/gen/arm64.go index 24a2e529f..50e208621 100644 --- a/sys/linux/gen/arm64.go +++ b/sys/linux/gen/arm64.go @@ -788,7 +788,7 @@ var structDescs_arm64 = []*KeyedStruct{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 4}}, Buf: "info"}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr64", FldName: "info", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "bpf_prog_info", Dir: 1}}}, }}}, - {Key: StructKey{Name: "bpf_insn"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn", TypeSize: 16}, Fields: []Type{ + {Key: StructKey{Name: "bpf_insn"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn", IsVarlen: true}, Fields: []Type{ &StructType{Key: StructKey{Name: "bpf_insn_generic"}, FldName: "generic"}, &StructType{Key: StructKey{Name: "bpf_insn_ldst"}, FldName: "ldst"}, &StructType{Key: StructKey{Name: "bpf_insn_alu"}, FldName: "alu"}, @@ -821,7 +821,8 @@ var structDescs_arm64 = []*KeyedStruct{ }}}, {Key: StructKey{Name: "bpf_insn_generic"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn_generic", TypeSize: 8}, Fields: []Type{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "code", TypeSize: 1}}}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "regs", TypeSize: 1}}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "dst", TypeSize: 1}, BitfieldLen: 4, BitfieldMdl: true}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "src", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "off", TypeSize: 2}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "imm", TypeSize: 4}}}, }}}, @@ -42112,4 +42113,4 @@ var consts_arm64 = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_arm64 = "37d22c867f305de304c2deab90435ad207978025" +const revision_arm64 = "78b110fad68c5730e2ddb41bdc37123a87b77171" diff --git a/sys/linux/gen/ppc64le.go b/sys/linux/gen/ppc64le.go index 8f5b34579..888b4e3a6 100644 --- a/sys/linux/gen/ppc64le.go +++ b/sys/linux/gen/ppc64le.go @@ -779,7 +779,7 @@ var structDescs_ppc64le = []*KeyedStruct{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 4}}, Buf: "info"}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr64", FldName: "info", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "bpf_prog_info", Dir: 1}}}, }}}, - {Key: StructKey{Name: "bpf_insn"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn", TypeSize: 16}, Fields: []Type{ + {Key: StructKey{Name: "bpf_insn"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn", IsVarlen: true}, Fields: []Type{ &StructType{Key: StructKey{Name: "bpf_insn_generic"}, FldName: "generic"}, &StructType{Key: StructKey{Name: "bpf_insn_ldst"}, FldName: "ldst"}, &StructType{Key: StructKey{Name: "bpf_insn_alu"}, FldName: "alu"}, @@ -812,7 +812,8 @@ var structDescs_ppc64le = []*KeyedStruct{ }}}, {Key: StructKey{Name: "bpf_insn_generic"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "bpf_insn_generic", TypeSize: 8}, Fields: []Type{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "code", TypeSize: 1}}}, - &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "regs", TypeSize: 1}}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "dst", TypeSize: 1}, BitfieldLen: 4, BitfieldMdl: true}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "src", TypeSize: 1}, BitfieldOff: 4, BitfieldLen: 4}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "off", TypeSize: 2}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "imm", TypeSize: 4}}}, }}}, @@ -39470,4 +39471,4 @@ var consts_ppc64le = []ConstValue{ {Name: "bpf_insn_load_imm_dw", Value: 24}, } -const revision_ppc64le = "3dddd69f9a99ac2b32af12e987409971288addf4" +const revision_ppc64le = "1d1c97fcbd013c57ee36147bbb8c7656a4354f4d" -- cgit mrf-deployment