aboutsummaryrefslogtreecommitdiffstats
path: root/prog/encodingexec.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-10-01 11:44:19 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-10-01 12:51:01 +0200
commit28262b12716e24b21c5507b563f5ac085db9977a (patch)
treeb1db25e5d20f043c900f4c32b863172ecfc0d4ca /prog/encodingexec.go
parent64e2fe3d20f715a4f9c22942427b6598f9f1e13d (diff)
syz-fuzzer: ignore encodingexec buffer overflow errors
We started to see lots of "provided buffer is too small" with seeded syz_mount_image programs. Currently it fails whole VM, which is not good. Ignoring them is not perfect, but there does not seem to be any better simple solution.
Diffstat (limited to 'prog/encodingexec.go')
-rw-r--r--prog/encodingexec.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/prog/encodingexec.go b/prog/encodingexec.go
index e97ea610c..c15eb25bc 100644
--- a/prog/encodingexec.go
+++ b/prog/encodingexec.go
@@ -20,6 +20,7 @@
package prog
import (
+ "errors"
"fmt"
"sort"
)
@@ -53,6 +54,8 @@ const (
ExecNoCopyout = ^uint64(0)
)
+var ErrExecBufferTooSmall = errors.New("encodingexec: provided buffer is too small")
+
// SerializeForExec serializes program p for execution by process pid into the provided buffer.
// Returns number of bytes written to the buffer.
// If the provided buffer is too small for the program an error is returned.
@@ -70,7 +73,7 @@ func (p *Prog) SerializeForExec(buffer []byte) (int, error) {
}
w.write(execInstrEOF)
if w.eof {
- return 0, fmt.Errorf("provided buffer is too small")
+ return 0, ErrExecBufferTooSmall
}
return len(buffer) - len(w.buf), nil
}