aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-12-13 19:32:37 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-12-13 20:04:10 +0100
commit5bd4cb9beb756605ec069675ad959ebfc27598c6 (patch)
tree59ce493254969f2fb254fd19f930c6ebbbf61361 /pkg
parent8f160dd5d603e9cd86705baad260794afa3e5cb3 (diff)
pkg/cover: fix location of gvisor object file
When running under syz-ci gvisor image is called 'image', but it's not in objDir. pkg/build/gvisor.go doesn't copy anything into obj/. Copy runsc into obj/vmlinux (as expected for linux target) and open it in pkg/cover.
Diffstat (limited to 'pkg')
-rw-r--r--pkg/build/gvisor.go7
-rw-r--r--pkg/cover/backend/gvisor.go4
2 files changed, 6 insertions, 5 deletions
diff --git a/pkg/build/gvisor.go b/pkg/build/gvisor.go
index 24f47a827..48636dfa2 100644
--- a/pkg/build/gvisor.go
+++ b/pkg/build/gvisor.go
@@ -11,6 +11,7 @@ import (
"time"
"github.com/google/syzkaller/pkg/osutil"
+ "github.com/google/syzkaller/sys/targets"
)
type gvisor struct{}
@@ -70,13 +71,13 @@ func (gvisor gvisor) build(params *Params) error {
if match == nil {
return fmt.Errorf("failed to find the runsc binary")
}
- outBinary := string(match[1])
- outBinary = filepath.Join(params.KernelDir, filepath.FromSlash(outBinary))
+ outBinary := filepath.Join(params.KernelDir, filepath.FromSlash(string(match[1])))
if err := osutil.CopyFile(outBinary, filepath.Join(params.OutputDir, "image")); err != nil {
return err
}
- return nil
+ sysTarget := targets.Get(params.TargetOS, params.TargetArch)
+ return osutil.CopyFile(outBinary, filepath.Join(params.OutputDir, "obj", sysTarget.KernelObject))
}
func (gvisor) clean(kernelDir, targetArch string) error {
diff --git a/pkg/cover/backend/gvisor.go b/pkg/cover/backend/gvisor.go
index 459ad60e9..1dcd9506a 100644
--- a/pkg/cover/backend/gvisor.go
+++ b/pkg/cover/backend/gvisor.go
@@ -15,8 +15,8 @@ import (
)
func makeGvisor(target *targets.Target, objDir, srcDir, buildDir string) (*Impl, error) {
- // pkg/build stores runsc as 'image', but a local build will have it as 'runsc'.
- bin := filepath.Join(objDir, "image")
+ // pkg/build stores runsc as 'vmlinux' (we pretent to be linux), but a local build will have it as 'runsc'.
+ bin := filepath.Join(objDir, target.KernelObject)
if !osutil.IsExist(bin) {
bin = filepath.Join(objDir, "runsc")
}