diff --git a/executor/syscalls_akaros.h b/executor/syscalls_akaros.h index 7520e61b..27f54e10 100644 --- a/executor/syscalls_akaros.h +++ b/executor/syscalls_akaros.h @@ -2,7 +2,7 @@ #if defined(__x86_64__) || 0 #define GOARCH "amd64" -#define SYZ_REVISION "687c84c69215ebd90b47978898d8133e3aa86cbe" +#define SYZ_REVISION "a10d041f1676f50456445d56c1fb505d7b8d5cef" #define SYZ_EXECUTOR_USES_FORK_SERVER true #define SYZ_EXECUTOR_USES_SHMEM false #define SYZ_PAGE_SIZE 4096 diff --git a/sys/akaros/gen/amd64.go b/sys/akaros/gen/amd64.go index 3b3e7e32..1b9fef44 100644 --- a/sys/akaros/gen/amd64.go +++ b/sys/akaros/gen/amd64.go @@ -81,13 +81,15 @@ var syscalls_amd64 = []*Syscall{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "enable_my_notif", TypeSize: 4}}, Kind: 2, RangeEnd: 1}, }}, {NR: 116, Name: "chdir", CallName: "chdir", Args: []Type{ - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "dir", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4, IsOptional: true}}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "path_l", TypeSize: 8}}, Buf: "path"}, }}, {NR: 103, Name: "close", CallName: "close", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, }}, {NR: 125, Name: "dup_fds_to", CallName: "dup_fds_to", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4}}, + &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4, IsOptional: true}}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "map", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}, Type: &StructType{Key: StructKey{Name: "childfdmap"}}}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "nentries", TypeSize: 8}}, Buf: "map"}, }}, @@ -98,12 +100,14 @@ var syscalls_amd64 = []*Syscall{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "argenv_l", TypeSize: 8}}, Buf: "argenv"}, }}, {NR: 124, Name: "fchdir", CallName: "fchdir", Args: []Type{ + &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4, IsOptional: true}}, &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 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}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "must_use_low", TypeSize: 8}}, Kind: 2, RangeEnd: 1}, }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "ret", TypeSize: 4, ArgDir: 1}}}, {NR: 107, Name: "fcntl$F_GETFD", CallName: "fcntl", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, @@ -121,7 +125,7 @@ var syscalls_amd64 = []*Syscall{ {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, 2048}, BitMask: true}, + &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "fcntl_status", FldName: "flags", TypeSize: 8}}, Vals: []uint64{1024, 2048, 524288, 1048576, 32768}, BitMask: true}, }}, {NR: 107, Name: "fcntl$F_SYNC", CallName: "fcntl", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, @@ -135,7 +139,7 @@ var syscalls_amd64 = []*Syscall{ {NR: 15, Name: "fork", CallName: "fork"}, {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, IsVarlen: true}}}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "statbuf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 120, ArgDir: 1}, Kind: 1, RangeBegin: 120, RangeEnd: 120}}, }}, {NR: 122, Name: "fwstat", CallName: "fwstat", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, @@ -154,7 +158,9 @@ var syscalls_amd64 = []*Syscall{ }}, {NR: 112, Name: "link", CallName: "link", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "old", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "old_l", TypeSize: 8}}, Buf: "old"}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "new", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "new_l", TypeSize: 8}}, Buf: "new"}, }}, {NR: 111, Name: "llseek", CallName: "llseek", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, @@ -164,11 +170,13 @@ var syscalls_amd64 = []*Syscall{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "seek_whence", FldName: "whence", TypeSize: 8}}, Vals: []uint64{0, 1, 2}, BitMask: true}, }}, {NR: 106, Name: "lstat", CallName: "lstat", Args: []Type{ - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "file", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "statbuf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", ArgDir: 1, IsVarlen: true}}}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "path_l", TypeSize: 8}}, Buf: "path"}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "statbuf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 120, ArgDir: 1}, Kind: 1, RangeBegin: 120, RangeEnd: 120}}, }}, {NR: 118, Name: "mkdir", CallName: "mkdir", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "path_l", TypeSize: 8}}, Buf: "path"}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_mode", FldName: "mode", TypeSize: 8}}, Vals: []uint64{256, 128, 64, 32, 16, 8, 4, 2, 1}, BitMask: true}, }}, {NR: 18, Name: "mmap", CallName: "mmap", Args: []Type{ @@ -206,7 +214,7 @@ var syscalls_amd64 = []*Syscall{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "bind_flags", FldName: "lag", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 4, 16}, BitMask: true}, }}, {NR: 25, Name: "notify", CallName: "notify", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "target_pid", TypeSize: 4}}, + &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "target_pid", TypeSize: 4, IsOptional: true}}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "event_type", FldName: "ev_type", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 25, 50}}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "u_msg", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "event_msg"}}}, }}, @@ -217,13 +225,14 @@ var syscalls_amd64 = []*Syscall{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "onto_l", TypeSize: 8}}, Buf: "onto_path"}, }}, {NR: 102, Name: "openat", CallName: "openat", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4, IsOptional: true}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "file", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, - &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{1, 2, 3, 1024, 524288, 64, 65536, 128, 256, 131072, 2048, 4096, 512}}, + &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fromfd", TypeSize: 4, IsOptional: true}}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "path_l", TypeSize: 8}}, Buf: "path"}, + &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_flags", FldName: "oflag", TypeSize: 8}}, Vals: []uint64{1, 2, 3, 1024, 524288, 64, 65536, 128, 256, 131072, 2048, 4096, 512, 1048576, 32768}}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_mode", FldName: "mode", TypeSize: 8}}, Vals: []uint64{256, 128, 64, 32, 16, 8, 4, 2, 1}, BitMask: true}, }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "ret", TypeSize: 4, ArgDir: 1}}}, {NR: 30, Name: "poke_ksched", CallName: "poke_ksched", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "target_pid", TypeSize: 4}}, + &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "target_pid", TypeSize: 4, IsOptional: true}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "res_type", TypeSize: 8}}}, }}, {NR: 37, Name: "pop_ctx", CallName: "pop_ctx", Args: []Type{ @@ -241,17 +250,17 @@ var syscalls_amd64 = []*Syscall{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "flags", TypeSize: 8}}, Kind: 2, RangeEnd: 1}, }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "ret", TypeSize: 4, ArgDir: 1}}}, {NR: 12, Name: "proc_destroy", CallName: "proc_destroy", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4}}, + &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4, IsOptional: true}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "exitcode", TypeSize: 4}}}, }}, {NR: 11, Name: "proc_run", CallName: "proc_run", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4}}, + &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4, IsOptional: true}}, }}, {NR: 13, Name: "proc_yield", CallName: "proc_yield", Args: []Type{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "being_nice", TypeSize: 4}}, Kind: 2, RangeEnd: 1}, }}, {NR: 24, Name: "provision", CallName: "provision", Args: []Type{ - &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "target_pid", TypeSize: 4}}, + &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "target_pid", TypeSize: 4, IsOptional: true}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "res_type", TypeSize: 8}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "res_val", TypeSize: 8}}}, }}, @@ -262,15 +271,19 @@ var syscalls_amd64 = []*Syscall{ }}, {NR: 115, Name: "readlink", CallName: "readlink", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "path_l", TypeSize: 8}}, Buf: "path"}, &PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "buf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "siz", TypeSize: 8}}, Buf: "buf"}, }}, {NR: 123, Name: "rename", CallName: "rename", Args: []Type{ - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "old", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "new", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "old_path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "old_path_l", TypeSize: 8}}, Buf: "old_path"}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "new_path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "new_path_l", TypeSize: 8}}, Buf: "new_path"}, }}, {NR: 119, Name: "rmdir", CallName: "rmdir", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "path_l", TypeSize: 8}}, Buf: "path"}, }}, {NR: 26, Name: "self_notify", CallName: "self_notify", Args: []Type{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "vcoreid", TypeSize: 4}}}, @@ -284,12 +297,15 @@ var syscalls_amd64 = []*Syscall{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "vcoreid", TypeSize: 4}}}, }}, {NR: 105, Name: "stat", CallName: "stat", Args: []Type{ - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "file", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, - &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "statbuf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", ArgDir: 1, IsVarlen: true}}}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "path_l", TypeSize: 8}}, Buf: "path"}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "statbuf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", TypeSize: 120, ArgDir: 1}, Kind: 1, RangeBegin: 120, RangeEnd: 120}}, }}, {NR: 114, Name: "symlink", CallName: "symlink", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "old", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "old_l", TypeSize: 8}}, Buf: "old"}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "new", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "new_l", TypeSize: 8}}, Buf: "new"}, }}, {NR: 126, Name: "tap_fds", CallName: "tap_fds", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "tap_reqs", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}, Type: &StructType{Key: StructKey{Name: "fd_tap_req"}}}}, @@ -304,6 +320,7 @@ var syscalls_amd64 = []*Syscall{ }}, {NR: 113, Name: "unlink", CallName: "unlink", Args: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, + &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "path_l", TypeSize: 8}}, Buf: "path"}, }}, {NR: 35, Name: "vc_entry", CallName: "vc_entry"}, {NR: 34, Name: "vmm_add_gpcs", CallName: "vmm_add_gpcs", Args: []Type{ @@ -383,6 +400,7 @@ var consts_amd64 = []ConstValue{ {Name: "F_SETFD", Value: 2}, {Name: "F_SETFL", Value: 4}, {Name: "F_SYNC", Value: 101}, + {Name: "KSTAT_SIZE", Value: 120}, {Name: "MAFTER", Value: 2}, {Name: "MAP_ANONYMOUS", Value: 32}, {Name: "MAP_DENYWRITE", Value: 2048}, @@ -410,8 +428,10 @@ var consts_amd64 = []ConstValue{ {Name: "O_NOCTTY", Value: 256}, {Name: "O_NOFOLLOW", Value: 131072}, {Name: "O_NONBLOCK", Value: 2048}, + {Name: "O_PATH", Value: 32768}, {Name: "O_RDONLY", Value: 1}, {Name: "O_RDWR", Value: 3}, + {Name: "O_REMCLO", Value: 1048576}, {Name: "O_SYNC", Value: 4096}, {Name: "O_TRUNC", Value: 512}, {Name: "O_WRONLY", Value: 2}, @@ -508,4 +528,4 @@ var consts_amd64 = []ConstValue{ {Name: "WUNTRACED", Value: 2}, } -const revision_amd64 = "687c84c69215ebd90b47978898d8133e3aa86cbe" +const revision_amd64 = "a10d041f1676f50456445d56c1fb505d7b8d5cef" diff --git a/sys/akaros/sys.txt b/sys/akaros/sys.txt index 0e1f473b..07fe3609 100644 --- a/sys/akaros/sys.txt +++ b/sys/akaros/sys.txt @@ -16,27 +16,27 @@ include resource fd[int32]: 0xffffffffffffffff, AT_FDCWD resource pid[int32]: 0, 0xffffffffffffffff -openat(fd fd[opt], file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd +openat(fromfd fd[opt], path ptr[in, filename], path_l len[path], oflag 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]]) +stat(path ptr[in, filename], path_l len[path], statbuf ptr[out, array[int8, KSTAT_SIZE]]) +fstat(fd fd, statbuf ptr[out, array[int8, KSTAT_SIZE]]) +lstat(path ptr[in, filename], path_l len[path], statbuf ptr[out, array[int8, KSTAT_SIZE]]) 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) +link(old ptr[in, filename], old_l len[old], new ptr[in, filename], new_l len[new]) +unlink(path ptr[in, filename], path_l len[path]) +symlink(old ptr[in, filename], old_l len[old], new ptr[in, filename], new_l len[new]) +readlink(path ptr[in, filename], path_l len[path], buf buffer[out], siz len[buf]) +chdir(pid pid[opt], path ptr[in, filename], path_l len[path]) +fchdir(pid pid[opt], 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]) +rename(old_path ptr[in, filename], old_path_l len[old_path], new_path ptr[in, filename], new_path_l len[new_path]) +mkdir(path ptr[in, filename], path_l len[path], mode flags[open_mode]) +rmdir(path ptr[in, filename], path_l len[path]) -fcntl$F_DUPFD(fd fd, cmd const[F_DUPFD], arg fd) fd +fcntl$F_DUPFD(fd fd, cmd const[F_DUPFD], arg fd, must_use_low boolptr) 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]) @@ -51,13 +51,13 @@ 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, O_CLOEXEC, O_CREAT, O_DIRECTORY, O_EXCL, O_NOCTTY, O_NOFOLLOW, O_NONBLOCK, O_SYNC, O_TRUNC +open_flags = O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, O_CLOEXEC, O_CREAT, O_DIRECTORY, O_EXCL, O_NOCTTY, O_NOFOLLOW, O_NONBLOCK, O_SYNC, O_TRUNC, O_REMCLO, O_PATH 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_ANONYMOUS, MAP_DENYWRITE, MAP_EXECUTABLE, MAP_FIXED, MAP_GROWSDOWN, MAP_LOCKED, MAP_NONBLOCK, MAP_NORESERVE, MAP_POPULATE, MAP_STACK wait_options = WNOHANG, WUNTRACED fcntl_flags = FD_CLOEXEC -fcntl_status = O_APPEND, O_NONBLOCK +fcntl_status = O_APPEND, O_NONBLOCK, O_CLOEXEC, O_REMCLO, O_PATH seek_whence = SEEK_SET, SEEK_CUR, SEEK_END timespec { @@ -70,17 +70,17 @@ cache_invalidate() getpcoreid() getvcoreid() proc_create(path ptr[in, filename], path_l len[path], argenv ptr[in, string], argenv_l len[argenv], flags boolptr) pid -proc_run(pid pid) -proc_destroy(pid pid, exitcode int32) +proc_run(pid pid[opt]) +proc_destroy(pid pid[opt], exitcode int32) proc_yield(being_nice bool32) change_vcore(vcoreid int32, enable_my_notif bool32) exec(path ptr[in, filename], path_l len[path], argenv ptr[in, string], argenv_l len[argenv]) -provision(target_pid pid, res_type const[RES_CORES], res_val intptr) -notify(target_pid pid, ev_type flags[event_type], u_msg ptr[in, event_msg]) +provision(target_pid pid[opt], res_type const[RES_CORES], res_val intptr) +notify(target_pid pid[opt], ev_type flags[event_type], u_msg ptr[in, event_msg]) self_notify(vcoreid int32, ev_type flags[event_type], u_msg ptr[in, event_msg], priv bool32) halt_core(usec intptr) change_to_m() -poke_ksched(target_pid pid, res_type const[0]) +poke_ksched(target_pid pid[opt], res_type const[0]) abort_sysc(syscall intptr) populate_va(va vma, nr_pgs intptr) vmm_add_gpcs(nr_more_gpcs intptr, gpcis ptr[in, vmm_gpcore_init]) @@ -92,7 +92,7 @@ access(path ptr[in, filename], path_l len[path], mode flags[open_mode]) umask(mask int32) wstat(path ptr[in, filename], path_l len[path], stat_m ptr[out, array[int8]], stat_sz bytesize[stat_m], flags const[0]) fwstat(fd fd, stat_m ptr[out, array[int8]], stat_sz bytesize[stat_m], flags const[0]) -dup_fds_to(pid pid, map ptr[in, array[childfdmap]], nentries len[map]) +dup_fds_to(pid pid[opt], map ptr[in, array[childfdmap]], nentries len[map]) tap_fds(tap_reqs ptr[in, array[fd_tap_req]], nr_reqs len[tap_reqs]) tcgetattr(fd fd, termios_p ptr[out, array[int8, TERMIOS_SIZE]]) nbind(src_path ptr[in, filename], src_l len[src_path], onto_path ptr[in, filename], onto_l len[onto_path], flag flags[bind_flags]) @@ -166,6 +166,7 @@ type user_context array[int8, USER_CONTEXT_SIZE] define USER_CONTEXT_SIZE sizeof(struct user_context) define TERMIOS_SIZE sizeof(struct termios) define EVENT_MBOX_SIZE sizeof(struct event_mbox) +define KSTAT_SIZE sizeof(struct kstat) event_type = EV_NONE, EV_PREEMPT_PENDING, EV_GANG_PREMPT_PENDING, EV_VCORE_PREEMPT, EV_GANG_RETURN, EV_USER_IPI, EV_PAGE_FAULT, EV_ALARM, EV_EVENT, EV_FREE_APPLE_PIE, EV_SYSCALL, EV_CHECK_MSGS, EV_POSIX_SIGNAL, NR_EVENT_TYPES, MAX_NR_EVENT diff --git a/sys/akaros/sys_amd64.const b/sys/akaros/sys_amd64.const index 5663e554..c101f8a9 100644 --- a/sys/akaros/sys_amd64.const +++ b/sys/akaros/sys_amd64.const @@ -35,6 +35,7 @@ F_GETFL = 3 F_SETFD = 2 F_SETFL = 4 F_SYNC = 101 +KSTAT_SIZE = 120 MAFTER = 2 MAP_ANONYMOUS = 32 MAP_DENYWRITE = 2048 @@ -62,8 +63,10 @@ O_EXCL = 128 O_NOCTTY = 256 O_NOFOLLOW = 131072 O_NONBLOCK = 2048 +O_PATH = 32768 O_RDONLY = 1 O_RDWR = 3 +O_REMCLO = 1048576 O_SYNC = 4096 O_TRUNC = 512 O_WRONLY = 2