aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-11-25 12:50:29 +0100
committerDmitry Vyukov <dvyukov@google.com>2022-11-25 13:14:53 +0100
commit70393e5d05ae78166599755b835f0d465c815f48 (patch)
treef674c69030c296100885d68d65c3c9f20b062bcf /sys/linux
parent0d68fcb4879b7f76e4242bfa0b0004c9a0eb9b5e (diff)
prog: don't materialize uncompressed image in Deserialize
Currently we uncompress all images in Deserialize to check that the data is valid. As the result deserializing all seeds we have takes ~40 seconds of real time and ~125 seconds of CPU time. And we do this during every syz-manager start. Don't materialize the uncompressed image. This reduces real time to ~15 seconds and CPU time to 18 seconds (no garbage collections). In syz-manager the benefit is even larger since garbage collections take longer (larger heap).
Diffstat (limited to 'sys/linux')
-rw-r--r--sys/linux/init_images.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/linux/init_images.go b/sys/linux/init_images.go
index 0284f9190..8b62455d2 100644
--- a/sys/linux/init_images.go
+++ b/sys/linux/init_images.go
@@ -24,11 +24,11 @@ func (arch *arch) extractSyzMountImage(c *prog.Call) (io.Reader, error) {
} else if len(data) == 0 {
return nil, fmt.Errorf("an empty image")
}
- decompressedData, err := prog.Decompress(data)
- if err != nil {
+ buf := new(bytes.Buffer)
+ if err := prog.DecompressWriter(buf, data); err != nil {
return nil, err
}
- return bytes.NewReader(decompressedData), nil
+ return buf, nil
}
func (arch *arch) fixUpSyzMountImage(c *prog.Call, fixStructure bool) error {