aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-06-06 12:51:52 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-06-07 10:41:01 +0200
commit948dd3af445f31e056db6116c09f095933baed5f (patch)
treef0d35359cfcdfe25bb9932bf2f750bc855c3b62f
parent3f04838a10346e60b9dd81f0adb47c2518486d28 (diff)
prog: remove target.StringDictionary
The linux string dictionary comes from extremely old times when we did not have proper descriptions for almost anything, and the dictionary was a quick hack to guess at least some special strings. Now we have way better descriptions and the dictionary become both unnecessary and probably even harmful.
-rw-r--r--prog/rand.go10
-rw-r--r--prog/target.go4
-rw-r--r--sys/linux/init.go9
3 files changed, 2 insertions, 21 deletions
diff --git a/prog/rand.go b/prog/rand.go
index 3112fc50a..7a035c1b2 100644
--- a/prog/rand.go
+++ b/prog/rand.go
@@ -323,15 +323,9 @@ func (r *randGen) randString(s *state, t *BufferType) []byte {
'/', ':', '.', ',', '-', '\'', '[', ']', '{', '}'}
buf := new(bytes.Buffer)
for r.nOutOf(3, 4) {
- switch {
- case r.nOutOf(10, 21):
- dict := r.target.StringDictionary
- if len(dict) != 0 {
- buf.WriteString(dict[r.Intn(len(dict))])
- }
- case r.nOutOf(10, 11):
+ if r.nOutOf(10, 11) {
buf.Write([]byte{punct[r.Intn(len(punct))]})
- default:
+ } else {
buf.Write([]byte{byte(r.Intn(256))})
}
}
diff --git a/prog/target.go b/prog/target.go
index 23d1ebd08..e2d4f245c 100644
--- a/prog/target.go
+++ b/prog/target.go
@@ -46,10 +46,6 @@ type Target struct {
// and optionally any calls that need to be inserted before the arg reference.
SpecialTypes map[string]func(g *Gen, typ Type, dir Dir, old Arg) (Arg, []*Call)
- // Special strings that can matter for the target.
- // Used as fallback when string type does not have own dictionary.
- StringDictionary []string
-
// Resources that play auxiliary role, but widely used throughout all syscalls (e.g. pid/uid).
AuxResources map[string]bool
diff --git a/sys/linux/init.go b/sys/linux/init.go
index f4f000cfa..6310078d1 100644
--- a/sys/linux/init.go
+++ b/sys/linux/init.go
@@ -66,15 +66,6 @@ func InitTarget(target *prog.Target) {
"usb_device_descriptor_hid": arch.generateUsbHidDeviceDescriptor,
}
- // TODO(dvyukov): get rid of this, this must be in descriptions.
- target.StringDictionary = []string{
- "user", "keyring", "trusted", "system", "security", "selinux",
- "posix_acl_access", "mime_type", "md5sum", "nodev", "self",
- "bdev", "proc", "cgroup", "cpuset",
- "lo", "eth0", "eth1", "em0", "em1", "wlan0", "wlan1", "ppp0", "ppp1",
- "vboxnet0", "vboxnet1", "vmnet0", "vmnet1", "GPL",
- }
-
target.AuxResources = map[string]bool{
"uid": true,
"pid": true,