mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-23 11:29:46 +00:00
pkg/csource: rename some options
Rename some options in preparation for subsequent changes which will align names across the code base.
This commit is contained in:
parent
690740b4a4
commit
157653cfe7
@ -104,14 +104,14 @@ func commonDefines(p *prog.Prog, opts Options) map[string]bool {
|
||||
"SYZ_MULTI_PROC": opts.Procs > 1,
|
||||
"SYZ_FAULT": opts.Fault,
|
||||
"SYZ_LEAK": opts.Leak,
|
||||
"SYZ_NET_INJECTION": opts.EnableTun,
|
||||
"SYZ_NET_DEVICES": opts.EnableNetDev,
|
||||
"SYZ_NET_RESET": opts.EnableNetReset,
|
||||
"SYZ_CGROUPS": opts.EnableCgroups,
|
||||
"SYZ_BINFMT_MISC": opts.EnableBinfmtMisc,
|
||||
"SYZ_CLOSE_FDS": opts.EnableCloseFds,
|
||||
"SYZ_KCSAN": opts.EnableKCSAN,
|
||||
"SYZ_DEVLINK_PCI": opts.EnableDevlinkPCI,
|
||||
"SYZ_NET_INJECTION": opts.NetInjection,
|
||||
"SYZ_NET_DEVICES": opts.NetDevices,
|
||||
"SYZ_NET_RESET": opts.NetReset,
|
||||
"SYZ_CGROUPS": opts.Cgroups,
|
||||
"SYZ_BINFMT_MISC": opts.BinfmtMisc,
|
||||
"SYZ_CLOSE_FDS": opts.CloseFDs,
|
||||
"SYZ_KCSAN": opts.KCSAN,
|
||||
"SYZ_DEVLINK_PCI": opts.DevlinkPCI,
|
||||
"SYZ_USE_TMP_DIR": opts.UseTmpDir,
|
||||
"SYZ_HANDLE_SEGV": opts.HandleSegv,
|
||||
"SYZ_REPRO": opts.Repro,
|
||||
|
@ -196,7 +196,7 @@ func (ctx *context) generateCalls(p prog.ExecProg, trace bool) ([]string, []uint
|
||||
callName := call.Meta.CallName
|
||||
resCopyout := call.Index != prog.ExecNoCopyout
|
||||
argCopyout := len(call.Copyout) != 0
|
||||
emitCall := ctx.opts.EnableTun ||
|
||||
emitCall := ctx.opts.NetInjection ||
|
||||
callName != "syz_emit_ethernet" &&
|
||||
callName != "syz_extract_tcp_res"
|
||||
// TODO: if we don't emit the call we must also not emit copyin, copyout and fault injection.
|
||||
|
@ -31,14 +31,14 @@ type Options struct {
|
||||
Leak bool `json:"leak,omitempty"` // do leak checking
|
||||
|
||||
// These options allow for a more fine-tuned control over the generated C code.
|
||||
EnableTun bool `json:"tun,omitempty"`
|
||||
EnableNetDev bool `json:"netdev,omitempty"`
|
||||
EnableNetReset bool `json:"resetnet,omitempty"`
|
||||
EnableCgroups bool `json:"cgroups,omitempty"`
|
||||
EnableBinfmtMisc bool `json:"binfmt_misc,omitempty"`
|
||||
EnableCloseFds bool `json:"close_fds"`
|
||||
EnableKCSAN bool `json:"kcsan,omitempty"`
|
||||
EnableDevlinkPCI bool `json:"devlinkpci,omitempty"`
|
||||
NetInjection bool `json:"tun,omitempty"`
|
||||
NetDevices bool `json:"netdev,omitempty"`
|
||||
NetReset bool `json:"resetnet,omitempty"`
|
||||
Cgroups bool `json:"cgroups,omitempty"`
|
||||
BinfmtMisc bool `json:"binfmt_misc,omitempty"`
|
||||
CloseFDs bool `json:"close_fds"`
|
||||
KCSAN bool `json:"kcsan,omitempty"`
|
||||
DevlinkPCI bool `json:"devlinkpci,omitempty"`
|
||||
|
||||
UseTmpDir bool `json:"tmpdir,omitempty"`
|
||||
HandleSegv bool `json:"segv,omitempty"`
|
||||
@ -67,25 +67,25 @@ func (opts Options) Check(OS string) error {
|
||||
// This does not affect generated code.
|
||||
return errors.New("option Procs>1 without Repeat")
|
||||
}
|
||||
if opts.EnableNetReset {
|
||||
return errors.New("option EnableNetReset without Repeat")
|
||||
if opts.NetReset {
|
||||
return errors.New("option NetReset without Repeat")
|
||||
}
|
||||
if opts.RepeatTimes > 1 {
|
||||
return errors.New("option RepeatTimes without Repeat")
|
||||
}
|
||||
}
|
||||
if opts.Sandbox == "" {
|
||||
if opts.EnableTun {
|
||||
return errors.New("option EnableTun without sandbox")
|
||||
if opts.NetInjection {
|
||||
return errors.New("option NetInjection without sandbox")
|
||||
}
|
||||
if opts.EnableNetDev {
|
||||
return errors.New("option EnableNetDev without sandbox")
|
||||
if opts.NetDevices {
|
||||
return errors.New("option NetDevices without sandbox")
|
||||
}
|
||||
if opts.EnableCgroups {
|
||||
return errors.New("option EnableCgroups without sandbox")
|
||||
if opts.Cgroups {
|
||||
return errors.New("option Cgroups without sandbox")
|
||||
}
|
||||
if opts.EnableBinfmtMisc {
|
||||
return errors.New("option EnableBinfmtMisc without sandbox")
|
||||
if opts.BinfmtMisc {
|
||||
return errors.New("option BinfmtMisc without sandbox")
|
||||
}
|
||||
}
|
||||
if opts.Sandbox == sandboxNamespace && !opts.UseTmpDir {
|
||||
@ -94,11 +94,11 @@ func (opts Options) Check(OS string) error {
|
||||
// which will fail if procs>1 and on second run of the program.
|
||||
return errors.New("option Sandbox=namespace without UseTmpDir")
|
||||
}
|
||||
if opts.EnableNetReset && (opts.Sandbox == "" || opts.Sandbox == sandboxSetuid) {
|
||||
return errors.New("option EnableNetReset without sandbox")
|
||||
if opts.NetReset && (opts.Sandbox == "" || opts.Sandbox == sandboxSetuid) {
|
||||
return errors.New("option NetReset without sandbox")
|
||||
}
|
||||
if opts.EnableCgroups && !opts.UseTmpDir {
|
||||
return errors.New("option EnableCgroups without UseTmpDir")
|
||||
if opts.Cgroups && !opts.UseTmpDir {
|
||||
return errors.New("option Cgroups without UseTmpDir")
|
||||
}
|
||||
return opts.checkLinuxOnly(OS)
|
||||
}
|
||||
@ -107,29 +107,29 @@ func (opts Options) checkLinuxOnly(OS string) error {
|
||||
if OS == linux {
|
||||
return nil
|
||||
}
|
||||
if opts.EnableTun && !(OS == openbsd || OS == freebsd || OS == netbsd) {
|
||||
return fmt.Errorf("option EnableTun is not supported on %v", OS)
|
||||
if opts.NetInjection && !(OS == openbsd || OS == freebsd || OS == netbsd) {
|
||||
return fmt.Errorf("option NetInjection is not supported on %v", OS)
|
||||
}
|
||||
if opts.EnableNetDev {
|
||||
return fmt.Errorf("option EnableNetDev is not supported on %v", OS)
|
||||
if opts.NetDevices {
|
||||
return fmt.Errorf("option NetDevices is not supported on %v", OS)
|
||||
}
|
||||
if opts.EnableNetReset {
|
||||
return fmt.Errorf("option EnableNetReset is not supported on %v", OS)
|
||||
if opts.NetReset {
|
||||
return fmt.Errorf("option NetReset is not supported on %v", OS)
|
||||
}
|
||||
if opts.EnableCgroups {
|
||||
return fmt.Errorf("option EnableCgroups is not supported on %v", OS)
|
||||
if opts.Cgroups {
|
||||
return fmt.Errorf("option Cgroups is not supported on %v", OS)
|
||||
}
|
||||
if opts.EnableBinfmtMisc {
|
||||
return fmt.Errorf("option EnableBinfmtMisc is not supported on %v", OS)
|
||||
if opts.BinfmtMisc {
|
||||
return fmt.Errorf("option BinfmtMisc is not supported on %v", OS)
|
||||
}
|
||||
if opts.EnableCloseFds {
|
||||
return fmt.Errorf("option EnableCloseFds is not supported on %v", OS)
|
||||
if opts.CloseFDs {
|
||||
return fmt.Errorf("option CloseFDs is not supported on %v", OS)
|
||||
}
|
||||
if opts.EnableKCSAN {
|
||||
return fmt.Errorf("option EnableKCSAN is not supported on %v", OS)
|
||||
if opts.KCSAN {
|
||||
return fmt.Errorf("option KCSAN is not supported on %v", OS)
|
||||
}
|
||||
if opts.EnableDevlinkPCI {
|
||||
return fmt.Errorf("option EnableDevlinkPCI is not supported on %v", OS)
|
||||
if opts.DevlinkPCI {
|
||||
return fmt.Errorf("option DevlinkPCI is not supported on %v", OS)
|
||||
}
|
||||
if opts.Sandbox == sandboxNamespace ||
|
||||
(opts.Sandbox == sandboxSetuid && !(OS == openbsd || OS == freebsd || OS == netbsd)) ||
|
||||
@ -147,33 +147,33 @@ func (opts Options) checkLinuxOnly(OS string) error {
|
||||
|
||||
func DefaultOpts(cfg *mgrconfig.Config) Options {
|
||||
opts := Options{
|
||||
Threaded: true,
|
||||
Collide: true,
|
||||
Repeat: true,
|
||||
Procs: cfg.Procs,
|
||||
Sandbox: cfg.Sandbox,
|
||||
EnableTun: true,
|
||||
EnableNetDev: true,
|
||||
EnableNetReset: true,
|
||||
EnableCgroups: true,
|
||||
EnableBinfmtMisc: true,
|
||||
EnableCloseFds: true,
|
||||
EnableDevlinkPCI: true,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Repro: true,
|
||||
Threaded: true,
|
||||
Collide: true,
|
||||
Repeat: true,
|
||||
Procs: cfg.Procs,
|
||||
Sandbox: cfg.Sandbox,
|
||||
NetInjection: true,
|
||||
NetDevices: true,
|
||||
NetReset: true,
|
||||
Cgroups: true,
|
||||
BinfmtMisc: true,
|
||||
CloseFDs: true,
|
||||
DevlinkPCI: true,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Repro: true,
|
||||
}
|
||||
if cfg.TargetOS != linux {
|
||||
opts.EnableTun = false
|
||||
opts.EnableNetDev = false
|
||||
opts.EnableNetReset = false
|
||||
opts.EnableCgroups = false
|
||||
opts.EnableBinfmtMisc = false
|
||||
opts.EnableCloseFds = false
|
||||
opts.EnableDevlinkPCI = false
|
||||
opts.NetInjection = false
|
||||
opts.NetDevices = false
|
||||
opts.NetReset = false
|
||||
opts.Cgroups = false
|
||||
opts.BinfmtMisc = false
|
||||
opts.CloseFDs = false
|
||||
opts.DevlinkPCI = false
|
||||
}
|
||||
if cfg.Sandbox == "" || cfg.Sandbox == "setuid" {
|
||||
opts.EnableNetReset = false
|
||||
opts.NetReset = false
|
||||
}
|
||||
if err := opts.Check(cfg.TargetOS); err != nil {
|
||||
panic(fmt.Sprintf("DefaultOpts created bad opts: %v", err))
|
||||
@ -191,9 +191,8 @@ func (opts Options) Serialize() []byte {
|
||||
|
||||
func DeserializeOptions(data []byte) (Options, error) {
|
||||
var opts Options
|
||||
// Before EnableCloseFds was added, close_fds() was always called,
|
||||
// so default to true.
|
||||
opts.EnableCloseFds = true
|
||||
// Before CloseFDs was added, close_fds() was always called, so default to true.
|
||||
opts.CloseFDs = true
|
||||
if err := json.Unmarshal(data, &opts); err == nil {
|
||||
return opts, nil
|
||||
}
|
||||
@ -205,7 +204,7 @@ func DeserializeOptions(data []byte) (Options, error) {
|
||||
" Fault:%t FaultCall:%d FaultNth:%d EnableTun:%t UseTmpDir:%t"+
|
||||
" HandleSegv:%t WaitRepeat:%t Debug:%t Repro:%t}",
|
||||
&opts.Threaded, &opts.Collide, &opts.Repeat, &opts.Procs, &opts.Sandbox,
|
||||
&opts.Fault, &opts.FaultCall, &opts.FaultNth, &opts.EnableTun, &opts.UseTmpDir,
|
||||
&opts.Fault, &opts.FaultCall, &opts.FaultNth, &opts.NetInjection, &opts.UseTmpDir,
|
||||
&opts.HandleSegv, &waitRepeat, &debug, &opts.Repro)
|
||||
if err == nil {
|
||||
if want := 14; n != want {
|
||||
@ -221,8 +220,8 @@ func DeserializeOptions(data []byte) (Options, error) {
|
||||
" Fault:%t FaultCall:%d FaultNth:%d EnableTun:%t UseTmpDir:%t"+
|
||||
" EnableCgroups:%t HandleSegv:%t WaitRepeat:%t Debug:%t Repro:%t}",
|
||||
&opts.Threaded, &opts.Collide, &opts.Repeat, &opts.Procs, &opts.Sandbox,
|
||||
&opts.Fault, &opts.FaultCall, &opts.FaultNth, &opts.EnableTun, &opts.UseTmpDir,
|
||||
&opts.EnableCgroups, &opts.HandleSegv, &waitRepeat, &debug, &opts.Repro)
|
||||
&opts.Fault, &opts.FaultCall, &opts.FaultNth, &opts.NetInjection, &opts.UseTmpDir,
|
||||
&opts.Cgroups, &opts.HandleSegv, &waitRepeat, &debug, &opts.Repro)
|
||||
if err == nil {
|
||||
if want := 15; n != want {
|
||||
return opts, fmt.Errorf("failed to parse repro options: got %v fields, want %v", n, want)
|
||||
|
@ -31,96 +31,96 @@ func TestParseOptionsCanned(t *testing.T) {
|
||||
"fault":true,"fault_call":1,"fault_nth":2,"tun":true,"tmpdir":true,"cgroups":true,
|
||||
"netdev":true,"resetnet":true,
|
||||
"segv":true,"waitrepeat":true,"debug":true,"repro":true}`: {
|
||||
Threaded: true,
|
||||
Collide: true,
|
||||
Repeat: true,
|
||||
Procs: 10,
|
||||
Sandbox: "namespace",
|
||||
Fault: true,
|
||||
FaultCall: 1,
|
||||
FaultNth: 2,
|
||||
EnableTun: true,
|
||||
EnableNetDev: true,
|
||||
EnableNetReset: true,
|
||||
EnableCgroups: true,
|
||||
EnableBinfmtMisc: false,
|
||||
EnableCloseFds: true,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Repro: true,
|
||||
Threaded: true,
|
||||
Collide: true,
|
||||
Repeat: true,
|
||||
Procs: 10,
|
||||
Sandbox: "namespace",
|
||||
Fault: true,
|
||||
FaultCall: 1,
|
||||
FaultNth: 2,
|
||||
NetInjection: true,
|
||||
NetDevices: true,
|
||||
NetReset: true,
|
||||
Cgroups: true,
|
||||
BinfmtMisc: false,
|
||||
CloseFDs: true,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Repro: true,
|
||||
},
|
||||
`{"threaded":true,"collide":true,"repeat":true,"procs":10,"sandbox":"android",
|
||||
"fault":true,"fault_call":1,"fault_nth":2,"tun":true,"tmpdir":true,"cgroups":true,
|
||||
"netdev":true,"resetnet":true,
|
||||
"segv":true,"waitrepeat":true,"debug":true,"repro":true}`: {
|
||||
Threaded: true,
|
||||
Collide: true,
|
||||
Repeat: true,
|
||||
Procs: 10,
|
||||
Sandbox: "android",
|
||||
Fault: true,
|
||||
FaultCall: 1,
|
||||
FaultNth: 2,
|
||||
EnableTun: true,
|
||||
EnableNetDev: true,
|
||||
EnableNetReset: true,
|
||||
EnableCgroups: true,
|
||||
EnableBinfmtMisc: false,
|
||||
EnableCloseFds: true,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Repro: true,
|
||||
Threaded: true,
|
||||
Collide: true,
|
||||
Repeat: true,
|
||||
Procs: 10,
|
||||
Sandbox: "android",
|
||||
Fault: true,
|
||||
FaultCall: 1,
|
||||
FaultNth: 2,
|
||||
NetInjection: true,
|
||||
NetDevices: true,
|
||||
NetReset: true,
|
||||
Cgroups: true,
|
||||
BinfmtMisc: false,
|
||||
CloseFDs: true,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Repro: true,
|
||||
},
|
||||
"{Threaded:true Collide:true Repeat:true Procs:1 Sandbox:none Fault:false FaultCall:-1 FaultNth:0 EnableTun:true UseTmpDir:true HandleSegv:true WaitRepeat:true Debug:false Repro:false}": {
|
||||
Threaded: true,
|
||||
Collide: true,
|
||||
Repeat: true,
|
||||
Procs: 1,
|
||||
Sandbox: "none",
|
||||
Fault: false,
|
||||
FaultCall: -1,
|
||||
FaultNth: 0,
|
||||
EnableTun: true,
|
||||
EnableCgroups: false,
|
||||
EnableBinfmtMisc: false,
|
||||
EnableCloseFds: true,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Repro: false,
|
||||
Threaded: true,
|
||||
Collide: true,
|
||||
Repeat: true,
|
||||
Procs: 1,
|
||||
Sandbox: "none",
|
||||
Fault: false,
|
||||
FaultCall: -1,
|
||||
FaultNth: 0,
|
||||
NetInjection: true,
|
||||
Cgroups: false,
|
||||
BinfmtMisc: false,
|
||||
CloseFDs: true,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Repro: false,
|
||||
},
|
||||
"{Threaded:true Collide:true Repeat:true Procs:1 Sandbox: Fault:false FaultCall:-1 FaultNth:0 EnableTun:true UseTmpDir:true HandleSegv:true WaitRepeat:true Debug:false Repro:false}": {
|
||||
Threaded: true,
|
||||
Collide: true,
|
||||
Repeat: true,
|
||||
Procs: 1,
|
||||
Sandbox: "",
|
||||
Fault: false,
|
||||
FaultCall: -1,
|
||||
FaultNth: 0,
|
||||
EnableTun: true,
|
||||
EnableCgroups: false,
|
||||
EnableBinfmtMisc: false,
|
||||
EnableCloseFds: true,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Repro: false,
|
||||
Threaded: true,
|
||||
Collide: true,
|
||||
Repeat: true,
|
||||
Procs: 1,
|
||||
Sandbox: "",
|
||||
Fault: false,
|
||||
FaultCall: -1,
|
||||
FaultNth: 0,
|
||||
NetInjection: true,
|
||||
Cgroups: false,
|
||||
BinfmtMisc: false,
|
||||
CloseFDs: true,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Repro: false,
|
||||
},
|
||||
"{Threaded:false Collide:true Repeat:true Procs:1 Sandbox:namespace Fault:false FaultCall:-1 FaultNth:0 EnableTun:true UseTmpDir:true EnableCgroups:true HandleSegv:true WaitRepeat:true Debug:false Repro:false}": {
|
||||
Threaded: false,
|
||||
Collide: true,
|
||||
Repeat: true,
|
||||
Procs: 1,
|
||||
Sandbox: "namespace",
|
||||
Fault: false,
|
||||
FaultCall: -1,
|
||||
FaultNth: 0,
|
||||
EnableTun: true,
|
||||
EnableCgroups: true,
|
||||
EnableBinfmtMisc: false,
|
||||
EnableCloseFds: true,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Repro: false,
|
||||
Threaded: false,
|
||||
Collide: true,
|
||||
Repeat: true,
|
||||
Procs: 1,
|
||||
Sandbox: "namespace",
|
||||
Fault: false,
|
||||
FaultCall: -1,
|
||||
FaultNth: 0,
|
||||
NetInjection: true,
|
||||
Cgroups: true,
|
||||
BinfmtMisc: false,
|
||||
CloseFDs: true,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Repro: false,
|
||||
},
|
||||
}
|
||||
for data, want := range canned {
|
||||
|
@ -801,8 +801,8 @@ var progSimplifies = []Simplify{
|
||||
return false
|
||||
}
|
||||
opts.Repeat = false
|
||||
opts.EnableCgroups = false
|
||||
opts.EnableNetReset = false
|
||||
opts.Cgroups = false
|
||||
opts.NetReset = false
|
||||
opts.Procs = 1
|
||||
return true
|
||||
},
|
||||
@ -828,60 +828,60 @@ var cSimplifies = append(progSimplifies, []Simplify{
|
||||
return false
|
||||
}
|
||||
opts.Sandbox = ""
|
||||
opts.EnableTun = false
|
||||
opts.EnableNetDev = false
|
||||
opts.EnableNetReset = false
|
||||
opts.EnableCgroups = false
|
||||
opts.EnableBinfmtMisc = false
|
||||
opts.EnableCloseFds = false
|
||||
opts.NetInjection = false
|
||||
opts.NetDevices = false
|
||||
opts.NetReset = false
|
||||
opts.Cgroups = false
|
||||
opts.BinfmtMisc = false
|
||||
opts.CloseFDs = false
|
||||
return true
|
||||
},
|
||||
func(opts *csource.Options) bool {
|
||||
if !opts.EnableTun {
|
||||
if !opts.NetInjection {
|
||||
return false
|
||||
}
|
||||
opts.EnableTun = false
|
||||
opts.NetInjection = false
|
||||
return true
|
||||
},
|
||||
func(opts *csource.Options) bool {
|
||||
if !opts.EnableNetDev {
|
||||
if !opts.NetDevices {
|
||||
return false
|
||||
}
|
||||
opts.EnableNetDev = false
|
||||
opts.NetDevices = false
|
||||
return true
|
||||
},
|
||||
func(opts *csource.Options) bool {
|
||||
if !opts.EnableNetReset {
|
||||
if !opts.NetReset {
|
||||
return false
|
||||
}
|
||||
opts.EnableNetReset = false
|
||||
opts.NetReset = false
|
||||
return true
|
||||
},
|
||||
func(opts *csource.Options) bool {
|
||||
if !opts.EnableCgroups {
|
||||
if !opts.Cgroups {
|
||||
return false
|
||||
}
|
||||
opts.EnableCgroups = false
|
||||
opts.Cgroups = false
|
||||
return true
|
||||
},
|
||||
func(opts *csource.Options) bool {
|
||||
if !opts.EnableBinfmtMisc {
|
||||
if !opts.BinfmtMisc {
|
||||
return false
|
||||
}
|
||||
opts.EnableBinfmtMisc = false
|
||||
opts.BinfmtMisc = false
|
||||
return true
|
||||
},
|
||||
func(opts *csource.Options) bool {
|
||||
// We don't want to remove close_fds() call when repeat is enabled,
|
||||
// since that can lead to deadlocks, see executor/common_linux.h.
|
||||
if !opts.EnableCloseFds || opts.Repeat {
|
||||
if !opts.CloseFDs || opts.Repeat {
|
||||
return false
|
||||
}
|
||||
opts.EnableCloseFds = false
|
||||
opts.CloseFDs = false
|
||||
return true
|
||||
},
|
||||
func(opts *csource.Options) bool {
|
||||
if !opts.UseTmpDir || opts.Sandbox == "namespace" || opts.EnableCgroups {
|
||||
if !opts.UseTmpDir || opts.Sandbox == "namespace" || opts.Cgroups {
|
||||
return false
|
||||
}
|
||||
opts.UseTmpDir = false
|
||||
|
@ -77,18 +77,18 @@ func TestBisect(t *testing.T) {
|
||||
|
||||
func TestSimplifies(t *testing.T) {
|
||||
opts := csource.Options{
|
||||
Threaded: true,
|
||||
Collide: true,
|
||||
Repeat: true,
|
||||
Procs: 10,
|
||||
Sandbox: "namespace",
|
||||
EnableTun: true,
|
||||
EnableNetDev: true,
|
||||
EnableNetReset: true,
|
||||
EnableCgroups: true,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Repro: true,
|
||||
Threaded: true,
|
||||
Collide: true,
|
||||
Repeat: true,
|
||||
Procs: 10,
|
||||
Sandbox: "namespace",
|
||||
NetInjection: true,
|
||||
NetDevices: true,
|
||||
NetReset: true,
|
||||
Cgroups: true,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Repro: true,
|
||||
}
|
||||
var check func(opts csource.Options, i int)
|
||||
check = func(opts csource.Options, i int) {
|
||||
|
@ -395,23 +395,23 @@ func (ctx *Context) createSyzTest(p *prog.Prog, sandbox string, threaded, cov bo
|
||||
|
||||
func (ctx *Context) createCTest(p *prog.Prog, sandbox string, threaded bool, times int) (*RunRequest, error) {
|
||||
opts := csource.Options{
|
||||
Threaded: threaded,
|
||||
Collide: false,
|
||||
Repeat: times > 1,
|
||||
RepeatTimes: times,
|
||||
Procs: 1,
|
||||
Sandbox: sandbox,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
EnableCgroups: p.Target.OS == "linux" && sandbox != "",
|
||||
Trace: true,
|
||||
Threaded: threaded,
|
||||
Collide: false,
|
||||
Repeat: times > 1,
|
||||
RepeatTimes: times,
|
||||
Procs: 1,
|
||||
Sandbox: sandbox,
|
||||
UseTmpDir: true,
|
||||
HandleSegv: true,
|
||||
Cgroups: p.Target.OS == "linux" && sandbox != "",
|
||||
Trace: true,
|
||||
}
|
||||
if sandbox != "" {
|
||||
if ctx.Features[host.FeatureNetworkInjection].Enabled {
|
||||
opts.EnableTun = true
|
||||
opts.NetInjection = true
|
||||
}
|
||||
if ctx.Features[host.FeatureNetworkDevices].Enabled {
|
||||
opts.EnableNetDev = true
|
||||
opts.NetDevices = true
|
||||
}
|
||||
}
|
||||
src, err := csource.Write(p, opts)
|
||||
|
@ -71,28 +71,28 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
opts := csource.Options{
|
||||
Threaded: *flagThreaded,
|
||||
Collide: *flagCollide,
|
||||
Repeat: *flagRepeat != 1,
|
||||
RepeatTimes: *flagRepeat,
|
||||
Procs: *flagProcs,
|
||||
Sandbox: *flagSandbox,
|
||||
Fault: *flagFaultCall >= 0,
|
||||
FaultCall: *flagFaultCall,
|
||||
FaultNth: *flagFaultNth,
|
||||
Leak: *flagLeak,
|
||||
EnableTun: features["tun"].Enabled,
|
||||
EnableNetDev: features["net_dev"].Enabled,
|
||||
EnableNetReset: features["net_reset"].Enabled,
|
||||
EnableCgroups: features["cgroups"].Enabled,
|
||||
EnableBinfmtMisc: features["binfmt_misc"].Enabled,
|
||||
EnableCloseFds: features["close_fds"].Enabled,
|
||||
EnableKCSAN: features["kcsan"].Enabled,
|
||||
EnableDevlinkPCI: features["devlink_pci"].Enabled,
|
||||
UseTmpDir: *flagUseTmpDir,
|
||||
HandleSegv: *flagHandleSegv,
|
||||
Repro: false,
|
||||
Trace: *flagTrace,
|
||||
Threaded: *flagThreaded,
|
||||
Collide: *flagCollide,
|
||||
Repeat: *flagRepeat != 1,
|
||||
RepeatTimes: *flagRepeat,
|
||||
Procs: *flagProcs,
|
||||
Sandbox: *flagSandbox,
|
||||
Fault: *flagFaultCall >= 0,
|
||||
FaultCall: *flagFaultCall,
|
||||
FaultNth: *flagFaultNth,
|
||||
Leak: *flagLeak,
|
||||
NetInjection: features["tun"].Enabled,
|
||||
NetDevices: features["net_dev"].Enabled,
|
||||
NetReset: features["net_reset"].Enabled,
|
||||
Cgroups: features["cgroups"].Enabled,
|
||||
BinfmtMisc: features["binfmt_misc"].Enabled,
|
||||
CloseFDs: features["close_fds"].Enabled,
|
||||
KCSAN: features["kcsan"].Enabled,
|
||||
DevlinkPCI: features["devlink_pci"].Enabled,
|
||||
UseTmpDir: *flagUseTmpDir,
|
||||
HandleSegv: *flagHandleSegv,
|
||||
Repro: false,
|
||||
Trace: *flagTrace,
|
||||
}
|
||||
src, err := csource.Write(p, opts)
|
||||
if err != nil {
|
||||
|
@ -150,7 +150,7 @@ func createProg2CArgs(bug *dashapi.LoadBugResp, opts csource.Options, file strin
|
||||
haveCgroupFlag := containsCommit("9753d3be5e6c79e271ed128795039f161ee339b7")
|
||||
haveWaitRepeatFlag := containsCommit("c99b02d2248fbdcd6f44037326b16c928f4423f1")
|
||||
haveWaitRepeatRemoved := containsCommit("9fe4bdc5f1037a409e82299f36117030114c7b94")
|
||||
haveCloseFds := containsCommit("5c51045d28eb1ad9465a51487d436133ce7b98d2")
|
||||
haveCloseFDs := containsCommit("5c51045d28eb1ad9465a51487d436133ce7b98d2")
|
||||
haveOSFlag := containsCommit("aa2533b98d21ebcad5777310215159127bfe3573")
|
||||
args := []string{
|
||||
"-prog", file,
|
||||
@ -188,19 +188,19 @@ func createProg2CArgs(bug *dashapi.LoadBugResp, opts csource.Options, file strin
|
||||
args = append(args, "-leak")
|
||||
}
|
||||
var enable, flags []string
|
||||
if opts.EnableTun {
|
||||
if opts.NetInjection {
|
||||
enable = append(enable, "tun")
|
||||
flags = append(flags, "-tun")
|
||||
}
|
||||
if opts.EnableNetDev {
|
||||
if opts.NetDevices {
|
||||
enable = append(enable, "net_dev")
|
||||
flags = append(flags, "-netdev")
|
||||
}
|
||||
if opts.EnableNetReset {
|
||||
if opts.NetReset {
|
||||
enable = append(enable, "net_reset")
|
||||
flags = append(flags, "-resetnet")
|
||||
}
|
||||
if opts.EnableCgroups {
|
||||
if opts.Cgroups {
|
||||
enable = append(enable, "cgroups")
|
||||
if haveCgroupFlag {
|
||||
flags = append(flags, "-cgroups")
|
||||
@ -209,13 +209,13 @@ func createProg2CArgs(bug *dashapi.LoadBugResp, opts csource.Options, file strin
|
||||
}
|
||||
}
|
||||
}
|
||||
if opts.EnableBinfmtMisc {
|
||||
if opts.BinfmtMisc {
|
||||
enable = append(enable, "binfmt_misc")
|
||||
}
|
||||
if opts.EnableCloseFds && haveCloseFds {
|
||||
if opts.CloseFDs && haveCloseFDs {
|
||||
enable = append(enable, "close_fds")
|
||||
}
|
||||
if opts.EnableDevlinkPCI {
|
||||
if opts.DevlinkPCI {
|
||||
enable = append(enable, "devlink_pci")
|
||||
flags = append(flags, "-devlinkpci")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user