diff options
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/mgrconfig/config.go | 2 | ||||
| -rw-r--r-- | pkg/mgrconfig/load.go | 28 | ||||
| -rw-r--r-- | pkg/rpctype/rpctype.go | 1 |
3 files changed, 29 insertions, 2 deletions
diff --git a/pkg/mgrconfig/config.go b/pkg/mgrconfig/config.go index 9073c482c..46270ab0c 100644 --- a/pkg/mgrconfig/config.go +++ b/pkg/mgrconfig/config.go @@ -166,6 +166,8 @@ type Config struct { EnabledSyscalls []string `json:"enable_syscalls,omitempty"` // List of system calls that should be treated as disabled (optional). DisabledSyscalls []string `json:"disable_syscalls,omitempty"` + // List of syscalls that should not be mutated by the fuzzer (optional). + NoMutateSyscalls []string `json:"no_mutate_syscalls,omitempty"` // List of regexps for known bugs. // Don't save reports matching these regexps, but reboot VM after them, // matched against whole report output. diff --git a/pkg/mgrconfig/load.go b/pkg/mgrconfig/load.go index 2b49d0cbd..f1063ed17 100644 --- a/pkg/mgrconfig/load.go +++ b/pkg/mgrconfig/load.go @@ -34,8 +34,9 @@ type Derived struct { ExecprogBin string ExecutorBin string - Syscalls []int - Timeouts targets.Timeouts + Syscalls []int + NoMutateCalls map[int]bool // Set of IDs of syscalls which should not be mutated. + Timeouts targets.Timeouts } func LoadData(data []byte) (*Config, error) { @@ -177,6 +178,10 @@ func Complete(cfg *Config) error { if err != nil { return err } + cfg.NoMutateCalls, err = ParseNoMutateSyscalls(cfg.Target, cfg.NoMutateSyscalls) + if err != nil { + return err + } cfg.initTimeouts() return nil } @@ -329,6 +334,25 @@ func ParseEnabledSyscalls(target *prog.Target, enabled, disabled []string) ([]in return arr, nil } +func ParseNoMutateSyscalls(target *prog.Target, syscalls []string) (map[int]bool, error) { + var result = make(map[int]bool) + + for _, c := range syscalls { + n := 0 + for _, call := range target.Syscalls { + if MatchSyscall(call.Name, c) { + result[call.ID] = true + n++ + } + } + if n == 0 { + return nil, fmt.Errorf("unknown no_mutate syscall: %v", c) + } + } + + return result, nil +} + func MatchSyscall(name, pattern string) bool { if pattern == name || strings.HasPrefix(name, pattern+"$") { return true diff --git a/pkg/rpctype/rpctype.go b/pkg/rpctype/rpctype.go index f1d889a20..fc582e576 100644 --- a/pkg/rpctype/rpctype.go +++ b/pkg/rpctype/rpctype.go @@ -41,6 +41,7 @@ type ConnectArgs struct { type ConnectRes struct { EnabledCalls []int + NoMutateCalls map[int]bool GitRevision string TargetRevision string AllSandboxes bool |
