From 1c202847db0380015a8920bfd21375c2d9f28ddb Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 3 Sep 2021 16:20:07 +0000 Subject: all: refactor fault injection into call props Now that call properties mechanism is implemented, we can refactor fault injection. Unfortunately, it is impossible to remove all traces of the previous apprach. In reprolist and while performing syz-ci jobs, syzkaller still needs to parse the old format. Remove the old prog options-based approach whenever possible and replace it with the use of call properties. --- prog/encodingexec.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'prog/encodingexec.go') diff --git a/prog/encodingexec.go b/prog/encodingexec.go index 296fcf0cf..fea114717 100644 --- a/prog/encodingexec.go +++ b/prog/encodingexec.go @@ -6,7 +6,7 @@ // Exec format is an sequence of uint64's which encodes a sequence of calls. // The sequence is terminated by a speciall call execInstrEOF. -// Each call is (call ID, call props, copyout index, number of arguments, arguments...). +// Each call is (call ID, copyout index, number of arguments, arguments...). // Each argument is (type, size, value). // There are 4 types of arguments: // - execArgConst: value is const value @@ -30,6 +30,7 @@ const ( execInstrEOF = ^uint64(iota) execInstrCopyin execInstrCopyout + execInstrSetProps ) const ( @@ -88,10 +89,12 @@ func (w *execContext) serializeCall(c *Call) { // Generate checksum calculation instructions starting from the last one, // since checksum values can depend on values of the latter ones w.writeChecksums() + if !reflect.DeepEqual(c.Props, CallProps{}) { + // Push call properties. + w.writeCallProps(c.Props) + } // Generate the call itself. w.write(uint64(c.Meta.ID)) - // Generate call properties fragment. - w.writeCallProps(c.Props) if c.Ret != nil && len(c.Ret.uses) != 0 { if _, ok := w.args[c.Ret]; ok { panic("argInfo is already created for return value") @@ -129,6 +132,7 @@ type argInfo struct { } func (w *execContext) writeCallProps(props CallProps) { + w.write(execInstrSetProps) props.ForeachProp(func(_, _ string, value reflect.Value) { switch kind := value.Kind(); kind { case reflect.Int: -- cgit mrf-deployment