diff options
| -rw-r--r-- | Makefile | 5 | ||||
| -rw-r--r-- | executor/common_test.h | 35 | ||||
| -rw-r--r-- | executor/defs.h | 8 | ||||
| -rw-r--r-- | executor/syscalls.h | 8 | ||||
| -rw-r--r-- | pkg/csource/generated.go | 58 | ||||
| -rw-r--r-- | sys/test/exec.txt | 18 | ||||
| -rw-r--r-- | sys/test/gen/32_fork_shmem.go | 27 | ||||
| -rw-r--r-- | sys/test/gen/32_shmem.go | 27 | ||||
| -rw-r--r-- | sys/test/gen/64.go | 24 | ||||
| -rw-r--r-- | sys/test/gen/64_fork.go | 27 | ||||
| -rw-r--r-- | sys/test/test.txt | 1 | ||||
| -rw-r--r-- | sys/test/test/align0 | 3 | ||||
| -rw-r--r-- | sys/test/test/errno | 7 | ||||
| -rw-r--r-- | sys/test/test/test | 4 |
14 files changed, 237 insertions, 15 deletions
@@ -68,6 +68,11 @@ ifneq ("$(GOTAGS)", "") endif GOTARGETFLAGS += "-tags=syz_target syz_os_$(TARGETOS) syz_arch_$(TARGETVMARCH) $(GOTAGS)" +ifeq ("$(TARGETOS)", "test") + TARGETGOOS := $(HOSTOS) + TARGETGOARCH := $(HOSTARCH) +endif + ifeq ("$(TARGETOS)", "akaros") TARGETGOOS := $(HOSTOS) TARGETGOARCH := $(HOSTARCH) diff --git a/executor/common_test.h b/executor/common_test.h index 78b3f8e22..75ec81721 100644 --- a/executor/common_test.h +++ b/executor/common_test.h @@ -7,8 +7,43 @@ #include <unistd.h> #if SYZ_EXECUTOR || __NR_syz_mmap +#include <sys/mman.h> + +// syz_mmap(addr vma, len len[addr]) static long syz_mmap(long a0, long a1) { + return (long)mmap((void*)a0, a1, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0); +} +#endif + +#if SYZ_EXECUTOR || __NR_syz_errno +#include <errno.h> + +// syz_errno(v int32) +static long syz_errno(long v) +{ + errno = v; + return v == 0 ? 0 : -1; +} +#endif + +#if SYZ_EXECUTOR || __NR_syz_compare +#include <errno.h> +#include <string.h> + +// syz_compare(want ptr[in, string], want_len len[want], got ptr[in, compare_data], got_len len[got]) +static long syz_compare(long want, long want_len, long got, long got_len) +{ + if (want_len != got_len) { + debug("syz_compare: want_len=%lu got_len=%lu\n", want_len, got_len); + errno = EBADF; + return -1; + } + if (memcmp((void*)want, (void*)got, want_len)) { + debug("syz_compare: data differs\n"); + errno = EINVAL; + return -1; + } return 0; } #endif diff --git a/executor/defs.h b/executor/defs.h index bd92a80b2..eb73e512d 100644 --- a/executor/defs.h +++ b/executor/defs.h @@ -130,7 +130,7 @@ #if GOARCH_32_fork_shmem #define GOARCH "32_fork_shmem" -#define SYZ_REVISION "18f983f4760ca5ac41eaf7c18bd9f487f6dde42b" +#define SYZ_REVISION "d09983a8bb4f2ccd0e303191862d170b5b636bd8" #define SYZ_EXECUTOR_USES_FORK_SERVER 1 #define SYZ_EXECUTOR_USES_SHMEM 1 #define SYZ_PAGE_SIZE 4096 @@ -140,7 +140,7 @@ #if GOARCH_32_shmem #define GOARCH "32_shmem" -#define SYZ_REVISION "9d4e8ff9d9c38d5fe7cdc046adcde8be29782e6b" +#define SYZ_REVISION "8d0f255b4d310c70d0e7d65ac8e5c6c3032a9e14" #define SYZ_EXECUTOR_USES_FORK_SERVER 0 #define SYZ_EXECUTOR_USES_SHMEM 1 #define SYZ_PAGE_SIZE 8192 @@ -150,7 +150,7 @@ #if GOARCH_64 #define GOARCH "64" -#define SYZ_REVISION "981444b6842c8896801fdf67dc75c454cad9e594" +#define SYZ_REVISION "285bb68296c57fc93062731e5c0ecfbfc105d685" #define SYZ_EXECUTOR_USES_FORK_SERVER 0 #define SYZ_EXECUTOR_USES_SHMEM 0 #define SYZ_PAGE_SIZE 4096 @@ -160,7 +160,7 @@ #if GOARCH_64_fork #define GOARCH "64_fork" -#define SYZ_REVISION "1c9fe1f1a1f6f871fc5c088ca80174655322aca4" +#define SYZ_REVISION "39c2288dd1c825ce7a587f946cfc91e0e453cf5e" #define SYZ_EXECUTOR_USES_FORK_SERVER 1 #define SYZ_EXECUTOR_USES_SHMEM 0 #define SYZ_PAGE_SIZE 8192 diff --git a/executor/syscalls.h b/executor/syscalls.h index a8845adb5..6f53b4490 100644 --- a/executor/syscalls.h +++ b/executor/syscalls.h @@ -11439,6 +11439,8 @@ const call_t syscalls[] = { #if GOARCH_32_fork_shmem const call_t syscalls[] = { + {"syz_compare", 0, (syscall_t)syz_compare}, + {"syz_errno", 0, (syscall_t)syz_errno}, {"syz_mmap", 0, (syscall_t)syz_mmap}, }; @@ -11446,6 +11448,8 @@ const call_t syscalls[] = { #if GOARCH_32_shmem const call_t syscalls[] = { + {"syz_compare", 0, (syscall_t)syz_compare}, + {"syz_errno", 0, (syscall_t)syz_errno}, {"syz_mmap", 0, (syscall_t)syz_mmap}, }; @@ -11472,6 +11476,8 @@ const call_t syscalls[] = { {"mutate8", 0}, {"serialize0", 0}, {"serialize1", 0}, + {"syz_compare", 0, (syscall_t)syz_compare}, + {"syz_errno", 0, (syscall_t)syz_errno}, {"syz_mmap", 0, (syscall_t)syz_mmap}, {"test", 0}, {"test$align0", 0}, @@ -11566,6 +11572,8 @@ const call_t syscalls[] = { #if GOARCH_64_fork const call_t syscalls[] = { + {"syz_compare", 0, (syscall_t)syz_compare}, + {"syz_errno", 0, (syscall_t)syz_errno}, {"syz_mmap", 0, (syscall_t)syz_mmap}, }; diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index 0bfedab3e..b4ffc279e 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -3409,8 +3409,37 @@ static void reset_test() #include <unistd.h> #if SYZ_EXECUTOR || __NR_syz_mmap +#include <sys/mman.h> static long syz_mmap(long a0, long a1) { + return (long)mmap((void*)a0, a1, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0); +} +#endif + +#if SYZ_EXECUTOR || __NR_syz_errno +#include <errno.h> +static long syz_errno(long v) +{ + errno = v; + return v == 0 ? 0 : -1; +} +#endif + +#if SYZ_EXECUTOR || __NR_syz_compare +#include <errno.h> +#include <string.h> +static long syz_compare(long want, long want_len, long got, long got_len) +{ + if (want_len != got_len) { + debug("syz_compare: want_len=%lu got_len=%lu\n", want_len, got_len); + errno = EBADF; + return -1; + } + if (memcmp((void*)want, (void*)got, want_len)) { + debug("syz_compare: data differs\n"); + errno = EINVAL; + return -1; + } return 0; } #endif @@ -3551,8 +3580,37 @@ static int do_sandbox_none(void) #include <unistd.h> #if SYZ_EXECUTOR || __NR_syz_mmap +#include <sys/mman.h> static long syz_mmap(long a0, long a1) { + return (long)mmap((void*)a0, a1, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0); +} +#endif + +#if SYZ_EXECUTOR || __NR_syz_errno +#include <errno.h> +static long syz_errno(long v) +{ + errno = v; + return v == 0 ? 0 : -1; +} +#endif + +#if SYZ_EXECUTOR || __NR_syz_compare +#include <errno.h> +#include <string.h> +static long syz_compare(long want, long want_len, long got, long got_len) +{ + if (want_len != got_len) { + debug("syz_compare: want_len=%lu got_len=%lu\n", want_len, got_len); + errno = EBADF; + return -1; + } + if (memcmp((void*)want, (void*)got, want_len)) { + debug("syz_compare: data differs\n"); + errno = EINVAL; + return -1; + } return 0; } #endif diff --git a/sys/test/exec.txt b/sys/test/exec.txt new file mode 100644 index 000000000..4d60fa0eb --- /dev/null +++ b/sys/test/exec.txt @@ -0,0 +1,18 @@ +# Copyright 2018 syzkaller project authors. All rights reserved. +# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. + +syz_mmap(addr vma, len len[addr]) +syz_errno(v int32) +syz_compare(want ptr[in, string], want_len len[want], got ptr[in, compare_data], got_len len[got]) + +compare_data [ + align0 align0 +] [varlen] + +align0 { + f0 int16 + f1 int32 + f2 int8 + f3 int16 + f4 int64 +} diff --git a/sys/test/gen/32_fork_shmem.go b/sys/test/gen/32_fork_shmem.go index b61c234c1..4b6fd369e 100644 --- a/sys/test/gen/32_fork_shmem.go +++ b/sys/test/gen/32_fork_shmem.go @@ -12,9 +12,32 @@ func init() { var resources_32_fork_shmem = []*ResourceDesc(nil) -var structDescs_32_fork_shmem = []*KeyedStruct(nil) +var structDescs_32_fork_shmem = []*KeyedStruct{ + {Key: StructKey{Name: "align0"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "align0", TypeSize: 24}, Fields: []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "f0", TypeSize: 2}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 2}}, IsPad: true}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "f1", TypeSize: 4}}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f2", TypeSize: 1}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 1}}, IsPad: true}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "f3", TypeSize: 2}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 4}}, IsPad: true}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f4", TypeSize: 8}}}, + }}}, + {Key: StructKey{Name: "compare_data"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "compare_data", IsVarlen: true}, Fields: []Type{ + &StructType{Key: StructKey{Name: "align0"}, FldName: "align0"}, + }}}, +} var syscalls_32_fork_shmem = []*Syscall{ + {Name: "syz_compare", CallName: "syz_compare", Args: []Type{ + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "want", TypeSize: 4}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", IsVarlen: true}, Kind: 2}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "want_len", TypeSize: 4}}, Buf: "want"}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "got", TypeSize: 4}, Type: &UnionType{Key: StructKey{Name: "compare_data"}}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "got_len", TypeSize: 4}}, Buf: "got"}, + }}, + {Name: "syz_errno", CallName: "syz_errno", Args: []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "v", TypeSize: 4}}}, + }}, {Name: "syz_mmap", CallName: "syz_mmap", Args: []Type{ &VmaType{TypeCommon: TypeCommon{TypeName: "vma", FldName: "addr", TypeSize: 4}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 4}}, Buf: "addr"}, @@ -28,4 +51,4 @@ var consts_32_fork_shmem = []ConstValue{ {Name: "ONLY_32BITS_CONST", Value: 1}, } -const revision_32_fork_shmem = "18f983f4760ca5ac41eaf7c18bd9f487f6dde42b" +const revision_32_fork_shmem = "d09983a8bb4f2ccd0e303191862d170b5b636bd8" diff --git a/sys/test/gen/32_shmem.go b/sys/test/gen/32_shmem.go index 02db6010e..2e26dbb58 100644 --- a/sys/test/gen/32_shmem.go +++ b/sys/test/gen/32_shmem.go @@ -12,9 +12,32 @@ func init() { var resources_32_shmem = []*ResourceDesc(nil) -var structDescs_32_shmem = []*KeyedStruct(nil) +var structDescs_32_shmem = []*KeyedStruct{ + {Key: StructKey{Name: "align0"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "align0", TypeSize: 24}, Fields: []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "f0", TypeSize: 2}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 2}}, IsPad: true}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "f1", TypeSize: 4}}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f2", TypeSize: 1}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 1}}, IsPad: true}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "f3", TypeSize: 2}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 4}}, IsPad: true}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f4", TypeSize: 8}}}, + }}}, + {Key: StructKey{Name: "compare_data"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "compare_data", IsVarlen: true}, Fields: []Type{ + &StructType{Key: StructKey{Name: "align0"}, FldName: "align0"}, + }}}, +} var syscalls_32_shmem = []*Syscall{ + {Name: "syz_compare", CallName: "syz_compare", Args: []Type{ + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "want", TypeSize: 4}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", IsVarlen: true}, Kind: 2}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "want_len", TypeSize: 4}}, Buf: "want"}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "got", TypeSize: 4}, Type: &UnionType{Key: StructKey{Name: "compare_data"}}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "got_len", TypeSize: 4}}, Buf: "got"}, + }}, + {Name: "syz_errno", CallName: "syz_errno", Args: []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "v", TypeSize: 4}}}, + }}, {Name: "syz_mmap", CallName: "syz_mmap", Args: []Type{ &VmaType{TypeCommon: TypeCommon{TypeName: "vma", FldName: "addr", TypeSize: 4}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 4}}, Buf: "addr"}, @@ -28,4 +51,4 @@ var consts_32_shmem = []ConstValue{ {Name: "ONLY_32BITS_CONST", Value: 1}, } -const revision_32_shmem = "9d4e8ff9d9c38d5fe7cdc046adcde8be29782e6b" +const revision_32_shmem = "8d0f255b4d310c70d0e7d65ac8e5c6c3032a9e14" diff --git a/sys/test/gen/64.go b/sys/test/gen/64.go index b594499c8..58339702f 100644 --- a/sys/test/gen/64.go +++ b/sys/test/gen/64.go @@ -21,6 +21,16 @@ var resources_64 = []*ResourceDesc{ } var structDescs_64 = []*KeyedStruct{ + {Key: StructKey{Name: "align0"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "align0", TypeSize: 24}, Fields: []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "f0", TypeSize: 2}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 2}}, IsPad: true}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "f1", TypeSize: 4}}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f2", TypeSize: 1}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 1}}, IsPad: true}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "f3", TypeSize: 2}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 4}}, IsPad: true}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f4", TypeSize: 8}}}, + }}}, {Key: StructKey{Name: "any0"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "any0", IsVarlen: true}, Fields: []Type{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f1", TypeSize: 1}}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 3}}, IsPad: true}, @@ -55,6 +65,9 @@ var structDescs_64 = []*KeyedStruct{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "i8", TypeSize: 1}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "i32", TypeSize: 4}}}, }}}, + {Key: StructKey{Name: "compare_data"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "compare_data", IsVarlen: true}, Fields: []Type{ + &StructType{Key: StructKey{Name: "align0"}, FldName: "align0"}, + }}}, {Key: StructKey{Name: "excessive_fields"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "excessive_fields", TypeSize: 1}, Fields: []Type{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f1", TypeSize: 1}}}, }}}, @@ -574,6 +587,15 @@ var syscalls_64 = []*Syscall{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "a", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", ArgDir: 1, IsVarlen: true}}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "b", TypeSize: 8}}, Buf: "a"}, }}, + {Name: "syz_compare", CallName: "syz_compare", Args: []Type{ + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "want", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", IsVarlen: true}, Kind: 2}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "want_len", TypeSize: 8}}, Buf: "want"}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "got", TypeSize: 8}, Type: &UnionType{Key: StructKey{Name: "compare_data"}}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "got_len", TypeSize: 8}}, Buf: "got"}, + }}, + {Name: "syz_errno", CallName: "syz_errno", Args: []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "v", TypeSize: 4}}}, + }}, {Name: "syz_mmap", CallName: "syz_mmap", Args: []Type{ &VmaType{TypeCommon: TypeCommon{TypeName: "vma", FldName: "addr", TypeSize: 8}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "addr"}, @@ -879,4 +901,4 @@ var consts_64 = []ConstValue{ {Name: "SYS_unsupported"}, } -const revision_64 = "981444b6842c8896801fdf67dc75c454cad9e594" +const revision_64 = "285bb68296c57fc93062731e5c0ecfbfc105d685" diff --git a/sys/test/gen/64_fork.go b/sys/test/gen/64_fork.go index ca62e9ce0..95171623b 100644 --- a/sys/test/gen/64_fork.go +++ b/sys/test/gen/64_fork.go @@ -12,9 +12,32 @@ func init() { var resources_64_fork = []*ResourceDesc(nil) -var structDescs_64_fork = []*KeyedStruct(nil) +var structDescs_64_fork = []*KeyedStruct{ + {Key: StructKey{Name: "align0"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "align0", TypeSize: 24}, Fields: []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "f0", TypeSize: 2}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 2}}, IsPad: true}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "f1", TypeSize: 4}}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int8", FldName: "f2", TypeSize: 1}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 1}}, IsPad: true}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "f3", TypeSize: 2}}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 4}}, IsPad: true}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "f4", TypeSize: 8}}}, + }}}, + {Key: StructKey{Name: "compare_data"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "compare_data", IsVarlen: true}, Fields: []Type{ + &StructType{Key: StructKey{Name: "align0"}, FldName: "align0"}, + }}}, +} var syscalls_64_fork = []*Syscall{ + {Name: "syz_compare", CallName: "syz_compare", Args: []Type{ + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "want", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", IsVarlen: true}, Kind: 2}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "want_len", TypeSize: 8}}, Buf: "want"}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "got", TypeSize: 8}, Type: &UnionType{Key: StructKey{Name: "compare_data"}}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "got_len", TypeSize: 8}}, Buf: "got"}, + }}, + {Name: "syz_errno", CallName: "syz_errno", Args: []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "v", TypeSize: 4}}}, + }}, {Name: "syz_mmap", CallName: "syz_mmap", Args: []Type{ &VmaType{TypeCommon: TypeCommon{TypeName: "vma", FldName: "addr", TypeSize: 8}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "addr"}, @@ -27,4 +50,4 @@ var consts_64_fork = []ConstValue{ {Name: "IPPROTO_UDP", Value: 17}, } -const revision_64_fork = "1c9fe1f1a1f6f871fc5c088ca80174655322aca4" +const revision_64_fork = "39c2288dd1c825ce7a587f946cfc91e0e453cf5e" diff --git a/sys/test/test.txt b/sys/test/test.txt index f35cd7696..d7b822e77 100644 --- a/sys/test/test.txt +++ b/sys/test/test.txt @@ -3,7 +3,6 @@ # Syscalls used in syzkaller tests. -syz_mmap(addr vma, len len[addr]) test() # Integer types. diff --git a/sys/test/test/align0 b/sys/test/test/align0 new file mode 100644 index 000000000..ae83c3c84 --- /dev/null +++ b/sys/test/test/align0 @@ -0,0 +1,3 @@ +syz_compare(&(0x7f0000000000)="010000000200000003000400000000000500000000000000", 0x18, &(0x7f0000001000)=@align0={0x1, 0x2, 0x3, 0x4, 0x5}, 0x18) +syz_compare(&(0x7f0000000000)="", 0x18, &(0x7f0000001000)=@align0={}, 0x17) # EBADF +syz_compare(&(0x7f0000000000)="", 0x18, &(0x7f0000001000)=@align0={0x1}, 0x18) # EINVAL diff --git a/sys/test/test/errno b/sys/test/test/errno new file mode 100644 index 000000000..8d4905c7e --- /dev/null +++ b/sys/test/test/errno @@ -0,0 +1,7 @@ +syz_errno(0x0) +syz_errno(0x0) +syz_errno(0x16) # EINVAL +syz_errno(0x0) +syz_errno(0xc) # ENOMEM +syz_errno(0x9) # EBADF +syz_errno(0x0) diff --git a/sys/test/test/test b/sys/test/test/test index b4d667cd8..1803a6108 100644 --- a/sys/test/test/test +++ b/sys/test/test/test @@ -1,3 +1 @@ -syz_mmap() -syz_mmap() -syz_mmap() +syz_mmap() # EINVAL |
