From 026aaeb2b5393e0c838873306e1c5f2084a8a1aa Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 5 Jan 2020 11:46:35 +0100 Subject: prog: don't mutate strings with enumerated values Strings with enumerated values are frequently file names or have complete enumeration of relevant values. Mutating complete enumeration if not very profitable. Mutating file names leads to escaping paths and fuzzer messing with things it is not supposed to mess with as in: r0 = openat$apparmor_task_exec(0xffffffffffffff9c, &(0x7f0000000440)='/proc/self//exe\x00', 0x3, 0x0) --- sys/test/gen/64.go | 8 +++++++- sys/test/test.txt | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'sys') diff --git a/sys/test/gen/64.go b/sys/test/gen/64.go index ce4ca5a73..681b7fee4 100644 --- a/sys/test/gen/64.go +++ b/sys/test/gen/64.go @@ -1262,6 +1262,12 @@ var syscalls_64 = []*Syscall{ {Name: "test$str0", CallName: "test", MissingArgs: 5, Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", IsVarlen: true}, Kind: 2}}, }}, + {Name: "test$str1", CallName: "test", MissingArgs: 5, Args: []Type{ + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", TypeSize: 4}, Kind: 2, Values: []string{"foo\x00"}}}, + }}, + {Name: "test$str2", CallName: "test", MissingArgs: 5, Args: []Type{ + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", TypeSize: 4}, Kind: 2, SubKind: "fixed_strings", Values: []string{"foo\x00", "bar\x00"}}}, + }}, {Name: "test$struct", CallName: "test", MissingArgs: 5, Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a0", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "syz_struct0"}}}, }}, @@ -1340,4 +1346,4 @@ var consts_64 = []ConstValue{ {Name: "SYS_unsupported"}, } -const revision_64 = "fd5870a81478a9208df976f4d8066bbdfa12f8e5" +const revision_64 = "108f16d364fe32a8c41e4592f79eab831b5935a0" diff --git a/sys/test/test.txt b/sys/test/test.txt index bcbc3462f..3ebbf5979 100644 --- a/sys/test/test.txt +++ b/sys/test/test.txt @@ -14,8 +14,12 @@ test$int(a0 intptr, a1 int8, a2 int16, a3 int32, a4 int64) # String types. test$str0(a ptr[in, string]) +test$str1(a ptr[in, string["foo"]]) +test$str2(a ptr[in, string[fixed_strings]]) test$blob0(a ptr[in, array[int8]]) +fixed_strings = "foo", "bar" + # Opt arguments test$opt0(a0 intptr[opt]) -- cgit mrf-deployment