From 605d25b511f02ef747a46a21d94ddc3077d0b7a0 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 14 Sep 2020 08:47:56 +0200 Subject: [PATCH] syz-ci: fix seeds copying 1. Copy seeds from syzkaller checkout into syzkaller build dir. They need to be stable. 2. Make the code generic (current is linux-specific). 3. Don't copy seeds to workdir/seeds. We can load them directly from sys/OS/test. There are some unresolved comments for LinkDir on #2053 anyway. Follow up to #2053 --- pkg/osutil/osutil.go | 15 --------------- syz-ci/manager.go | 7 +------ syz-ci/syz-ci.go | 3 +-- syz-ci/updater.go | 1 + 4 files changed, 3 insertions(+), 23 deletions(-) diff --git a/pkg/osutil/osutil.go b/pkg/osutil/osutil.go index 340c51de..cd6a1cce 100644 --- a/pkg/osutil/osutil.go +++ b/pkg/osutil/osutil.go @@ -235,21 +235,6 @@ func LinkFiles(srcDir, dstDir string, files map[string]bool) error { return nil } -// LinkDir creates soft links from dstDir to srcDir. -// All other files in dstDir are removed. -func LinkDir(srcDir, dstDir string) error { - if err := os.RemoveAll(dstDir); err != nil { - return err - } - if err := MkdirAll(dstDir); err != nil { - return err - } - if err := os.Symlink(srcDir, dstDir); err != nil { - return err - } - return nil -} - func MkdirAll(dir string) error { return os.MkdirAll(dir, DefaultDirPerm) } diff --git a/syz-ci/manager.go b/syz-ci/manager.go index f5885787..99a2ec44 100644 --- a/syz-ci/manager.go +++ b/syz-ci/manager.go @@ -79,7 +79,7 @@ type Manager struct { stop chan struct{} } -func createManager(cfg *Config, mgrcfg *ManagerConfig, stop chan struct{}, syzLinuxTestDir string) (*Manager, error) { +func createManager(cfg *Config, mgrcfg *ManagerConfig, stop chan struct{}) (*Manager, error) { dir := osutil.Abs(filepath.Join("managers", mgrcfg.Name)) if err := osutil.MkdirAll(dir); err != nil { log.Fatal(err) @@ -127,11 +127,6 @@ func createManager(cfg *Config, mgrcfg *ManagerConfig, stop chan struct{}, syzLi stop: stop, } - // Copy test files into the current manager workdir. - if err := osutil.LinkDir(syzLinuxTestDir, filepath.Join(dir, "workdir", "seeds")); err != nil { - log.Fatal(err) - } - os.RemoveAll(mgr.currentDir) return mgr, nil } diff --git a/syz-ci/syz-ci.go b/syz-ci/syz-ci.go index 7b401937..faa51f4f 100644 --- a/syz-ci/syz-ci.go +++ b/syz-ci/syz-ci.go @@ -170,10 +170,9 @@ func main() { wg.Done() }() - syzLinuxTestDir := filepath.Join(updater.syzkallerDir, "sys", "linux", "test") var managers []*Manager for _, mgrcfg := range cfg.Managers { - mgr, err := createManager(cfg, mgrcfg, stop, syzLinuxTestDir) + mgr, err := createManager(cfg, mgrcfg, stop) if err != nil { log.Logf(0, "failed to create manager %v: %v", mgrcfg.Name, err) continue diff --git a/syz-ci/updater.go b/syz-ci/updater.go index 7ffe33ef..dd89f8d5 100644 --- a/syz-ci/updater.go +++ b/syz-ci/updater.go @@ -72,6 +72,7 @@ func NewSyzUpdater(cfg *Config) *SyzUpdater { "tag": true, // contains syzkaller repo git hash "bin/syz-ci": true, // these are just copied from syzkaller dir "bin/syz-manager": true, + "sys/*/test/*": true, } targets := make(map[string]bool) for _, mgr := range cfg.Managers {