aboutsummaryrefslogtreecommitdiffstats
path: root/prog/encodingexec.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2021-09-03 16:20:07 +0000
committerAleksandr Nogikh <wp32pw@gmail.com>2021-09-22 15:40:02 +0200
commit1c202847db0380015a8920bfd21375c2d9f28ddb (patch)
tree6693da3a936398a9ac6678842ac181c5f0e3e429 /prog/encodingexec.go
parenta7ce77be27d8e3728b97122a005bc5b23298cfc3 (diff)
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.
Diffstat (limited to 'prog/encodingexec.go')
-rw-r--r--prog/encodingexec.go10
1 files changed, 7 insertions, 3 deletions
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: