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
This commit is contained in:
Dmitry Vyukov 2020-09-14 08:47:56 +02:00
parent bf14d79b03
commit 605d25b511
4 changed files with 3 additions and 23 deletions

View File

@ -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)
}

View File

@ -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
}

View File

@ -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

View File

@ -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 {