mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-24 03:49:45 +00:00
pkg/csource: fix lint warnings
CI failed: https://travis-ci.org/google/syzkaller/jobs/606730911?utm_medium=notification&utm_source=github_status
This commit is contained in:
parent
d40d75d2d7
commit
2079602763
@ -175,8 +175,6 @@ func DefaultOpts(cfg *mgrconfig.Config) Options {
|
||||
if cfg.Sandbox == "" || cfg.Sandbox == "setuid" {
|
||||
opts.EnableNetReset = false
|
||||
}
|
||||
if err := opts.Check(cfg.TargetOS); err != nil {
|
||||
}
|
||||
if cfg.Sandbox == "" || cfg.Sandbox == "setuid" {
|
||||
opts.EnableNetReset = false
|
||||
}
|
||||
|
@ -213,31 +213,85 @@ func TestParseFeaturesFlags(t *testing.T) {
|
||||
Features map[string]bool
|
||||
}{
|
||||
{"none", "none", true, map[string]bool{
|
||||
"tun": true, "net_dev": true, "net_reset": true, "cgroups": true, "binfmt_misc": true, "close_fds": true, "devlink_pci": true,
|
||||
"tun": true,
|
||||
"net_dev": true,
|
||||
"net_reset": true,
|
||||
"cgroups": true,
|
||||
"binfmt_misc": true,
|
||||
"close_fds": true,
|
||||
"devlink_pci": true,
|
||||
}},
|
||||
{"none", "none", false, map[string]bool{
|
||||
"tun": false, "net_dev": false, "net_reset": false, "cgroups": false, "binfmt_misc": false, "close_fds": false, "devlink_pci": false,
|
||||
"tun": false,
|
||||
"net_dev": false,
|
||||
"net_reset": false,
|
||||
"cgroups": false,
|
||||
"binfmt_misc": false,
|
||||
"close_fds": false,
|
||||
"devlink_pci": false,
|
||||
}},
|
||||
{"all", "none", true, map[string]bool{
|
||||
"tun": true, "net_dev": true, "net_reset": true, "cgroups": true, "binfmt_misc": true, "close_fds": true, "devlink_pci": true,
|
||||
"tun": true,
|
||||
"net_dev": true,
|
||||
"net_reset": true,
|
||||
"cgroups": true,
|
||||
"binfmt_misc": true,
|
||||
"close_fds": true,
|
||||
"devlink_pci": true,
|
||||
}},
|
||||
{"", "none", true, map[string]bool{
|
||||
"tun": false, "net_dev": false, "net_reset": false, "cgroups": false, "binfmt_misc": false, "close_fds": false, "devlink_pci": false,
|
||||
"tun": false,
|
||||
"net_dev": false,
|
||||
"net_reset": false,
|
||||
"cgroups": false,
|
||||
"binfmt_misc": false,
|
||||
"close_fds": false,
|
||||
"devlink_pci": false,
|
||||
}},
|
||||
{"none", "all", true, map[string]bool{
|
||||
"tun": false, "net_dev": false, "net_reset": false, "cgroups": false, "binfmt_misc": false, "close_fds": false, "devlink_pci": false,
|
||||
"tun": false,
|
||||
"net_dev": false,
|
||||
"net_reset": false,
|
||||
"cgroups": false,
|
||||
"binfmt_misc": false,
|
||||
"close_fds": false,
|
||||
"devlink_pci": false,
|
||||
}},
|
||||
{"none", "", true, map[string]bool{
|
||||
"tun": true, "net_dev": true, "net_reset": true, "cgroups": true, "binfmt_misc": true, "close_fds": true, "devlink_pci": true,
|
||||
"tun": true,
|
||||
"net_dev": true,
|
||||
"net_reset": true,
|
||||
"cgroups": true,
|
||||
"binfmt_misc": true,
|
||||
"close_fds": true,
|
||||
"devlink_pci": true,
|
||||
}},
|
||||
{"tun,net_dev", "none", true, map[string]bool{
|
||||
"tun": true, "net_dev": true, "net_reset": false, "cgroups": false, "binfmt_misc": false, "close_fds": false, "devlink_pci": false,
|
||||
"tun": true,
|
||||
"net_dev": true,
|
||||
"net_reset": false,
|
||||
"cgroups": false,
|
||||
"binfmt_misc": false,
|
||||
"close_fds": false,
|
||||
"devlink_pci": false,
|
||||
}},
|
||||
{"none", "cgroups,net_dev", true, map[string]bool{
|
||||
"tun": true, "net_dev": false, "net_reset": true, "cgroups": false, "binfmt_misc": true, "close_fds": true, "devlink_pci": true,
|
||||
"tun": true,
|
||||
"net_dev": false,
|
||||
"net_reset": true,
|
||||
"cgroups": false,
|
||||
"binfmt_misc": true,
|
||||
"close_fds": true,
|
||||
"devlink_pci": true,
|
||||
}},
|
||||
{"close_fds", "none", true, map[string]bool{
|
||||
"tun": false, "net_dev": false, "net_reset": false, "cgroups": false, "binfmt_misc": false, "close_fds": true, "devlink_pci": false,
|
||||
"tun": false,
|
||||
"net_dev": false,
|
||||
"net_reset": false,
|
||||
"cgroups": false,
|
||||
"binfmt_misc": false,
|
||||
"close_fds": true,
|
||||
"devlink_pci": false,
|
||||
}},
|
||||
}
|
||||
for i, test := range tests {
|
||||
|
@ -79,28 +79,10 @@ func main() {
|
||||
prios := target.CalculatePriorities(corpus)
|
||||
ct := target.BuildChoiceTable(prios, calls)
|
||||
|
||||
config, execOpts, err := ipcconfig.Default(target)
|
||||
config, execOpts, err := createIPCConfig(target, features, featuresFlags)
|
||||
if err != nil {
|
||||
log.Fatalf("%v", err)
|
||||
}
|
||||
if featuresFlags["tun"].Enabled && features[host.FeatureNetworkInjection].Enabled {
|
||||
config.Flags |= ipc.FlagEnableTun
|
||||
}
|
||||
if featuresFlags["net_dev"].Enabled && features[host.FeatureNetworkDevices].Enabled {
|
||||
config.Flags |= ipc.FlagEnableNetDev
|
||||
}
|
||||
if featuresFlags["net_reset"].Enabled {
|
||||
config.Flags |= ipc.FlagEnableNetReset
|
||||
}
|
||||
if featuresFlags["cgroups"].Enabled {
|
||||
config.Flags |= ipc.FlagEnableCgroups
|
||||
}
|
||||
if featuresFlags["close_fds"].Enabled {
|
||||
config.Flags |= ipc.FlagEnableCloseFds
|
||||
}
|
||||
if featuresFlags["devlink_pci"].Enabled && features[host.FeatureDevlinkPCI].Enabled {
|
||||
config.Flags |= ipc.FlagEnableDevlinkPCI
|
||||
}
|
||||
if err = host.Setup(target, features, featuresFlags, config.Executor); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
@ -159,6 +141,33 @@ func execute(pid int, env *ipc.Env, execOpts *ipc.ExecOpts, p *prog.Prog) {
|
||||
}
|
||||
}
|
||||
|
||||
func createIPCConfig(target *prog.Target, features *host.Features, featuresFlags csource.Features) (
|
||||
*ipc.Config, *ipc.ExecOpts, error) {
|
||||
config, execOpts, err := ipcconfig.Default(target)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
if featuresFlags["tun"].Enabled && features[host.FeatureNetworkInjection].Enabled {
|
||||
config.Flags |= ipc.FlagEnableTun
|
||||
}
|
||||
if featuresFlags["net_dev"].Enabled && features[host.FeatureNetworkDevices].Enabled {
|
||||
config.Flags |= ipc.FlagEnableNetDev
|
||||
}
|
||||
if featuresFlags["net_reset"].Enabled {
|
||||
config.Flags |= ipc.FlagEnableNetReset
|
||||
}
|
||||
if featuresFlags["cgroups"].Enabled {
|
||||
config.Flags |= ipc.FlagEnableCgroups
|
||||
}
|
||||
if featuresFlags["close_fds"].Enabled {
|
||||
config.Flags |= ipc.FlagEnableCloseFds
|
||||
}
|
||||
if featuresFlags["devlink_pci"].Enabled && features[host.FeatureDevlinkPCI].Enabled {
|
||||
config.Flags |= ipc.FlagEnableDevlinkPCI
|
||||
}
|
||||
return config, execOpts, nil
|
||||
}
|
||||
|
||||
func buildCallList(target *prog.Target, enabled []string) map[*prog.Syscall]bool {
|
||||
if *flagOS != runtime.GOOS {
|
||||
// This is currently used on akaros, where syz-stress runs on host.
|
||||
|
Loading…
Reference in New Issue
Block a user