diff options
| author | Greg Steuck <blackgnezdo@gmail.com> | 2018-11-27 04:14:06 -0800 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-11-27 13:14:06 +0100 |
| commit | 6419afbb779b26af853b46d8ad79cfe52b6f7805 (patch) | |
| tree | 7b8ed176a713899de153619f9d41c675c703ed2a /vm/gce | |
| parent | ac912200b65d80413762b8d61eb6399ef9eccfd9 (diff) | |
openbsd: run on gce
* build/openbsd: minor cleanup (use tuples instead of maps)
* Grammar nits in comments.
* Simplify openbsd.Create, will defer when there's more than one error exit.
* pkg/build: Support copying kernel into GCE image
* Simple test for openbsd image copy build.
* Cleanup in case something failed before.
* Support multi-processor VMs on GCE.
* More debug
* Reformat
* OpenBSD gce image needs to be raw.
* GC
* Force format to GNU directly on Go 1.10 or newer.
* Use vmType passed as a parameter inside openbsd.go
* gofmt
* more fmt
* Can't use GENERIC.mp just yet.
* capitalize
* Copyright
Diffstat (limited to 'vm/gce')
| -rw-r--r-- | vm/gce/gce.go | 13 | ||||
| -rw-r--r-- | vm/gce/tar_go1.10.go | 14 | ||||
| -rw-r--r-- | vm/gce/tar_go1.9.go | 19 |
3 files changed, 37 insertions, 9 deletions
diff --git a/vm/gce/gce.go b/vm/gce/gce.go index 52ea87a48..32f3e2947 100644 --- a/vm/gce/gce.go +++ b/vm/gce/gce.go @@ -100,7 +100,7 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) { if cfg.GCEImage == "" { cfg.GCEImage = env.Name gcsImage := filepath.Join(cfg.GCSPath, env.Name+"-image.tar.gz") - log.Logf(0, "uploading image to %v...", gcsImage) + log.Logf(0, "uploading image %v to %v...", env.Image, gcsImage) if err := uploadImageToGCS(env.Image, gcsImage); err != nil { return nil, err } @@ -436,15 +436,10 @@ func uploadImageToGCS(localImage, gcsImage string) error { Mode: 0640, Size: localStat.Size(), ModTime: time.Now(), - // This is hacky but we actually need these large uids. - // GCE understands only the old GNU tar format and - // there is no direct way to force tar package to use GNU format. - // But these large numbers force tar to switch to GNU format. - Uid: 100000000, - Gid: 100000000, - Uname: "syzkaller", - Gname: "syzkaller", + Uname: "syzkaller", + Gname: "syzkaller", } + setGNUFormat(tarHeader) if err := tarWriter.WriteHeader(tarHeader); err != nil { return fmt.Errorf("failed to write image tar header: %v", err) } diff --git a/vm/gce/tar_go1.10.go b/vm/gce/tar_go1.10.go new file mode 100644 index 000000000..88a5d1fda --- /dev/null +++ b/vm/gce/tar_go1.10.go @@ -0,0 +1,14 @@ +// Copyright 2018 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +// +build go1.10 + +package gce + +import ( + "archive/tar" +) + +func setGNUFormat(hdr *tar.Header) { + hdr.Format = tar.FormatGNU +} diff --git a/vm/gce/tar_go1.9.go b/vm/gce/tar_go1.9.go new file mode 100644 index 000000000..a26ecbdd5 --- /dev/null +++ b/vm/gce/tar_go1.9.go @@ -0,0 +1,19 @@ +// Copyright 2018 syzkaller project authors. All rights reserved. +// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +// +build !go1.10 + +package gce + +import ( + "archive/tar" +) + +func setGNUFormat(hdr *tar.Header) { + // This is hacky but we actually need these large uids. + // GCE understands only the old GNU tar format and prior to Go 1.10 + // there is no direct way to force tar package to use GNU format. + // But these large numbers force tar to switch to GNU format. + hdr.Uid = 100000000 + hdr.Gid = 100000000 +} |
