aboutsummaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/akaros/amd64.go289
-rw-r--r--sys/akaros/init.go74
-rw-r--r--sys/akaros/sys.txt120
-rw-r--r--sys/akaros/sys_amd64.const92
-rw-r--r--sys/sys.go1
-rw-r--r--sys/targets/targets.go10
6 files changed, 586 insertions, 0 deletions
diff --git a/sys/akaros/amd64.go b/sys/akaros/amd64.go
new file mode 100644
index 000000000..29911c9a8
--- /dev/null
+++ b/sys/akaros/amd64.go
@@ -0,0 +1,289 @@
+// AUTOGENERATED FILE
+package akaros
+
+import . "github.com/google/syzkaller/prog"
+
+func init() {
+ RegisterTarget(&Target{OS: "akaros", Arch: "amd64", Revision: revision_amd64, PtrSize: 8, Syscalls: syscalls_amd64, Resources: resources_amd64, Structs: structDescs_amd64, Consts: consts_amd64}, initTarget)
+}
+
+var resources_amd64 = []*ResourceDesc{
+ {Name: "fd", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
+ {Name: "pid", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"pid"}, Values: []uint64{0, 18446744073709551615}},
+}
+
+var structDescs_amd64 = []*KeyedStruct{
+ {Key: StructKey{Name: "flock"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "flock", TypeSize: 32}, Fields: []Type{
+ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "flock_type", FldName: "type", TypeSize: 2}}, Vals: []uint64{0, 1, 2}},
+ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "seek_whence", FldName: "whence", TypeSize: 2}}, Vals: []uint64{0, 1, 2}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 4}}, IsPad: true},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "start", TypeSize: 8}}},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "len", TypeSize: 8}}},
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 4}}, IsPad: true},
+ }}},
+ {Key: StructKey{Name: "timespec"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "timespec", TypeSize: 16}, Fields: []Type{
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "sec", TypeSize: 8}}},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "nsec", TypeSize: 8}}},
+ }}},
+ {Key: StructKey{Name: "timespec", Dir: 1}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "timespec", TypeSize: 16, ArgDir: 1}, Fields: []Type{
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "sec", TypeSize: 8, ArgDir: 1}}},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "nsec", TypeSize: 8, ArgDir: 1}}},
+ }}},
+}
+
+var syscalls_amd64 = []*Syscall{
+ {NR: 33, Name: "abort_sysc_fd", CallName: "abort_sysc_fd", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ }},
+ {ID: 1, NR: 116, Name: "chdir", CallName: "chdir", Args: []Type{
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "dir", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename"}, Kind: 3}},
+ }},
+ {ID: 2, NR: 103, Name: "close", CallName: "close", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ }},
+ {ID: 3, NR: 124, Name: "fchdir", CallName: "fchdir", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ }},
+ {ID: 4, NR: 107, Name: "fcntl$F_DUPFD", CallName: "fcntl", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}},
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "arg", TypeSize: 4}},
+ }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "ret", TypeSize: 4, ArgDir: 1}}},
+ {ID: 5, NR: 107, Name: "fcntl$F_DUPFD_CLOEXEC", CallName: "fcntl", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 1030},
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "arg", TypeSize: 4}},
+ }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "ret", TypeSize: 4, ArgDir: 1}}},
+ {ID: 6, NR: 107, Name: "fcntl$F_GETFD", CallName: "fcntl", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 1},
+ }},
+ {ID: 7, NR: 107, Name: "fcntl$F_GETFL", CallName: "fcntl", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 3},
+ }},
+ {ID: 8, NR: 107, Name: "fcntl$F_GETLK", CallName: "fcntl", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 5},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "lock", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "flock"}}},
+ }},
+ {ID: 9, NR: 107, Name: "fcntl$F_GETOWN", CallName: "fcntl", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 9},
+ }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "ret", TypeSize: 4, ArgDir: 1}}},
+ {ID: 10, NR: 107, Name: "fcntl$F_SETFD", CallName: "fcntl", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 2},
+ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "fcntl_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{1}},
+ }},
+ {ID: 11, NR: 107, Name: "fcntl$F_SETFL", CallName: "fcntl", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 4},
+ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "fcntl_status", FldName: "flags", TypeSize: 8}}, Vals: []uint64{1024, 8192, 2048}},
+ }},
+ {ID: 12, NR: 107, Name: "fcntl$F_SETLK", CallName: "fcntl", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 6},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "lock", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "flock"}}},
+ }},
+ {ID: 13, NR: 107, Name: "fcntl$F_SETLKW", CallName: "fcntl", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 7},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "lock", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "flock"}}},
+ }},
+ {ID: 14, NR: 107, Name: "fcntl$F_SETOWN", CallName: "fcntl", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 8},
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4}},
+ }},
+ {ID: 15, NR: 15, Name: "fork", CallName: "fork"},
+ {ID: 16, NR: 104, Name: "fstat", CallName: "fstat", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "statbuf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", ArgDir: 1}}},
+ }},
+ {ID: 17, NR: 117, Name: "getcwd", CallName: "getcwd", Args: []Type{
+ &PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "buf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1}}},
+ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "size", TypeSize: 8}}, Buf: "buf"},
+ }},
+ {ID: 18, NR: 112, Name: "link", CallName: "link", Args: []Type{
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "old", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename"}, Kind: 3}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "new", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename"}, Kind: 3}},
+ }},
+ {ID: 19, NR: 111, Name: "llseek", CallName: "llseek", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "offset_hi", TypeSize: 8}}},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "offset_lo", TypeSize: 8}}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "result", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", TypeSize: 8, ArgDir: 1}}}},
+ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "seek_whence", FldName: "whence", TypeSize: 8}}, Vals: []uint64{0, 1, 2}},
+ }},
+ {ID: 20, NR: 106, Name: "lstat", CallName: "lstat", Args: []Type{
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "file", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename"}, Kind: 3}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "statbuf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", ArgDir: 1}}},
+ }},
+ {ID: 21, NR: 118, Name: "mkdir", CallName: "mkdir", Args: []Type{
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename"}, Kind: 3}},
+ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_mode", FldName: "mode", TypeSize: 8}}, Vals: []uint64{256, 128, 64, 32, 16, 8, 4, 2, 1}},
+ }},
+ {ID: 22, NR: 18, Name: "mmap", CallName: "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"},
+ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "mmap_prot", FldName: "prot", TypeSize: 8}}, Vals: []uint64{4, 1, 2, 16777216, 33554432}},
+ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "mmap_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{1, 2, 64, 32, 2048, 4096, 0, 16, 256, 262144, 8192, 65536, 16384, 32768, 131072}},
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4, IsOptional: true}},
+ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "offset", TypeSize: 8}}},
+ }},
+ {ID: 23, NR: 20, Name: "mprotect", CallName: "mprotect", Args: []Type{
+ &VmaType{TypeCommon: TypeCommon{TypeName: "vma", FldName: "addr", TypeSize: 8}},
+ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "addr"},
+ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "mmap_prot", FldName: "prot", TypeSize: 8}}, Vals: []uint64{4, 1, 2, 16777216, 33554432}},
+ }},
+ {ID: 24, NR: 19, Name: "munmap", CallName: "munmap", Args: []Type{
+ &VmaType{TypeCommon: TypeCommon{TypeName: "vma", FldName: "addr", TypeSize: 8}},
+ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "addr"},
+ }},
+ {ID: 25, NR: 36, Name: "nanosleep", CallName: "nanosleep", Args: []Type{
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "req", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "timespec"}}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "rem", TypeSize: 8, IsOptional: true}, Type: &StructType{Key: StructKey{Name: "timespec", Dir: 1}}},
+ }},
+ {ID: 26, NR: 102, Name: "openat", CallName: "openat", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "file", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename"}, Kind: 3}},
+ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 1024, 8192, 524288, 64, 65536, 128, 256, 131072, 2048, 1052672, 512, 4259840}},
+ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_mode", FldName: "mode", TypeSize: 8}}, Vals: []uint64{256, 128, 64, 32, 16, 8, 4, 2, 1}},
+ }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "ret", TypeSize: 4, ArgDir: 1}}},
+ {ID: 27, NR: 100, Name: "read", CallName: "read", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "buf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1}}},
+ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "count", TypeSize: 8}}, Buf: "buf"},
+ }},
+ {ID: 28, NR: 115, Name: "readlink", CallName: "readlink", Args: []Type{
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename"}, Kind: 3}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "buf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1}}},
+ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "siz", TypeSize: 8}}, Buf: "buf"},
+ }},
+ {ID: 29, NR: 123, Name: "rename", CallName: "rename", Args: []Type{
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "old", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename"}, Kind: 3}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "new", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename"}, Kind: 3}},
+ }},
+ {ID: 30, NR: 119, Name: "rmdir", CallName: "rmdir", Args: []Type{
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename"}, Kind: 3}},
+ }},
+ {ID: 31, NR: 105, Name: "stat", CallName: "stat", Args: []Type{
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "file", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename"}, Kind: 3}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "statbuf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", ArgDir: 1}}},
+ }},
+ {ID: 32, NR: 114, Name: "symlink", CallName: "symlink", Args: []Type{
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "old", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename"}, Kind: 3}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "new", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename"}, Kind: 3}},
+ }},
+ {ID: 33, NR: 113, Name: "unlink", CallName: "unlink", Args: []Type{
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename"}, Kind: 3}},
+ }},
+ {ID: 34, NR: 17, Name: "waitpid", CallName: "waitpid", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "status", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}},
+ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "wait_options", FldName: "options", TypeSize: 8}}, Vals: []uint64{1, 2}},
+ }},
+ {ID: 35, NR: 101, Name: "write", CallName: "write", Args: []Type{
+ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
+ &PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "buf", TypeSize: 8}, Type: &BufferType{}},
+ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "count", TypeSize: 8}}, Buf: "buf"},
+ }},
+}
+
+var consts_amd64 = []ConstValue{
+ {Name: "AT_FDCWD", Value: 18446744073709551516},
+ {Name: "FASYNC", Value: 8192},
+ {Name: "FD_CLOEXEC", Value: 1},
+ {Name: "F_DUPFD"},
+ {Name: "F_DUPFD_CLOEXEC", Value: 1030},
+ {Name: "F_GETFD", Value: 1},
+ {Name: "F_GETFL", Value: 3},
+ {Name: "F_GETLK", Value: 5},
+ {Name: "F_GETOWN", Value: 9},
+ {Name: "F_RDLCK"},
+ {Name: "F_SETFD", Value: 2},
+ {Name: "F_SETFL", Value: 4},
+ {Name: "F_SETLK", Value: 6},
+ {Name: "F_SETLKW", Value: 7},
+ {Name: "F_SETOWN", Value: 8},
+ {Name: "F_UNLCK", Value: 2},
+ {Name: "F_WRLCK", Value: 1},
+ {Name: "MAP_32BIT", Value: 64},
+ {Name: "MAP_ANONYMOUS", Value: 32},
+ {Name: "MAP_DENYWRITE", Value: 2048},
+ {Name: "MAP_EXECUTABLE", Value: 4096},
+ {Name: "MAP_FILE"},
+ {Name: "MAP_FIXED", Value: 16},
+ {Name: "MAP_GROWSDOWN", Value: 256},
+ {Name: "MAP_HUGETLB", Value: 262144},
+ {Name: "MAP_LOCKED", Value: 8192},
+ {Name: "MAP_NONBLOCK", Value: 65536},
+ {Name: "MAP_NORESERVE", Value: 16384},
+ {Name: "MAP_POPULATE", Value: 32768},
+ {Name: "MAP_PRIVATE", Value: 2},
+ {Name: "MAP_SHARED", Value: 1},
+ {Name: "MAP_STACK", Value: 131072},
+ {Name: "O_APPEND", Value: 1024},
+ {Name: "O_CLOEXEC", Value: 524288},
+ {Name: "O_CREAT", Value: 64},
+ {Name: "O_DIRECTORY", Value: 65536},
+ {Name: "O_EXCL", Value: 128},
+ {Name: "O_NOCTTY", Value: 256},
+ {Name: "O_NOFOLLOW", Value: 131072},
+ {Name: "O_NONBLOCK", Value: 2048},
+ {Name: "O_RDONLY"},
+ {Name: "O_RDWR", Value: 2},
+ {Name: "O_SYNC", Value: 1052672},
+ {Name: "O_TRUNC", Value: 512},
+ {Name: "O_WRONLY", Value: 1},
+ {Name: "PROT_EXEC", Value: 4},
+ {Name: "PROT_GROWSDOWN", Value: 16777216},
+ {Name: "PROT_GROWSUP", Value: 33554432},
+ {Name: "PROT_READ", Value: 1},
+ {Name: "PROT_WRITE", Value: 2},
+ {Name: "SEEK_CUR", Value: 1},
+ {Name: "SEEK_END", Value: 2},
+ {Name: "SEEK_SET"},
+ {Name: "SYS_abort_sysc_fd", Value: 33},
+ {Name: "SYS_chdir", Value: 116},
+ {Name: "SYS_close", Value: 103},
+ {Name: "SYS_fchdir", Value: 124},
+ {Name: "SYS_fcntl", Value: 107},
+ {Name: "SYS_fork", Value: 15},
+ {Name: "SYS_fstat", Value: 104},
+ {Name: "SYS_getcwd", Value: 117},
+ {Name: "SYS_link", Value: 112},
+ {Name: "SYS_llseek", Value: 111},
+ {Name: "SYS_lstat", Value: 106},
+ {Name: "SYS_mkdir", Value: 118},
+ {Name: "SYS_mmap", Value: 18},
+ {Name: "SYS_mprotect", Value: 20},
+ {Name: "SYS_munmap", Value: 19},
+ {Name: "SYS_nanosleep", Value: 36},
+ {Name: "SYS_openat", Value: 102},
+ {Name: "SYS_read", Value: 100},
+ {Name: "SYS_readlink", Value: 115},
+ {Name: "SYS_rename", Value: 123},
+ {Name: "SYS_rmdir", Value: 119},
+ {Name: "SYS_stat", Value: 105},
+ {Name: "SYS_symlink", Value: 114},
+ {Name: "SYS_unlink", Value: 113},
+ {Name: "SYS_waitpid", Value: 17},
+ {Name: "SYS_write", Value: 101},
+ {Name: "S_IRGRP", Value: 32},
+ {Name: "S_IROTH", Value: 4},
+ {Name: "S_IRUSR", Value: 256},
+ {Name: "S_IWGRP", Value: 16},
+ {Name: "S_IWOTH", Value: 2},
+ {Name: "S_IWUSR", Value: 128},
+ {Name: "S_IXGRP", Value: 8},
+ {Name: "S_IXOTH", Value: 1},
+ {Name: "S_IXUSR", Value: 64},
+ {Name: "WNOHANG", Value: 1},
+ {Name: "WUNTRACED", Value: 2},
+ {Name: "__O_TMPFILE", Value: 4259840},
+}
+
+const revision_amd64 = "77727415c41fde64d42084c526dfb8bf1f1abf05"
diff --git a/sys/akaros/init.go b/sys/akaros/init.go
new file mode 100644
index 000000000..02b9f09a6
--- /dev/null
+++ b/sys/akaros/init.go
@@ -0,0 +1,74 @@
+// Copyright 2017 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.
+
+package akaros
+
+import (
+ "github.com/google/syzkaller/prog"
+)
+
+func initTarget(target *prog.Target) {
+ arch := &arch{
+ mmapSyscall: target.SyscallMap["mmap"],
+ PROT_READ: target.ConstMap["PROT_READ"],
+ PROT_WRITE: target.ConstMap["PROT_WRITE"],
+ MAP_ANONYMOUS: target.ConstMap["MAP_ANONYMOUS"],
+ MAP_PRIVATE: target.ConstMap["MAP_PRIVATE"],
+ MAP_FIXED: target.ConstMap["MAP_FIXED"],
+ }
+
+ target.PageSize = pageSize
+ target.DataOffset = dataOffset
+ target.MmapSyscall = arch.mmapSyscall
+ target.MakeMmap = arch.makeMmap
+ target.AnalyzeMmap = arch.analyzeMmap
+}
+
+const (
+ pageSize = 4 << 10
+ dataOffset = 512 << 20
+ invalidFD = ^uint64(0)
+)
+
+type arch struct {
+ mmapSyscall *prog.Syscall
+
+ PROT_READ uint64
+ PROT_WRITE uint64
+ MAP_ANONYMOUS uint64
+ MAP_PRIVATE uint64
+ MAP_FIXED uint64
+}
+
+// createMmapCall creates a "normal" mmap call that maps [start, start+npages) page range.
+func (arch *arch) makeMmap(start, npages uint64) *prog.Call {
+ meta := arch.mmapSyscall
+ return &prog.Call{
+ Meta: meta,
+ Args: []prog.Arg{
+ prog.MakePointerArg(meta.Args[0], start, 0, npages, nil),
+ prog.MakeConstArg(meta.Args[1], npages*pageSize),
+ prog.MakeConstArg(meta.Args[2], arch.PROT_READ|arch.PROT_WRITE),
+ prog.MakeConstArg(meta.Args[3], arch.MAP_ANONYMOUS|arch.MAP_PRIVATE|arch.MAP_FIXED),
+ prog.MakeResultArg(meta.Args[4], nil, invalidFD),
+ prog.MakeConstArg(meta.Args[5], 0),
+ },
+ Ret: prog.MakeReturnArg(meta.Ret),
+ }
+}
+
+func (arch *arch) analyzeMmap(c *prog.Call) (start, npages uint64, mapped bool) {
+ switch c.Meta.Name {
+ case "mmap":
+ start = c.Args[0].(*prog.PointerArg).PageIndex
+ mapped = true
+ return
+ case "munmap":
+ start = c.Args[0].(*prog.PointerArg).PageIndex
+ npages = c.Args[1].(*prog.ConstArg).Val / pageSize
+ mapped = false
+ return
+ default:
+ return
+ }
+}
diff --git a/sys/akaros/sys.txt b/sys/akaros/sys.txt
new file mode 100644
index 000000000..ae52c0d3f
--- /dev/null
+++ b/sys/akaros/sys.txt
@@ -0,0 +1,120 @@
+# Copyright 2017 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.
+
+include <sys/mman.h>
+include <sys/types.h>
+include <sys/wait.h>
+include <sys/stat.h>
+include <fcntl.h>
+include <unistd.h>
+
+resource fd[int32]: 0xffffffffffffffff, AT_FDCWD
+resource pid[int32]: 0, 0xffffffffffffffff
+
+openat(fd fd, file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd
+read(fd fd, buf buffer[out], count len[buf])
+write(fd fd, buf buffer[in], count len[buf])
+close(fd fd)
+abort_sysc_fd(fd fd)
+stat(file ptr[in, filename], statbuf ptr[out, array[int8]])
+fstat(fd fd, statbuf ptr[out, array[int8]])
+lstat(file ptr[in, filename], statbuf ptr[out, array[int8]])
+llseek(fd fd, offset_hi intptr, offset_lo intptr, result ptr[out, int64], whence flags[seek_whence])
+link(old ptr[in, filename], new ptr[in, filename])
+unlink(path ptr[in, filename])
+symlink(old ptr[in, filename], new ptr[in, filename])
+readlink(path ptr[in, filename], buf buffer[out], siz len[buf])
+chdir(dir ptr[in, filename])
+fchdir(fd fd)
+getcwd(buf buffer[out], size len[buf])
+rename(old ptr[in, filename], new ptr[in, filename])
+mkdir(path ptr[in, filename], mode flags[open_mode])
+rmdir(path ptr[in, filename])
+
+fcntl$F_DUPFD(fd fd, cmd const[F_DUPFD], arg fd) fd
+fcntl$F_DUPFD_CLOEXEC(fd fd, cmd const[F_DUPFD_CLOEXEC], arg fd) fd
+fcntl$F_GETFD(fd fd, cmd const[F_GETFD])
+fcntl$F_GETFL(fd fd, cmd const[F_GETFL])
+fcntl$F_SETFD(fd fd, cmd const[F_SETFD], flags flags[fcntl_flags])
+fcntl$F_SETFL(fd fd, cmd const[F_SETFL], flags flags[fcntl_status])
+fcntl$F_SETLK(fd fd, cmd const[F_SETLK], lock ptr[in, flock])
+fcntl$F_SETLKW(fd fd, cmd const[F_SETLKW], lock ptr[in, flock])
+fcntl$F_GETLK(fd fd, cmd const[F_GETLK], lock ptr[in, flock])
+fcntl$F_GETOWN(fd fd, cmd const[F_GETOWN]) pid
+fcntl$F_SETOWN(fd fd, cmd const[F_SETOWN], pid pid)
+
+mmap(addr vma, len len[addr], prot flags[mmap_prot], flags flags[mmap_flags], fd fd[opt], offset intptr)
+munmap(addr vma, len len[addr])
+mprotect(addr vma, len len[addr], prot flags[mmap_prot])
+
+fork()
+waitpid(pid pid, status ptr[out, int32], options flags[wait_options])
+nanosleep(req ptr[in, timespec], rem ptr[out, timespec, opt])
+
+open_flags = O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, FASYNC, O_CLOEXEC, O_CREAT, O_DIRECTORY, O_EXCL, O_NOCTTY, O_NOFOLLOW, O_NONBLOCK, O_SYNC, O_TRUNC, __O_TMPFILE
+open_mode = S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH
+mmap_prot = PROT_EXEC, PROT_READ, PROT_WRITE, PROT_GROWSDOWN, PROT_GROWSUP
+mmap_flags = MAP_SHARED, MAP_PRIVATE, MAP_32BIT, MAP_ANONYMOUS, MAP_DENYWRITE, MAP_EXECUTABLE, MAP_FILE, MAP_FIXED, MAP_GROWSDOWN, MAP_HUGETLB, MAP_LOCKED, MAP_NONBLOCK, MAP_NORESERVE, MAP_POPULATE, MAP_STACK
+wait_options = WNOHANG, WUNTRACED
+fcntl_flags = FD_CLOEXEC
+fcntl_status = O_APPEND, FASYNC, O_NONBLOCK
+flock_type = F_RDLCK, F_WRLCK, F_UNLCK
+seek_whence = SEEK_SET, SEEK_CUR, SEEK_END
+
+timespec {
+ sec intptr
+ nsec intptr
+}
+
+flock {
+ type flags[flock_type, int16]
+ whence flags[seek_whence, int16]
+ start intptr
+ len intptr
+ pid pid
+}
+
+# TODO:
+#define SYS_null 1
+#define SYS_block 2
+#define SYS_cache_invalidate 3
+#define SYS_reboot 4
+#define SYS_getpcoreid 7
+#define SYS_getvcoreid 8
+#define SYS_proc_create 10
+#define SYS_proc_run 11
+#define SYS_proc_destroy 12
+#define SYS_proc_yield 13
+#define SYS_change_vcore 14
+#define SYS_exec 16
+#define SYS_shared_page_alloc 22
+#define SYS_shared_page_free 23
+#define SYS_provision 24
+#define SYS_notify 25
+#define SYS_self_notify 26
+#define SYS_halt_core 27
+#define SYS_init_arsc 28
+#define SYS_change_to_m 29
+#define SYS_poke_ksched 30
+#define SYS_abort_sysc 31
+#define SYS_populate_va 32
+#define SYS_vmm_add_gpcs 34
+#define SYS_vc_entry 35
+#define SYS_pop_ctx 37
+#define SYS_vmm_poke_guest 38
+#define SYS_send_event 39
+#define SYS_vmm_ctl 40
+#define SYS_access 108
+#define SYS_umask 109
+#define SYS_wstat 121
+#define SYS_fwstat 122
+#define SYS_dup_fds_to 125
+#define SYS_tap_fds 126
+#define SYS_tcgetattr 141
+#define SYS_tcsetattr 142
+#define SYS_setuid 143
+#define SYS_setgid 144
+#define SYS_nbind 145
+#define SYS_nmount 146
+#define SYS_nunmount 147
+#define SYS_fd2path 149
diff --git a/sys/akaros/sys_amd64.const b/sys/akaros/sys_amd64.const
new file mode 100644
index 000000000..3154e8339
--- /dev/null
+++ b/sys/akaros/sys_amd64.const
@@ -0,0 +1,92 @@
+# AUTOGENERATED FILE
+AT_FDCWD = 18446744073709551516
+FASYNC = 8192
+FD_CLOEXEC = 1
+F_DUPFD = 0
+F_DUPFD_CLOEXEC = 1030
+F_GETFD = 1
+F_GETFL = 3
+F_GETLK = 5
+F_GETOWN = 9
+F_RDLCK = 0
+F_SETFD = 2
+F_SETFL = 4
+F_SETLK = 6
+F_SETLKW = 7
+F_SETOWN = 8
+F_UNLCK = 2
+F_WRLCK = 1
+MAP_32BIT = 64
+MAP_ANONYMOUS = 32
+MAP_DENYWRITE = 2048
+MAP_EXECUTABLE = 4096
+MAP_FILE = 0
+MAP_FIXED = 16
+MAP_GROWSDOWN = 256
+MAP_HUGETLB = 262144
+MAP_LOCKED = 8192
+MAP_NONBLOCK = 65536
+MAP_NORESERVE = 16384
+MAP_POPULATE = 32768
+MAP_PRIVATE = 2
+MAP_SHARED = 1
+MAP_STACK = 131072
+O_APPEND = 1024
+O_CLOEXEC = 524288
+O_CREAT = 64
+O_DIRECTORY = 65536
+O_EXCL = 128
+O_NOCTTY = 256
+O_NOFOLLOW = 131072
+O_NONBLOCK = 2048
+O_RDONLY = 0
+O_RDWR = 2
+O_SYNC = 1052672
+O_TRUNC = 512
+O_WRONLY = 1
+PROT_EXEC = 4
+PROT_GROWSDOWN = 16777216
+PROT_GROWSUP = 33554432
+PROT_READ = 1
+PROT_WRITE = 2
+SEEK_CUR = 1
+SEEK_END = 2
+SEEK_SET = 0
+SYS_abort_sysc_fd = 33
+SYS_chdir = 116
+SYS_close = 103
+SYS_fchdir = 124
+SYS_fcntl = 107
+SYS_fork = 15
+SYS_fstat = 104
+SYS_getcwd = 117
+SYS_link = 112
+SYS_llseek = 111
+SYS_lstat = 106
+SYS_mkdir = 118
+SYS_mmap = 18
+SYS_mprotect = 20
+SYS_munmap = 19
+SYS_nanosleep = 36
+SYS_openat = 102
+SYS_read = 100
+SYS_readlink = 115
+SYS_rename = 123
+SYS_rmdir = 119
+SYS_stat = 105
+SYS_symlink = 114
+SYS_unlink = 113
+SYS_waitpid = 17
+SYS_write = 101
+S_IRGRP = 32
+S_IROTH = 4
+S_IRUSR = 256
+S_IWGRP = 16
+S_IWOTH = 2
+S_IWUSR = 128
+S_IXGRP = 8
+S_IXOTH = 1
+S_IXUSR = 64
+WNOHANG = 1
+WUNTRACED = 2
+__O_TMPFILE = 4259840
diff --git a/sys/sys.go b/sys/sys.go
index e2f291fec..5b69648b2 100644
--- a/sys/sys.go
+++ b/sys/sys.go
@@ -4,6 +4,7 @@
package sys
import (
+ _ "github.com/google/syzkaller/sys/akaros"
_ "github.com/google/syzkaller/sys/freebsd"
_ "github.com/google/syzkaller/sys/fuchsia"
_ "github.com/google/syzkaller/sys/linux"
diff --git a/sys/targets/targets.go b/sys/targets/targets.go
index 4b92eaeb5..c0abdf86b 100644
--- a/sys/targets/targets.go
+++ b/sys/targets/targets.go
@@ -85,6 +85,12 @@ var List = map[string]map[string]*Target{
CArch: []string{"_M_X64"},
},
},
+ "akaros": map[string]*Target{
+ "amd64": {
+ PtrSize: 8,
+ CArch: []string{"__x86_64__"},
+ },
+ },
}
type OS struct {
@@ -108,6 +114,10 @@ var OSList = map[string]*OS{
"windows": {
SyscallNumbers: false,
},
+ "akaros": {
+ SyscallNumbers: true,
+ SyscallPrefix: "SYS_",
+ },
}
func init() {