aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-05-07 17:59:06 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-05-07 17:59:06 +0200
commit9e0846e8a4beebff36c72f03479a7db775b5144e (patch)
tree5be248f1b661837ea2378648676e3f0f8d5746c6
parent99c1f486598445575a3a624bf70dc6a31f60d365 (diff)
all: get rid of underscores in identifiers
Underscores are against Go coding style. Update #538
-rw-r--r--.gometalinter.json1
-rw-r--r--pkg/compiler/types.go10
-rw-r--r--pkg/config/config.go12
-rw-r--r--prog/rand.go12
-rw-r--r--prog/types.go10
-rw-r--r--syz-ci/jobs.go12
-rw-r--r--syz-ci/manager.go40
-rw-r--r--syz-ci/syz-ci.go65
-rw-r--r--syz-ci/syzupdater.go8
-rw-r--r--syz-ci/testing.go2
-rw-r--r--syz-manager/manager.go36
-rw-r--r--syz-manager/mgrconfig/mgrconfig.go99
-rw-r--r--tools/syz-crush/crush.go2
-rw-r--r--tools/syz-repro/repro.go2
-rw-r--r--vm/adb/adb.go12
-rw-r--r--vm/gce/gce.go30
-rw-r--r--vm/isolated/isolated.go18
-rw-r--r--vm/qemu/qemu.go30
-rw-r--r--vm/vmimpl/console.go6
-rw-r--r--vm/vmimpl/console_darwin.go8
-rw-r--r--vm/vmimpl/console_freebsd.go8
-rw-r--r--vm/vmimpl/console_linux_386.go8
-rw-r--r--vm/vmimpl/console_linux_amd64.go8
-rw-r--r--vm/vmimpl/console_linux_arm.go8
-rw-r--r--vm/vmimpl/console_linux_arm64.go8
-rw-r--r--vm/vmimpl/console_linux_ppc64le.go8
-rw-r--r--vm/vmimpl/console_netbsd.go8
27 files changed, 252 insertions, 219 deletions
diff --git a/.gometalinter.json b/.gometalinter.json
index 3a8529043..a03c2011d 100644
--- a/.gometalinter.json
+++ b/.gometalinter.json
@@ -34,7 +34,6 @@
"lll"
],
"exclude": [
- "don't use underscores in Go names",
"(sys/(akaros|freebsd|fuchsia|linux|netbsd|test|windows)/init.*|sys/targets/common.go).* don't use ALL_CAPS in Go names",
"exported .* should have comment",
"comment on .* should be of the form",
diff --git a/pkg/compiler/types.go b/pkg/compiler/types.go
index 7c874130d..825071324 100644
--- a/pkg/compiler/types.go
+++ b/pkg/compiler/types.go
@@ -392,15 +392,15 @@ var typeArgTextType = &typeArg{
func genTextType(t *ast.Type) prog.TextKind {
switch t.Ident {
case "x86_real":
- return prog.Text_x86_real
+ return prog.TextX86Real
case "x86_16":
- return prog.Text_x86_16
+ return prog.TextX86bit16
case "x86_32":
- return prog.Text_x86_32
+ return prog.TextX86bit32
case "x86_64":
- return prog.Text_x86_64
+ return prog.TextX86bit64
case "arm64":
- return prog.Text_arm64
+ return prog.TextArm64
default:
panic(fmt.Sprintf("unknown text type %q", t.Ident))
}
diff --git a/pkg/config/config.go b/pkg/config/config.go
index f4863916d..5502df765 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -63,10 +63,18 @@ func checkUnknownFieldsRec(data []byte, prefix string, typ reflect.Type) error {
fields := make(map[string]reflect.Type)
for i := 0; i < typ.NumField(); i++ {
field := typ.Field(i)
- if field.Tag.Get("json") == "-" {
+ tag := field.Tag.Get("json")
+ if tag == "-" {
continue
}
- fields[strings.ToLower(field.Name)] = field.Type
+ name := strings.ToLower(field.Name)
+ if tag != "" {
+ if tag != strings.ToLower(tag) {
+ return fmt.Errorf("json tag on '%v%v' should be lower-case", prefix, name)
+ }
+ name = tag
+ }
+ fields[name] = field.Type
}
f := make(map[string]interface{})
if err := json.Unmarshal(data, &f); err != nil {
diff --git a/prog/rand.go b/prog/rand.go
index ad0ef1c7c..5489ca10d 100644
--- a/prog/rand.go
+++ b/prog/rand.go
@@ -322,7 +322,7 @@ func (r *randGen) createResource(s *state, res *ResourceType) (arg Arg, calls []
func (r *randGen) generateText(kind TextKind) []byte {
switch kind {
- case Text_arm64:
+ case TextArm64:
// Just a stub, need something better.
text := make([]byte, 50)
for i := range text {
@@ -337,7 +337,7 @@ func (r *randGen) generateText(kind TextKind) []byte {
func (r *randGen) mutateText(kind TextKind, text []byte) []byte {
switch kind {
- case Text_arm64:
+ case TextArm64:
return mutateData(r, text, 40, 60)
default:
cfg := createIfuzzConfig(kind)
@@ -365,13 +365,13 @@ func createIfuzzConfig(kind TextKind) *ifuzz.Config {
},
}
switch kind {
- case Text_x86_real:
+ case TextX86Real:
cfg.Mode = ifuzz.ModeReal16
- case Text_x86_16:
+ case TextX86bit16:
cfg.Mode = ifuzz.ModeProt16
- case Text_x86_32:
+ case TextX86bit32:
cfg.Mode = ifuzz.ModeProt32
- case Text_x86_64:
+ case TextX86bit64:
cfg.Mode = ifuzz.ModeLong64
}
return cfg
diff --git a/prog/types.go b/prog/types.go
index 74dc17d02..9b80d0576 100644
--- a/prog/types.go
+++ b/prog/types.go
@@ -252,11 +252,11 @@ const (
type TextKind int
const (
- Text_x86_real TextKind = iota
- Text_x86_16
- Text_x86_32
- Text_x86_64
- Text_arm64
+ TextX86Real TextKind = iota
+ TextX86bit16
+ TextX86bit32
+ TextX86bit64
+ TextArm64
)
type BufferType struct {
diff --git a/syz-ci/jobs.go b/syz-ci/jobs.go
index fbbfdbaea..d3df278d9 100644
--- a/syz-ci/jobs.go
+++ b/syz-ci/jobs.go
@@ -35,11 +35,11 @@ func newJobProcessor(cfg *Config, managers []*Manager) *JobProcessor {
jp := &JobProcessor{
name: fmt.Sprintf("%v-job", cfg.Name),
managers: managers,
- syzkallerRepo: cfg.Syzkaller_Repo,
- syzkallerBranch: cfg.Syzkaller_Branch,
+ syzkallerRepo: cfg.SyzkallerRepo,
+ syzkallerBranch: cfg.SyzkallerBranch,
}
- if cfg.Dashboard_Addr != "" && cfg.Dashboard_Client != "" {
- jp.dash = dashapi.New(cfg.Dashboard_Client, cfg.Dashboard_Addr, cfg.Dashboard_Key)
+ if cfg.DashboardAddr != "" && cfg.DashboardClient != "" {
+ jp.dash = dashapi.New(cfg.DashboardClient, cfg.DashboardAddr, cfg.DashboardKey)
}
return jp
}
@@ -265,7 +265,7 @@ func (jp *JobProcessor) buildImage(job *Job) error {
image := filepath.Join(imageDir, "image")
key := filepath.Join(imageDir, "key")
err = kernel.CreateImage(kernelDir, mgr.mgrcfg.Userspace,
- mgr.mgrcfg.Kernel_Cmdline, mgr.mgrcfg.Kernel_Sysctl, image, key)
+ mgr.mgrcfg.KernelCmdline, mgr.mgrcfg.KernelSysctl, image, key)
if err != nil {
return fmt.Errorf("image build failed: %v", err)
}
@@ -275,7 +275,7 @@ func (jp *JobProcessor) buildImage(job *Job) error {
mgrcfg.Name += "-job"
mgrcfg.Workdir = workDir
mgrcfg.Vmlinux = filepath.Join(kernelDir, "vmlinux")
- mgrcfg.Kernel_Src = kernelDir
+ mgrcfg.KernelSrc = kernelDir
mgrcfg.Syzkaller = syzkallerDir
mgrcfg.Image = image
mgrcfg.SSHKey = key
diff --git a/syz-ci/manager.go b/syz-ci/manager.go
index b7fc9ab72..db20b37bb 100644
--- a/syz-ci/manager.go
+++ b/syz-ci/manager.go
@@ -64,13 +64,13 @@ func createManager(cfg *Config, mgrcfg *ManagerConfig, stop chan struct{}) *Mana
if err := osutil.MkdirAll(dir); err != nil {
log.Fatal(err)
}
- if mgrcfg.Repo_Alias == "" {
- mgrcfg.Repo_Alias = mgrcfg.Repo
+ if mgrcfg.RepoAlias == "" {
+ mgrcfg.RepoAlias = mgrcfg.Repo
}
var dash *dashapi.Dashboard
- if cfg.Dashboard_Addr != "" && mgrcfg.Dashboard_Client != "" {
- dash = dashapi.New(mgrcfg.Dashboard_Client, cfg.Dashboard_Addr, mgrcfg.Dashboard_Key)
+ if cfg.DashboardAddr != "" && mgrcfg.DashboardClient != "" {
+ dash = dashapi.New(mgrcfg.DashboardClient, cfg.DashboardAddr, mgrcfg.DashboardKey)
}
// Assume compiler and config don't change underneath us.
@@ -78,7 +78,7 @@ func createManager(cfg *Config, mgrcfg *ManagerConfig, stop chan struct{}) *Mana
if err != nil {
log.Fatal(err)
}
- configData, err := ioutil.ReadFile(mgrcfg.Kernel_Config)
+ configData, err := ioutil.ReadFile(mgrcfg.KernelConfig)
if err != nil {
log.Fatal(err)
}
@@ -89,7 +89,7 @@ func createManager(cfg *Config, mgrcfg *ManagerConfig, stop chan struct{}) *Mana
// Prepare manager config skeleton (other fields are filled in writeConfig).
managercfg := mgrconfig.DefaultValues()
- if err := config.LoadData(mgrcfg.Manager_Config, managercfg); err != nil {
+ if err := config.LoadData(mgrcfg.ManagerConfig, managercfg); err != nil {
log.Fatalf("failed to load manager %v config: %v", mgrcfg.Name, err)
}
managercfg.TargetOS, managercfg.TargetVMArch, managercfg.TargetArch, err = mgrconfig.SplitTarget(managercfg.Target)
@@ -266,7 +266,7 @@ func (mgr *Manager) build() error {
return fmt.Errorf("failed to create tmp dir: %v", err)
}
kernelConfig := filepath.Join(tmpDir, "kernel.config")
- if err := osutil.CopyFile(mgr.mgrcfg.Kernel_Config, kernelConfig); err != nil {
+ if err := osutil.CopyFile(mgr.mgrcfg.KernelConfig, kernelConfig); err != nil {
return err
}
if err := config.SaveFile(filepath.Join(tmpDir, "tag"), info); err != nil {
@@ -275,7 +275,7 @@ func (mgr *Manager) build() error {
if err := kernel.Build(mgr.kernelDir, mgr.mgrcfg.Compiler, kernelConfig); err != nil {
rep := &report.Report{
- Title: fmt.Sprintf("%v build error", mgr.mgrcfg.Repo_Alias),
+ Title: fmt.Sprintf("%v build error", mgr.mgrcfg.RepoAlias),
Output: []byte(err.Error()),
}
if err := mgr.reportBuildError(rep, info, tmpDir); err != nil {
@@ -290,7 +290,7 @@ func (mgr *Manager) build() error {
image := filepath.Join(tmpDir, "image")
key := filepath.Join(tmpDir, "key")
err = kernel.CreateImage(mgr.kernelDir, mgr.mgrcfg.Userspace,
- mgr.mgrcfg.Kernel_Cmdline, mgr.mgrcfg.Kernel_Sysctl, image, key)
+ mgr.mgrcfg.KernelCmdline, mgr.mgrcfg.KernelSysctl, image, key)
if err != nil {
return fmt.Errorf("image build failed: %v", err)
}
@@ -368,7 +368,7 @@ func (mgr *Manager) testImage(imageDir string, info *BuildInfo) error {
return err
}
if rep != nil {
- rep.Title = fmt.Sprintf("%v boot error: %v", mgr.mgrcfg.Repo_Alias, rep.Title)
+ rep.Title = fmt.Sprintf("%v boot error: %v", mgr.mgrcfg.RepoAlias, rep.Title)
if err := mgr.reportBuildError(rep, info, imageDir); err != nil {
mgr.Errorf("failed to report image error: %v", err)
}
@@ -380,7 +380,7 @@ func (mgr *Manager) testImage(imageDir string, info *BuildInfo) error {
return err
}
if rep != nil {
- rep.Title = fmt.Sprintf("%v test error: %v", mgr.mgrcfg.Repo_Alias, rep.Title)
+ rep.Title = fmt.Sprintf("%v test error: %v", mgr.mgrcfg.RepoAlias, rep.Title)
if err := mgr.reportBuildError(rep, info, imageDir); err != nil {
mgr.Errorf("failed to report image error: %v", err)
}
@@ -421,7 +421,7 @@ func (mgr *Manager) createTestConfig(imageDir string, info *BuildInfo) (*mgrconf
mgrcfg.Vmlinux = filepath.Join(imageDir, "obj", "vmlinux")
mgrcfg.Image = filepath.Join(imageDir, "image")
mgrcfg.SSHKey = filepath.Join(imageDir, "key")
- mgrcfg.Kernel_Src = mgr.kernelDir
+ mgrcfg.KernelSrc = mgr.kernelDir
mgrcfg.Syzkaller = filepath.FromSlash("syzkaller/current")
cfgdata, err := config.SaveData(mgrcfg)
if err != nil {
@@ -439,14 +439,14 @@ func (mgr *Manager) writeConfig(buildTag string) (string, error) {
*mgrcfg = *mgr.managercfg
if mgr.dash != nil {
- mgrcfg.Dashboard_Client = mgr.dash.Client
- mgrcfg.Dashboard_Addr = mgr.dash.Addr
- mgrcfg.Dashboard_Key = mgr.dash.Key
+ mgrcfg.DashboardClient = mgr.dash.Client
+ mgrcfg.DashboardAddr = mgr.dash.Addr
+ mgrcfg.DashboardKey = mgr.dash.Key
}
- if mgr.cfg.Hub_Addr != "" {
- mgrcfg.Hub_Client = mgr.cfg.Name
- mgrcfg.Hub_Addr = mgr.cfg.Hub_Addr
- mgrcfg.Hub_Key = mgr.cfg.Hub_Key
+ if mgr.cfg.HubAddr != "" {
+ mgrcfg.HubClient = mgr.cfg.Name
+ mgrcfg.HubAddr = mgr.cfg.HubAddr
+ mgrcfg.HubKey = mgr.cfg.HubKey
}
mgrcfg.Tag = buildTag
mgrcfg.Workdir = mgr.workDir
@@ -454,7 +454,7 @@ func (mgr *Manager) writeConfig(buildTag string) (string, error) {
// Strictly saying this is somewhat racy as builder can concurrently
// update the source, or even delete and re-clone. If this causes
// problems, we need to make a copy of sources after build.
- mgrcfg.Kernel_Src = mgr.kernelDir
+ mgrcfg.KernelSrc = mgr.kernelDir
mgrcfg.Syzkaller = filepath.FromSlash("syzkaller/current")
mgrcfg.Image = filepath.Join(mgr.currentDir, "image")
mgrcfg.SSHKey = filepath.Join(mgr.currentDir, "key")
diff --git a/syz-ci/syz-ci.go b/syz-ci/syz-ci.go
index 9c68b7eb8..c75004e77 100644
--- a/syz-ci/syz-ci.go
+++ b/syz-ci/syz-ci.go
@@ -68,34 +68,39 @@ import (
var flagConfig = flag.String("config", "", "config file")
type Config struct {
- Name string
- HTTP string
- Dashboard_Addr string // Optional.
- Dashboard_Client string // Optional.
- Dashboard_Key string // Optional.
- Hub_Addr string // Optional.
- Hub_Key string // Optional.
- Goroot string // Go 1.8+ toolchain dir.
- Syzkaller_Repo string
- Syzkaller_Branch string
- Syzkaller_Descriptions string // Dir with additional syscall descriptions (.txt and .const files).
- Enable_Jobs bool // Enable patch testing jobs.
- Managers []*ManagerConfig
+ Name string `json:"name"`
+ HTTP string `json:"http"`
+ DashboardAddr string `json:"dashboard_addr"` // Optional.
+ DashboardClient string `json:"dashboard_client"` // Optional.
+ DashboardKey string `json:"dashboard_key"` // Optional.
+ HubAddr string `json:"hub_addr"` // Optional.
+ HubKey string `json:"hub_key"` // Optional.
+ Goroot string `json:"goroot"` // Go 1.8+ toolchain dir.
+ SyzkallerRepo string `json:"syzkaller_repo"`
+ SyzkallerBranch string `json:"syzkaller_branch"`
+ // Dir with additional syscall descriptions (.txt and .const files).
+ SyzkallerDescriptions string `json:"syzkaller_descriptions"`
+ // Enable patch testing jobs.
+ EnableJobs bool `json:"enable_jobs"`
+ Managers []*ManagerConfig `json:"managers"`
}
type ManagerConfig struct {
- Name string
- Dashboard_Client string
- Dashboard_Key string
- Repo string
- Repo_Alias string // Short name of the repo (e.g. "linux-next"), used only for reporting.
- Branch string
- Compiler string
- Userspace string
- Kernel_Config string
- Kernel_Cmdline string // File with kernel cmdline values (optional).
- Kernel_Sysctl string // File with sysctl values (e.g. output of sysctl -a, optional).
- Manager_Config json.RawMessage
+ Name string `json:"name"`
+ DashboardClient string `json:"dashboard_client"`
+ DashboardKey string `json:"dashboard_key"`
+ Repo string `json:"repo"`
+ // Short name of the repo (e.g. "linux-next"), used only for reporting.
+ RepoAlias string `json:"repo_alias"`
+ Branch string `json:"branch"`
+ Compiler string `json:"compiler"`
+ Userspace string `json:"userspace"`
+ KernelConfig string `json:"kernel_config"`
+ // File with kernel cmdline values (optional).
+ KernelCmdline string `json:"kernel_cmdline"`
+ // File with sysctl values (e.g. output of sysctl -a, optional).
+ KernelSysctl string `json:"kernel_sysctl"`
+ ManagerConfig json.RawMessage `json:"manager_config"`
}
func main() {
@@ -141,7 +146,7 @@ func main() {
mgr.loop()
}()
}
- if cfg.Enable_Jobs {
+ if cfg.EnableJobs {
jp := newJobProcessor(cfg, managers)
wg.Add(1)
go func() {
@@ -161,9 +166,9 @@ func main() {
func loadConfig(filename string) (*Config, error) {
cfg := &Config{
- Syzkaller_Repo: "https://github.com/google/syzkaller.git",
- Syzkaller_Branch: "master",
- Goroot: os.Getenv("GOROOT"),
+ SyzkallerRepo: "https://github.com/google/syzkaller.git",
+ SyzkallerBranch: "master",
+ Goroot: os.Getenv("GOROOT"),
}
if err := config.LoadFile(filename, cfg); err != nil {
return nil, err
@@ -182,7 +187,7 @@ func loadConfig(filename string) (*Config, error) {
return nil, fmt.Errorf("param 'managers[%v].name' is empty", i)
}
mgrcfg := new(mgrconfig.Config)
- if err := config.LoadData(mgr.Manager_Config, mgrcfg); err != nil {
+ if err := config.LoadData(mgr.ManagerConfig, mgrcfg); err != nil {
return nil, fmt.Errorf("manager %v: %v", mgr.Name, err)
}
}
diff --git a/syz-ci/syzupdater.go b/syz-ci/syzupdater.go
index 4cdb2d73d..134c044fa 100644
--- a/syz-ci/syzupdater.go
+++ b/syz-ci/syzupdater.go
@@ -74,7 +74,7 @@ func NewSyzUpdater(cfg *Config) *SyzUpdater {
targets := make(map[string]bool)
for _, mgr := range cfg.Managers {
mgrcfg := new(mgrconfig.Config)
- if err := config.LoadData(mgr.Manager_Config, mgrcfg); err != nil {
+ if err := config.LoadData(mgr.ManagerConfig, mgrcfg); err != nil {
log.Fatalf("failed to load manager %v config: %v", mgr.Name, err)
}
os, vmarch, arch, err := mgrconfig.SplitTarget(mgrcfg.Target)
@@ -93,9 +93,9 @@ func NewSyzUpdater(cfg *Config) *SyzUpdater {
return &SyzUpdater{
exe: exe,
- repo: cfg.Syzkaller_Repo,
- branch: cfg.Syzkaller_Branch,
- descriptions: cfg.Syzkaller_Descriptions,
+ repo: cfg.SyzkallerRepo,
+ branch: cfg.SyzkallerBranch,
+ descriptions: cfg.SyzkallerDescriptions,
gopathDir: gopath,
syzkallerDir: syzkallerDir,
latestDir: filepath.Join("syzkaller", "latest"),
diff --git a/syz-ci/testing.go b/syz-ci/testing.go
index 6806f371d..387be26e4 100644
--- a/syz-ci/testing.go
+++ b/syz-ci/testing.go
@@ -19,7 +19,7 @@ import (
// bootInstance boots one VM using the provided config.
// Returns either instance and reporter, or report with boot failure, or error.
func bootInstance(mgrcfg *mgrconfig.Config) (*vm.Instance, report.Reporter, *report.Report, error) {
- reporter, err := report.NewReporter(mgrcfg.TargetOS, mgrcfg.Kernel_Src,
+ reporter, err := report.NewReporter(mgrcfg.TargetOS, mgrcfg.KernelSrc,
filepath.Dir(mgrcfg.Vmlinux), nil, mgrcfg.ParsedIgnores)
if err != nil {
return nil, nil, nil, err
diff --git a/syz-manager/manager.go b/syz-manager/manager.go
index 5e01111b7..d5b64696d 100644
--- a/syz-manager/manager.go
+++ b/syz-manager/manager.go
@@ -130,7 +130,7 @@ func main() {
if err != nil {
log.Fatalf("%v", err)
}
- syscalls, err := mgrconfig.ParseEnabledSyscalls(target, cfg.Enable_Syscalls, cfg.Disable_Syscalls)
+ syscalls, err := mgrconfig.ParseEnabledSyscalls(target, cfg.EnabledSyscalls, cfg.DisabledSyscalls)
if err != nil {
log.Fatalf("%v", err)
}
@@ -268,8 +268,8 @@ func RunManager(cfg *mgrconfig.Config, target *prog.Target, syscalls map[int]boo
mgr.port = s.Addr().(*net.TCPAddr).Port
go s.Serve()
- if cfg.Dashboard_Addr != "" {
- mgr.dash = dashapi.New(cfg.Dashboard_Client, cfg.Dashboard_Addr, cfg.Dashboard_Key)
+ if cfg.DashboardAddr != "" {
+ mgr.dash = dashapi.New(cfg.DashboardClient, cfg.DashboardAddr, cfg.DashboardKey)
}
go func() {
@@ -336,7 +336,7 @@ func RunManager(cfg *mgrconfig.Config, target *prog.Target, syscalls map[int]boo
go mgr.dashboardReporter()
}
- if mgr.cfg.Hub_Client != "" {
+ if mgr.cfg.HubClient != "" {
go func() {
for {
time.Sleep(time.Minute)
@@ -605,12 +605,12 @@ func (mgr *Manager) isSuppressed(crash *Crash) bool {
}
func (mgr *Manager) emailCrash(crash *Crash) {
- if len(mgr.cfg.Email_Addrs) == 0 {
+ if len(mgr.cfg.EmailAddrs) == 0 {
return
}
args := []string{"-s", "syzkaller: " + crash.Title}
- args = append(args, mgr.cfg.Email_Addrs...)
- log.Logf(0, "sending email to %v", mgr.cfg.Email_Addrs)
+ args = append(args, mgr.cfg.EmailAddrs...)
+ log.Logf(0, "sending email to %v", mgr.cfg.EmailAddrs)
cmd := exec.Command("mailx", args...)
cmd.Stdin = bytes.NewReader(crash.Report.Report)
@@ -816,7 +816,7 @@ func (mgr *Manager) getReporter() report.Reporter {
// This will be more general taking into account modules and other OSes.
kernelSrc, kernelObj := "", ""
if mgr.cfg.Vmlinux != "" {
- kernelSrc = mgr.cfg.Kernel_Src
+ kernelSrc = mgr.cfg.KernelSrc
kernelObj = filepath.Dir(mgr.cfg.Vmlinux)
}
mgr.reporter, err = report.NewReporter(mgr.cfg.TargetOS, kernelSrc, kernelObj,
@@ -953,7 +953,7 @@ func (mgr *Manager) Check(a *rpctype.CheckArgs, r *int) error {
mgr.target.Revision, a.FuzzerSyzRev, a.ExecutorSyzRev)
}
}
- if len(mgr.cfg.Enable_Syscalls) != 0 && len(a.DisabledCalls) != 0 {
+ if len(mgr.cfg.EnabledSyscalls) != 0 && len(a.DisabledCalls) != 0 {
disabled := make(map[string]string)
for _, dc := range a.DisabledCalls {
disabled[dc.Name] = dc.Reason
@@ -1069,7 +1069,7 @@ func (mgr *Manager) Poll(a *rpctype.PollArgs, r *rpctype.PollRes) error {
if len(mgr.candidates) == 0 {
mgr.candidates = nil
if mgr.phase == phaseInit {
- if mgr.cfg.Hub_Client != "" {
+ if mgr.cfg.HubClient != "" {
mgr.phase = phaseTriagedCorpus
} else {
mgr.phase = phaseTriagedHub
@@ -1101,8 +1101,8 @@ func (mgr *Manager) hubSync() {
mgr.minimizeCorpus()
if mgr.hub == nil {
a := &rpctype.HubConnectArgs{
- Client: mgr.cfg.Hub_Client,
- Key: mgr.cfg.Hub_Key,
+ Client: mgr.cfg.HubClient,
+ Key: mgr.cfg.HubKey,
Manager: mgr.cfg.Name,
Fresh: mgr.fresh,
Calls: mgr.enabledCalls,
@@ -1116,27 +1116,27 @@ func (mgr *Manager) hubSync() {
// Hub.Connect request can be very large, so do it on a transient connection
// (rpc connection buffers never shrink).
// Also don't do hub rpc's under the mutex -- hub can be slow or inaccessible.
- if err := rpctype.RPCCall(mgr.cfg.Hub_Addr, "Hub.Connect", a, nil); err != nil {
+ if err := rpctype.RPCCall(mgr.cfg.HubAddr, "Hub.Connect", a, nil); err != nil {
mgr.mu.Lock()
log.Logf(0, "Hub.Connect rpc failed: %v", err)
return
}
- conn, err := rpctype.NewRPCClient(mgr.cfg.Hub_Addr)
+ conn, err := rpctype.NewRPCClient(mgr.cfg.HubAddr)
if err != nil {
mgr.mu.Lock()
- log.Logf(0, "failed to connect to hub at %v: %v", mgr.cfg.Hub_Addr, err)
+ log.Logf(0, "failed to connect to hub at %v: %v", mgr.cfg.HubAddr, err)
return
}
mgr.mu.Lock()
mgr.hub = conn
mgr.hubCorpus = hubCorpus
mgr.fresh = false
- log.Logf(0, "connected to hub at %v, corpus %v", mgr.cfg.Hub_Addr, len(mgr.corpus))
+ log.Logf(0, "connected to hub at %v, corpus %v", mgr.cfg.HubAddr, len(mgr.corpus))
}
a := &rpctype.HubSyncArgs{
- Client: mgr.cfg.Hub_Client,
- Key: mgr.cfg.Hub_Key,
+ Client: mgr.cfg.HubClient,
+ Key: mgr.cfg.HubKey,
Manager: mgr.cfg.Name,
}
corpus := make(map[hash.Sig]bool)
diff --git a/syz-manager/mgrconfig/mgrconfig.go b/syz-manager/mgrconfig/mgrconfig.go
index 5bd96975f..2a1b7bf8a 100644
--- a/syz-manager/mgrconfig/mgrconfig.go
+++ b/syz-manager/mgrconfig/mgrconfig.go
@@ -19,48 +19,69 @@ import (
)
type Config struct {
- Name string // Instance name (used for identification and as GCE instance prefix)
- Target string // Target OS/arch, e.g. "linux/arm64" or "linux/amd64/386" (amd64 OS with 386 test process)
- HTTP string // TCP address to serve HTTP stats page (e.g. "localhost:50000")
- RPC string // TCP address to serve RPC for fuzzer processes (optional)
- Workdir string
- Vmlinux string
- Kernel_Src string // kernel source directory
- Tag string // arbitrary optional tag that is saved along with crash reports (e.g. branch/commit)
- Image string // linux image for VMs
- SSHKey string // ssh key for the image (may be empty for some VM types)
- SSH_User string // ssh user ("root" by default)
+ // Instance name (used for identification and as GCE instance prefix).
+ Name string `json:"name"`
+ // Target OS/arch, e.g. "linux/arm64" or "linux/amd64/386" (amd64 OS with 386 test process).
+ Target string `json:"target"`
+ // TCP address to serve HTTP stats page (e.g. "localhost:50000").
+ HTTP string `json:"http"`
+ // TCP address to serve RPC for fuzzer processes (optional).
+ RPC string `json:"rpc"`
+ Workdir string `json:"workdir"`
+ Vmlinux string `json:"vmlinux"`
+ // Kernel source directory.
+ KernelSrc string `json:"kernel_src"`
+ // Arbitrary optional tag that is saved along with crash reports (e.g. branch/commit).
+ Tag string `json:"tag"`
+ // Linux image for VMs.
+ Image string `json:"image"`
+ // SSH key for the image (may be empty for some VM types).
+ SSHKey string `json:"sshkey"`
+ // SSH user ("root" by default).
+ SSHUser string `json:"ssh_user"`
- Hub_Client string
- Hub_Addr string
- Hub_Key string
+ HubClient string `json:"hub_client"`
+ HubAddr string `json:"hub_addr"`
+ HubKey string `json:"hub_key"`
- Email_Addrs []string // syz-manager will send crash emails to this list of emails using mailx (optional)
+ // syz-manager will send crash emails to this list of emails using mailx (optional).
+ EmailAddrs []string `json:"email_addrs"`
- Dashboard_Client string
- Dashboard_Addr string
- Dashboard_Key string
+ DashboardClient string `json:"dashboard_client"`
+ DashboardAddr string `json:"dashboard_addr"`
+ DashboardKey string `json:"dashboard_key"`
- Syzkaller string // path to syzkaller checkout (syz-manager will look for binaries in bin subdir)
- Procs int // number of parallel processes inside of every VM
+ // Path to syzkaller checkout (syz-manager will look for binaries in bin subdir).
+ Syzkaller string `json:"syzkaller"`
+ // Number of parallel processes inside of every VM.
+ Procs int `json:"procs"`
- Sandbox string // type of sandbox to use during fuzzing:
+ // Type of sandbox to use during fuzzing:
// "none": don't do anything special (has false positives, e.g. due to killing init)
// "setuid": impersonate into user nobody (65534), default
// "namespace": create a new namespace for fuzzer using CLONE_NEWNS/CLONE_NEWNET/CLONE_NEWPID/etc,
- // requires building kernel with CONFIG_NAMESPACES, CONFIG_UTS_NS, CONFIG_USER_NS, CONFIG_PID_NS and CONFIG_NET_NS.
+ // requires building kernel with CONFIG_NAMESPACES, CONFIG_UTS_NS, CONFIG_USER_NS,
+ // CONFIG_PID_NS and CONFIG_NET_NS.
+ Sandbox string `json:"sandbox"`
- Cover bool // use kcov coverage (default: true)
- Leak bool // do memory leak checking
- Reproduce bool // reproduce, localize and minimize crashers (on by default)
+ // Use KCOV coverage (default: true).
+ Cover bool `json:"cover"`
+ // Do memory leak checking.
+ Leak bool `json:"leak"`
+ // Reproduce, localize and minimize crashers (default: true).
+ Reproduce bool `json:"reproduce"`
- Enable_Syscalls []string
- Disable_Syscalls []string
- Suppressions []string // don't save reports matching these regexps, but reboot VM after them
- Ignores []string // completely ignore reports matching these regexps (don't save nor reboot)
+ EnabledSyscalls []string `json:"enable_syscalls"`
+ DisabledSyscalls []string `json:"disable_syscalls"`
+ // Don't save reports matching these regexps, but reboot VM after them.
+ Suppressions []string `json:"suppressions"`
+ // Completely ignore reports matching these regexps (don't save nor reboot).
+ Ignores []string `json:"ignores"`
- Type string // VM type (qemu, kvm, local)
- VM json.RawMessage // VM-type-specific config
+ // VM type (qemu, gce, android, isolated, etc).
+ Type string `json:"type"`
+ // VM-type-specific config.
+ VM json.RawMessage `json:"vm"`
// Implementation details beyond this point.
ParsedSuppressions []*regexp.Regexp `json:"-"`
@@ -85,7 +106,7 @@ func LoadFile(filename string) (*Config, error) {
func DefaultValues() *Config {
return &Config{
- SSH_User: "root",
+ SSHUser: "root",
Cover: true,
Reproduce: true,
Sandbox: "setuid",
@@ -161,20 +182,20 @@ func load(data []byte, filename string) (*Config, error) {
cfg.Workdir = osutil.Abs(cfg.Workdir)
cfg.Vmlinux = osutil.Abs(cfg.Vmlinux)
cfg.Syzkaller = osutil.Abs(cfg.Syzkaller)
- if cfg.Kernel_Src == "" {
- cfg.Kernel_Src = filepath.Dir(cfg.Vmlinux) // assume in-tree build by default
+ if cfg.KernelSrc == "" {
+ cfg.KernelSrc = filepath.Dir(cfg.Vmlinux) // assume in-tree build by default
}
if err := parseSuppressions(cfg); err != nil {
return nil, err
}
- if cfg.Hub_Client != "" && (cfg.Name == "" || cfg.Hub_Addr == "" || cfg.Hub_Key == "") {
+ if cfg.HubClient != "" && (cfg.Name == "" || cfg.HubAddr == "" || cfg.HubKey == "") {
return nil, fmt.Errorf("hub_client is set, but name/hub_addr/hub_key is empty")
}
- if cfg.Dashboard_Client != "" && (cfg.Name == "" ||
- cfg.Dashboard_Addr == "" ||
- cfg.Dashboard_Key == "") {
+ if cfg.DashboardClient != "" && (cfg.Name == "" ||
+ cfg.DashboardAddr == "" ||
+ cfg.DashboardKey == "") {
return nil, fmt.Errorf("dashboard_client is set, but name/dashboard_addr/dashboard_key is empty")
}
@@ -292,7 +313,7 @@ func CreateVMEnv(cfg *Config, debug bool) *vm.Env {
Workdir: cfg.Workdir,
Image: cfg.Image,
SSHKey: cfg.SSHKey,
- SSHUser: cfg.SSH_User,
+ SSHUser: cfg.SSHUser,
Debug: debug,
Config: cfg.VM,
}
diff --git a/tools/syz-crush/crush.go b/tools/syz-crush/crush.go
index d65e1bc5b..531b43888 100644
--- a/tools/syz-crush/crush.go
+++ b/tools/syz-crush/crush.go
@@ -44,7 +44,7 @@ func main() {
if err != nil {
log.Fatalf("%v", err)
}
- reporter, err := report.NewReporter(cfg.TargetOS, cfg.Kernel_Src,
+ reporter, err := report.NewReporter(cfg.TargetOS, cfg.KernelSrc,
filepath.Dir(cfg.Vmlinux), nil, cfg.ParsedIgnores)
if err != nil {
log.Fatalf("%v", err)
diff --git a/tools/syz-repro/repro.go b/tools/syz-repro/repro.go
index e51a4d459..e041d3938 100644
--- a/tools/syz-repro/repro.go
+++ b/tools/syz-repro/repro.go
@@ -57,7 +57,7 @@ func main() {
for i := range vmIndexes {
vmIndexes[i] = i
}
- reporter, err := report.NewReporter(cfg.TargetOS, cfg.Kernel_Src, "", nil, cfg.ParsedIgnores)
+ reporter, err := report.NewReporter(cfg.TargetOS, cfg.KernelSrc, "", nil, cfg.ParsedIgnores)
if err != nil {
log.Fatalf("%v", err)
}
diff --git a/vm/adb/adb.go b/vm/adb/adb.go
index e6908a9aa..1c1271b34 100644
--- a/vm/adb/adb.go
+++ b/vm/adb/adb.go
@@ -28,15 +28,15 @@ func init() {
}
type Config struct {
- Adb string // adb binary name ("adb" by default)
- Devices []string // list of adb device IDs to use
+ Adb string `json:"adb"` // adb binary name ("adb" by default)
+ Devices []string `json:"devices"` // list of adb device IDs to use
// Ensure that a device battery level is at 20+% before fuzzing.
// Sometimes we observe that a device can't charge during heavy fuzzing
// and eventually powers down (which then requires manual intervention).
// This option is enabled by default. Turn it off if your devices
// don't have battery service, or it causes problems otherwise.
- Battery_Check bool
+ BatteryCheck bool `json:"battery_check"`
}
type Pool struct {
@@ -54,8 +54,8 @@ type instance struct {
func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
cfg := &Config{
- Adb: "adb",
- Battery_Check: true,
+ Adb: "adb",
+ BatteryCheck: true,
}
if err := config.LoadData(env.Config, cfg); err != nil {
return nil, fmt.Errorf("failed to parse adb vm config: %v", err)
@@ -103,7 +103,7 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {
return nil, err
}
inst.console = findConsole(inst.adbBin, inst.device)
- if pool.cfg.Battery_Check {
+ if pool.cfg.BatteryCheck {
if err := inst.checkBatteryLevel(); err != nil {
return nil, err
}
diff --git a/vm/gce/gce.go b/vm/gce/gce.go
index 036ffeb8b..dbd1001fd 100644
--- a/vm/gce/gce.go
+++ b/vm/gce/gce.go
@@ -36,10 +36,10 @@ func init() {
}
type Config struct {
- Count int // number of VMs to use
- Machine_Type string // GCE machine type (e.g. "n1-highcpu-2")
- GCS_Path string // GCS path to upload image
- GCE_Image string // Pre-created GCE image to use
+ Count int `json:"count"` // number of VMs to use
+ MachineType string `json:"machine_type"` // GCE machine type (e.g. "n1-highcpu-2")
+ GCSPath string `json:"gcs_path"` // GCS path to upload image
+ GCEImage string `json:"gce_image"` // Pre-created GCE image to use
}
type Pool struct {
@@ -77,16 +77,16 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
if env.Debug {
cfg.Count = 1
}
- if cfg.Machine_Type == "" {
+ if cfg.MachineType == "" {
return nil, fmt.Errorf("machine_type parameter is empty")
}
- if cfg.GCE_Image == "" && cfg.GCS_Path == "" {
+ if cfg.GCEImage == "" && cfg.GCSPath == "" {
return nil, fmt.Errorf("gcs_path parameter is empty")
}
- if cfg.GCE_Image == "" && env.Image == "" {
+ if cfg.GCEImage == "" && env.Image == "" {
return nil, fmt.Errorf("config param image is empty (required for GCE)")
}
- if cfg.GCE_Image != "" && env.Image != "" {
+ if cfg.GCEImage != "" && env.Image != "" {
return nil, fmt.Errorf("both image and gce_image are specified")
}
@@ -97,18 +97,18 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
log.Logf(0, "GCE initialized: running on %v, internal IP %v, project %v, zone %v, net %v/%v",
GCE.Instance, GCE.InternalIP, GCE.ProjectID, GCE.ZoneID, GCE.Network, GCE.Subnetwork)
- if cfg.GCE_Image == "" {
- cfg.GCE_Image = env.Name
- gcsImage := filepath.Join(cfg.GCS_Path, env.Name+"-image.tar.gz")
+ 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)
if err := uploadImageToGCS(env.Image, gcsImage); err != nil {
return nil, err
}
- log.Logf(0, "creating GCE image %v...", cfg.GCE_Image)
- if err := GCE.DeleteImage(cfg.GCE_Image); err != nil {
+ log.Logf(0, "creating GCE image %v...", cfg.GCEImage)
+ if err := GCE.DeleteImage(cfg.GCEImage); err != nil {
return nil, fmt.Errorf("failed to delete GCE image: %v", err)
}
- if err := GCE.CreateImage(cfg.GCE_Image, gcsImage); err != nil {
+ if err := GCE.CreateImage(cfg.GCEImage, gcsImage); err != nil {
return nil, fmt.Errorf("failed to create GCE image: %v", err)
}
}
@@ -142,7 +142,7 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {
return nil, err
}
log.Logf(0, "creating instance: %v", name)
- ip, err := pool.GCE.CreateInstance(name, pool.cfg.Machine_Type, pool.cfg.GCE_Image, string(gceKeyPub))
+ ip, err := pool.GCE.CreateInstance(name, pool.cfg.MachineType, pool.cfg.GCEImage, string(gceKeyPub))
if err != nil {
return nil, err
}
diff --git a/vm/isolated/isolated.go b/vm/isolated/isolated.go
index 86adb80dc..f86ec96fd 100644
--- a/vm/isolated/isolated.go
+++ b/vm/isolated/isolated.go
@@ -24,9 +24,9 @@ func init() {
}
type Config struct {
- Targets []string // target machines: (hostname|ip)(:port)?
- Target_Dir string // directory to copy/run on target
- Target_Reboot bool // reboot target on repair
+ Targets []string `json:"targets"` // target machines: (hostname|ip)(:port)?
+ TargetDir string `json:"target_dir"` // directory to copy/run on target
+ TargetReboot bool `json:"target_reboot"` // reboot target on repair
}
type Pool struct {
@@ -52,7 +52,7 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
if len(cfg.Targets) == 0 {
return nil, fmt.Errorf("config param targets is empty")
}
- if cfg.Target_Dir == "" {
+ if cfg.TargetDir == "" {
return nil, fmt.Errorf("config param target_dir is empty")
}
for _, target := range cfg.Targets {
@@ -95,10 +95,10 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {
}
// Create working dir if doesn't exist.
- inst.ssh("mkdir -p '" + inst.cfg.Target_Dir + "'")
+ inst.ssh("mkdir -p '" + inst.cfg.TargetDir + "'")
// Remove temp files from previous runs.
- inst.ssh("rm -rf '" + filepath.Join(inst.cfg.Target_Dir, "*") + "'")
+ inst.ssh("rm -rf '" + filepath.Join(inst.cfg.TargetDir, "*") + "'")
closeInst = nil
return inst, nil
@@ -168,7 +168,7 @@ func (inst *instance) ssh(command string) error {
func (inst *instance) repair() error {
log.Logf(2, "isolated: trying to ssh")
if err := inst.waitForSSH(30 * 60); err == nil {
- if inst.cfg.Target_Reboot {
+ if inst.cfg.TargetReboot {
log.Logf(2, "isolated: trying to reboot")
inst.ssh("reboot") // reboot will return an error, ignore it
if err := inst.waitForReboot(5 * 60); err != nil {
@@ -233,7 +233,7 @@ func (inst *instance) Close() {
func (inst *instance) Copy(hostSrc string) (string, error) {
baseName := filepath.Base(hostSrc)
- vmDst := filepath.Join(inst.cfg.Target_Dir, baseName)
+ vmDst := filepath.Join(inst.cfg.TargetDir, baseName)
inst.ssh("pkill -9 '" + baseName + "'; rm -f '" + vmDst + "'")
args := append(inst.sshArgs("-P"), hostSrc, inst.target+":"+vmDst)
cmd := osutil.Command("scp", args...)
@@ -281,7 +281,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
proxy := fmt.Sprintf("%v:127.0.0.1:%v", inst.port, inst.port)
args = append(args, "-R", proxy)
}
- args = append(args, inst.target, "cd "+inst.cfg.Target_Dir+" && exec "+command)
+ args = append(args, inst.target, "cd "+inst.cfg.TargetDir+" && exec "+command)
log.Logf(0, "running command: ssh %#v", args)
if inst.debug {
log.Logf(0, "running command: ssh %#v", args)
diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go
index 07066a237..a745402f1 100644
--- a/vm/qemu/qemu.go
+++ b/vm/qemu/qemu.go
@@ -30,15 +30,15 @@ func init() {
}
type Config struct {
- Count int // number of VMs to use
- Qemu string // qemu binary name (qemu-system-arch by default)
- Qemu_Args string // additional command line arguments for qemu binary
- Kernel string // kernel for injected boot (e.g. arch/x86/boot/bzImage)
- Cmdline string // kernel command line (can only be specified with kernel)
- Initrd string // linux initial ramdisk. (optional)
- Image_Device string // qemu image device (hda by default)
- CPU int // number of VM CPUs
- Mem int // amount of VM memory in MBs
+ Count int `json:"count"` // number of VMs to use
+ Qemu string `json:"qemu"` // qemu binary name (qemu-system-arch by default)
+ QemuArgs string `json:"qemu_args"` // additional command line arguments for qemu binary
+ Kernel string `json:"kernel"` // kernel for injected boot (e.g. arch/x86/boot/bzImage)
+ Cmdline string `json:"cmdline"` // kernel command line (can only be specified with kernel)
+ Initrd string `json:"initrd"` // linux initial ramdisk. (optional)
+ ImageDevice string `json:"image_device"` // qemu image device (hda by default)
+ CPU int `json:"cpu"` // number of VM CPUs
+ Mem int `json:"mem"` // amount of VM memory in MBs
}
type Pool struct {
@@ -101,10 +101,10 @@ var archConfigs = map[string]archConfig{
func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
archConfig := archConfigs[env.OS+"/"+env.Arch]
cfg := &Config{
- Count: 1,
- Image_Device: "hda",
- Qemu: archConfig.Qemu,
- Qemu_Args: archConfig.QemuArgs,
+ Count: 1,
+ ImageDevice: "hda",
+ Qemu: archConfig.Qemu,
+ QemuArgs: archConfig.QemuArgs,
}
if err := config.LoadData(env.Config, cfg); err != nil {
return nil, fmt.Errorf("failed to parse qemu vm config: %v", err)
@@ -244,7 +244,7 @@ func (inst *instance) Boot() error {
"-serial", "stdio",
"-no-reboot",
}
- args = append(args, strings.Split(inst.cfg.Qemu_Args, " ")...)
+ args = append(args, strings.Split(inst.cfg.QemuArgs, " ")...)
if inst.image == "9p" {
args = append(args,
"-fsdev", "local,id=fsdev0,path=/,security_model=none,readonly",
@@ -252,7 +252,7 @@ func (inst *instance) Boot() error {
)
} else {
args = append(args,
- "-"+inst.cfg.Image_Device, inst.image,
+ "-"+inst.cfg.ImageDevice, inst.image,
"-snapshot",
)
}
diff --git a/vm/vmimpl/console.go b/vm/vmimpl/console.go
index 07c9b9d27..cd47a43bc 100644
--- a/vm/vmimpl/console.go
+++ b/vm/vmimpl/console.go
@@ -27,12 +27,12 @@ func OpenConsole(con string) (rc io.ReadCloser, err error) {
}
}()
var term unix.Termios
- _, _, errno := syscall.Syscall(unix.SYS_IOCTL, uintptr(fd), syscall_TCGETS, uintptr(unsafe.Pointer(&term)))
+ _, _, errno := syscall.Syscall(unix.SYS_IOCTL, uintptr(fd), syscallTCGETS, uintptr(unsafe.Pointer(&term)))
if errno != 0 {
return nil, fmt.Errorf("failed to get console termios: %v", errno)
}
// no parity bit, only need 1 stop bit, no hardware flowcontrol
- term.Cflag &^= unix_CBAUD | unix.CSIZE | unix.PARENB | unix.CSTOPB | unix_CRTSCTS
+ term.Cflag &^= unixCBAUD | unix.CSIZE | unix.PARENB | unix.CSTOPB | unixCRTSCTS
// ignore modem controls
term.Cflag |= unix.B115200 | unix.CS8 | unix.CLOCAL | unix.CREAD
// setup for non-canonical mode
@@ -42,7 +42,7 @@ func OpenConsole(con string) (rc io.ReadCloser, err error) {
term.Oflag &^= unix.OPOST
term.Cc[unix.VMIN] = 0
term.Cc[unix.VTIME] = 10 // 1 second timeout
- _, _, errno = syscall.Syscall(unix.SYS_IOCTL, uintptr(fd), syscall_TCSETS, uintptr(unsafe.Pointer(&term)))
+ _, _, errno = syscall.Syscall(unix.SYS_IOCTL, uintptr(fd), syscallTCSETS, uintptr(unsafe.Pointer(&term)))
if errno != 0 {
return nil, fmt.Errorf("failed to get console termios: %v", errno)
}
diff --git a/vm/vmimpl/console_darwin.go b/vm/vmimpl/console_darwin.go
index 15909ae57..1de3380c0 100644
--- a/vm/vmimpl/console_darwin.go
+++ b/vm/vmimpl/console_darwin.go
@@ -6,8 +6,8 @@ package vmimpl
import "syscall"
const (
- unix_CBAUD = 0
- unix_CRTSCTS = 0
- syscall_TCGETS = syscall.TIOCGETA
- syscall_TCSETS = syscall.TIOCSETA
+ unixCBAUD = 0
+ unixCRTSCTS = 0
+ syscallTCGETS = syscall.TIOCGETA
+ syscallTCSETS = syscall.TIOCSETA
)
diff --git a/vm/vmimpl/console_freebsd.go b/vm/vmimpl/console_freebsd.go
index 1bc79c439..9f4455ed5 100644
--- a/vm/vmimpl/console_freebsd.go
+++ b/vm/vmimpl/console_freebsd.go
@@ -5,8 +5,8 @@ package vmimpl
// Merely to fix build.
const (
- unix_CBAUD = 0
- unix_CRTSCTS = 0
- syscall_TCGETS = 0
- syscall_TCSETS = 0
+ unixCBAUD = 0
+ unixCRTSCTS = 0
+ syscallTCGETS = 0
+ syscallTCSETS = 0
)
diff --git a/vm/vmimpl/console_linux_386.go b/vm/vmimpl/console_linux_386.go
index 2f7cad8e6..c2743088b 100644
--- a/vm/vmimpl/console_linux_386.go
+++ b/vm/vmimpl/console_linux_386.go
@@ -9,8 +9,8 @@ import (
// Builds but is not tested.
const (
- unix_CBAUD = unix.CBAUD
- unix_CRTSCTS = unix.CRTSCTS
- syscall_TCGETS = unix.TCGETS2
- syscall_TCSETS = unix.TCSETS2
+ unixCBAUD = unix.CBAUD
+ unixCRTSCTS = unix.CRTSCTS
+ syscallTCGETS = unix.TCGETS2
+ syscallTCSETS = unix.TCSETS2
)
diff --git a/vm/vmimpl/console_linux_amd64.go b/vm/vmimpl/console_linux_amd64.go
index 6eeb2b258..4b6c11703 100644
--- a/vm/vmimpl/console_linux_amd64.go
+++ b/vm/vmimpl/console_linux_amd64.go
@@ -8,8 +8,8 @@ import (
)
const (
- unix_CBAUD = unix.CBAUD
- unix_CRTSCTS = unix.CRTSCTS
- syscall_TCGETS = unix.TCGETS2
- syscall_TCSETS = unix.TCSETS2
+ unixCBAUD = unix.CBAUD
+ unixCRTSCTS = unix.CRTSCTS
+ syscallTCGETS = unix.TCGETS2
+ syscallTCSETS = unix.TCSETS2
)
diff --git a/vm/vmimpl/console_linux_arm.go b/vm/vmimpl/console_linux_arm.go
index f10edf002..35944a761 100644
--- a/vm/vmimpl/console_linux_arm.go
+++ b/vm/vmimpl/console_linux_arm.go
@@ -9,8 +9,8 @@ import (
// This compiles, but wan't tested.
const (
- unix_CBAUD = unix.CBAUD
- unix_CRTSCTS = unix.CRTSCTS
- syscall_TCGETS = unix.TCGETS2
- syscall_TCSETS = unix.TCSETS2
+ unixCBAUD = unix.CBAUD
+ unixCRTSCTS = unix.CRTSCTS
+ syscallTCGETS = unix.TCGETS2
+ syscallTCSETS = unix.TCSETS2
)
diff --git a/vm/vmimpl/console_linux_arm64.go b/vm/vmimpl/console_linux_arm64.go
index f10edf002..35944a761 100644
--- a/vm/vmimpl/console_linux_arm64.go
+++ b/vm/vmimpl/console_linux_arm64.go
@@ -9,8 +9,8 @@ import (
// This compiles, but wan't tested.
const (
- unix_CBAUD = unix.CBAUD
- unix_CRTSCTS = unix.CRTSCTS
- syscall_TCGETS = unix.TCGETS2
- syscall_TCSETS = unix.TCSETS2
+ unixCBAUD = unix.CBAUD
+ unixCRTSCTS = unix.CRTSCTS
+ syscallTCGETS = unix.TCGETS2
+ syscallTCSETS = unix.TCSETS2
)
diff --git a/vm/vmimpl/console_linux_ppc64le.go b/vm/vmimpl/console_linux_ppc64le.go
index a7374c0e5..62e2c7709 100644
--- a/vm/vmimpl/console_linux_ppc64le.go
+++ b/vm/vmimpl/console_linux_ppc64le.go
@@ -6,8 +6,8 @@ package vmimpl
// Just to make the code compile.
// linux_ppc64le as host with adb VMs is not tested.
const (
- unix_CBAUD = 0
- unix_CRTSCTS = 0
- syscall_TCGETS = 0
- syscall_TCSETS = 0
+ unixCBAUD = 0
+ unixCRTSCTS = 0
+ syscallTCGETS = 0
+ syscallTCSETS = 0
)
diff --git a/vm/vmimpl/console_netbsd.go b/vm/vmimpl/console_netbsd.go
index dc332833d..d7e3487c4 100644
--- a/vm/vmimpl/console_netbsd.go
+++ b/vm/vmimpl/console_netbsd.go
@@ -5,8 +5,8 @@ package vmimpl
// Merely to fix build.
const (
- unix_CBAUD = 0
- unix_CRTSCTS = 0
- syscall_TCGETS = 0
- syscall_TCSETS = 0
+ unixCBAUD = 0
+ unixCRTSCTS = 0
+ syscallTCGETS = 0
+ syscallTCSETS = 0
)