aboutsummaryrefslogtreecommitdiffstats
path: root/sys/syz-sysgen/sysgen.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2021-08-24 15:50:19 +0000
committerAleksandr Nogikh <wp32pw@gmail.com>2021-09-22 15:40:02 +0200
commita7ce77be27d8e3728b97122a005bc5b23298cfc3 (patch)
tree1f3adbdd7719ec9c6bf7eb4d48f308004410f775 /sys/syz-sysgen/sysgen.go
parent041a868956e51efc0dace9e3dff874332a8cdccc (diff)
all: introduce call properties
Call properties let us specify how each individual call within a program must be executed. So far the only way to enforce extra rules was to pass extra program-level properties (e.g. that is how fault injection was done). However, it entangles the logic and not flexible enough. Implement an ability to pass properties along with each individual call.
Diffstat (limited to 'sys/syz-sysgen/sysgen.go')
-rw-r--r--sys/syz-sysgen/sysgen.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/syz-sysgen/sysgen.go b/sys/syz-sysgen/sysgen.go
index 35bea4f3b..fbff765cc 100644
--- a/sys/syz-sysgen/sysgen.go
+++ b/sys/syz-sysgen/sysgen.go
@@ -51,9 +51,15 @@ type OSData struct {
Archs []ArchData
}
+type CallPropDescription struct {
+ Type string
+ Name string
+}
+
type ExecutorData struct {
OSes []OSData
CallAttrs []string
+ CallProps []CallPropDescription
}
var srcDir = flag.String("src", "", "path to root of syzkaller source dir")
@@ -181,6 +187,14 @@ func main() {
data.CallAttrs = append(data.CallAttrs, prog.CppName(attrs.Field(i).Name))
}
+ defaultProps := prog.DefaultCallProps()
+ defaultProps.ForeachProp(func(name, _ string, value reflect.Value) {
+ data.CallProps = append(data.CallProps, CallPropDescription{
+ Type: value.Kind().String(),
+ Name: prog.CppName(name),
+ })
+ })
+
writeExecutorSyscalls(data)
}
@@ -326,6 +340,15 @@ var defsTempl = template.Must(template.New("").Parse(`// AUTOGENERATED FILE
struct call_attrs_t { {{range $attr := $.CallAttrs}}
uint64_t {{$attr}};{{end}}
};
+
+struct call_props_t { {{range $attr := $.CallProps}}
+ {{$attr.Type}} {{$attr.Name}};{{end}}
+};
+
+#define read_call_props_t(var, reader) { \{{range $attr := $.CallProps}}
+ (var).{{$attr.Name}} = ({{$attr.Type}})(reader); \{{end}}
+}
+
{{range $os := $.OSes}}
#if GOOS_{{$os.GOOS}}
#define GOOS "{{$os.GOOS}}"