aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ifuzz/ifuzz.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-11-20 19:28:53 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-11-21 08:46:20 +0100
commit418476ecb925e5d58ba9c22928a4e37dc30909df (patch)
tree702468b5ca1b0df89a83d861b18eaff9ae2237c5 /pkg/ifuzz/ifuzz.go
parente1dea42221c13dabdf9d4938428f1ef91863b813 (diff)
pkg/ifuzz/iset: rename ifuzzimpl to iset
ifuzzimpl is too lenghty and too clumsy on my taste (nm/vmimpl worked better b/c it's shorter and used less). I've tried to come up with something shorter and nicer. We could use "insn" as a common name for "instruction" in ifuzz, but it's a commonly used name already so would cause lots of conflicts. "iset" is somewhat descriptive, short and nice.
Diffstat (limited to 'pkg/ifuzz/ifuzz.go')
-rw-r--r--pkg/ifuzz/ifuzz.go34
1 files changed, 17 insertions, 17 deletions
diff --git a/pkg/ifuzz/ifuzz.go b/pkg/ifuzz/ifuzz.go
index 45082834d..01137b6ea 100644
--- a/pkg/ifuzz/ifuzz.go
+++ b/pkg/ifuzz/ifuzz.go
@@ -6,24 +6,24 @@ package ifuzz
import (
"math/rand"
- "github.com/google/syzkaller/pkg/ifuzz/ifuzzimpl"
+ "github.com/google/syzkaller/pkg/ifuzz/iset"
_ "github.com/google/syzkaller/pkg/ifuzz/powerpc/generated" // pull in generated instruction descriptions
_ "github.com/google/syzkaller/pkg/ifuzz/x86/generated" // pull in generated instruction descriptions
)
type (
- Config = ifuzzimpl.Config
- MemRegion = ifuzzimpl.MemRegion
- Mode = ifuzzimpl.Mode
+ Config = iset.Config
+ MemRegion = iset.MemRegion
+ Mode = iset.Mode
)
const (
- ArchX86 = ifuzzimpl.ArchX86
- ArchPowerPC = ifuzzimpl.ArchPowerPC
- ModeLong64 = ifuzzimpl.ModeLong64
- ModeProt32 = ifuzzimpl.ModeProt32
- ModeProt16 = ifuzzimpl.ModeProt16
- ModeReal16 = ifuzzimpl.ModeReal16
+ ArchX86 = iset.ArchX86
+ ArchPowerPC = iset.ArchPowerPC
+ ModeLong64 = iset.ModeLong64
+ ModeProt32 = iset.ModeProt32
+ ModeProt16 = iset.ModeProt16
+ ModeReal16 = iset.ModeReal16
)
func Generate(cfg *Config, r *rand.Rand) []byte {
@@ -99,21 +99,21 @@ func Mutate(cfg *Config, r *rand.Rand, text []byte) []byte {
return text
}
-func randInsn(cfg *Config, r *rand.Rand) ifuzzimpl.Insn {
- insnset := ifuzzimpl.Arches[cfg.Arch]
- var insns []ifuzzimpl.Insn
+func randInsn(cfg *Config, r *rand.Rand) iset.Insn {
+ insnset := iset.Arches[cfg.Arch]
+ var insns []iset.Insn
if cfg.Priv && cfg.Exec {
- insns = insnset.GetInsns(cfg.Mode, ifuzzimpl.Type(r.Intn(3)))
+ insns = insnset.GetInsns(cfg.Mode, iset.Type(r.Intn(3)))
} else if cfg.Priv {
- insns = insnset.GetInsns(cfg.Mode, ifuzzimpl.Type(r.Intn(2)))
+ insns = insnset.GetInsns(cfg.Mode, iset.Type(r.Intn(2)))
} else {
- insns = insnset.GetInsns(cfg.Mode, ifuzzimpl.TypeUser)
+ insns = insnset.GetInsns(cfg.Mode, iset.TypeUser)
}
return insns[r.Intn(len(insns))]
}
func split(cfg *Config, text []byte) [][]byte {
- insnset := ifuzzimpl.Arches[cfg.Arch]
+ insnset := iset.Arches[cfg.Arch]
text = append([]byte{}, text...)
var insns [][]byte
var bad []byte