diff options
| -rw-r--r-- | executor/common_bsd | bin | 0 -> 720332 bytes | |||
| -rw-r--r-- | executor/defs.h | 2 | ||||
| -rw-r--r-- | executor/syscalls.h | 3 | ||||
| -rw-r--r-- | sys/netbsd/gen/amd64.go | 58 | ||||
| -rw-r--r-- | sys/netbsd/sys.txt | 45 | ||||
| -rw-r--r-- | sys/netbsd/sys_amd64.const | 12 |
6 files changed, 118 insertions, 2 deletions
diff --git a/executor/common_bsd b/executor/common_bsd Binary files differnew file mode 100644 index 000000000..e05be7292 --- /dev/null +++ b/executor/common_bsd diff --git a/executor/defs.h b/executor/defs.h index a7ca1b7c0..332a8a477 100644 --- a/executor/defs.h +++ b/executor/defs.h @@ -125,7 +125,7 @@ #if GOARCH_amd64 #define GOARCH "amd64" -#define SYZ_REVISION "b6416c3989d53e293342b0c671fdfa10fb72463f" +#define SYZ_REVISION "49e283b548f639c19dd9a36c2985100da8d35119" #define SYZ_EXECUTOR_USES_FORK_SERVER 1 #define SYZ_EXECUTOR_USES_SHMEM 1 #define SYZ_PAGE_SIZE 4096 diff --git a/executor/syscalls.h b/executor/syscalls.h index 05580e4e1..a4245cc13 100644 --- a/executor/syscalls.h +++ b/executor/syscalls.h @@ -17120,6 +17120,7 @@ const call_t syscalls[] = { {"fcntl$setstatus", 92}, {"fdatasync", 241}, {"flock", 131}, + {"fork", 2}, {"fsync", 95}, {"ftruncate", 201}, {"getdents", 390}, @@ -17185,6 +17186,7 @@ const call_t syscalls[] = { {"pipe", 42}, {"pipe2", 453}, {"poll", 209}, + {"posix_spawn", 474}, {"pread", 173}, {"preadv", 289}, {"ptrace", 26}, @@ -17270,6 +17272,7 @@ const call_t syscalls[] = { {"unlinkat", 471}, {"utimensat", 467}, {"utimes", 420}, + {"vfork", 66}, {"wait4", 449}, {"write", 4}, {"writev", 121}, diff --git a/sys/netbsd/gen/amd64.go b/sys/netbsd/gen/amd64.go index 0cc6266ca..3bfff4d7c 100644 --- a/sys/netbsd/gen/amd64.go +++ b/sys/netbsd/gen/amd64.go @@ -56,6 +56,13 @@ var structDescs_amd64 = []*KeyedStruct{ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 4}}, Val: 1}, &ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "fds", IsVarlen: true}, Type: &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", TypeSize: 4}}}, }, AlignAttr: 8}}, + {Key: StructKey{Name: "dup2_t"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "dup2_t", TypeSize: 4}, Fields: []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "newfildes", TypeSize: 4}}}, + }}}, + {Key: StructKey{Name: "fae_data_t"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "fae_data_t", TypeSize: 16}, Fields: []Type{ + &StructType{Key: StructKey{Name: "open_t"}, FldName: "open"}, + &StructType{Key: StructKey{Name: "dup2_t"}, FldName: "dup2"}, + }}}, {Key: StructKey{Name: "fd_set", Dir: 2}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "fd_set", TypeSize: 64, ArgDir: 2}, Fields: []Type{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "mask0", TypeSize: 8, ArgDir: 2}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "mask1", TypeSize: 8, ArgDir: 2}}}, @@ -168,6 +175,11 @@ var structDescs_amd64 = []*KeyedStruct{ &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "pad0", TypeSize: 8}}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "pad1", TypeSize: 8}}}, }}}, + {Key: StructKey{Name: "open_t"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "open_t", TypeSize: 16}, Fields: []Type{ + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", IsVarlen: true}, Kind: 2}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "oflag", TypeSize: 4}}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "mode", TypeSize: 4}}}, + }}}, {Key: StructKey{Name: "pipefd", Dir: 1}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "pipefd", TypeSize: 8, ArgDir: 1}, Fields: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "rfd", TypeSize: 4, ArgDir: 1}}, &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "wfd", TypeSize: 4, ArgDir: 1}}, @@ -177,6 +189,25 @@ var structDescs_amd64 = []*KeyedStruct{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pollfd_events", FldName: "events", TypeSize: 2}}, Vals: []uint64{1, 2, 4, 8, 16, 32, 64, 128, 4, 256}}, &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "revents", TypeSize: 2}}}, }}}, + {Key: StructKey{Name: "posix_spawn_file_actions"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "posix_spawn_file_actions", TypeSize: 16}, Fields: []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "size", TypeSize: 4}}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "len", TypeSize: 4}}}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "fae", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "posix_spawn_file_actions_entry"}}}, + }}}, + {Key: StructKey{Name: "posix_spawn_file_actions_entry"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "posix_spawn_file_actions_entry", TypeSize: 24}, Fields: []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "fae_action", TypeSize: 4}}}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "fae_filedes", TypeSize: 4}}}, + &UnionType{Key: StructKey{Name: "fae_data_t"}, FldName: "fae_data"}, + }}}, + {Key: StructKey{Name: "posix_spawnattr"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "posix_spawnattr", TypeSize: 48}, Fields: []Type{ + &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sa_flags", FldName: "sa_flags", TypeSize: 2}}, Vals: []uint64{1, 2, 4, 16, 8, 32, 64, 128, 255}}, + &ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 2}}, IsPad: true}, + &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "sa_pgroup", TypeSize: 4}}, + &StructType{Key: StructKey{Name: "sched_param"}, FldName: "sa_schedparam"}, + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "sa_schedpolicy", TypeSize: 4}}}, + &StructType{Key: StructKey{Name: "sigset_t"}, FldName: "sa_sigdefault"}, + &StructType{Key: StructKey{Name: "sigset_t"}, FldName: "sa_sigmask"}, + }}}, {Key: StructKey{Name: "recv_msghdr", Dir: 2}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "recv_msghdr", TypeSize: 56, ArgDir: 2}, Fields: []Type{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "msg_name", TypeSize: 8, IsOptional: true}, Type: &UnionType{Key: StructKey{Name: "sockaddr_storage", Dir: 1}}}, &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "msg_namelen", TypeSize: 4, ArgDir: 2}}, Path: []string{"msg_name"}}, @@ -214,6 +245,9 @@ var structDescs_amd64 = []*KeyedStruct{ &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "nvcsw", TypeSize: 8, ArgDir: 1}}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "nivcsw", TypeSize: 8, ArgDir: 1}}}, }}}, + {Key: StructKey{Name: "sched_param"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "sched_param", TypeSize: 4}, Fields: []Type{ + &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "sched_priority", TypeSize: 4}}}, + }}}, {Key: StructKey{Name: "sembuf"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "sembuf", TypeSize: 6}, Fields: []Type{ &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "num", TypeSize: 2}}, Vals: []uint64{0, 1, 2, 3, 4}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "op", TypeSize: 2}}}, @@ -642,6 +676,7 @@ var syscalls_amd64 = []*Syscall{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, &FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "flock_op", FldName: "op", TypeSize: 8}}, Vals: []uint64{1, 2, 8, 4}, BitMask: true}, }}, + {NR: 2, Name: "fork", CallName: "fork", Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "ret", TypeSize: 4, ArgDir: 1}}}, {NR: 95, Name: "fsync", CallName: "fsync", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, }}, @@ -936,6 +971,14 @@ var syscalls_amd64 = []*Syscall{ &LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "nfds", TypeSize: 8}}, Path: []string{"fds"}}, &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "timeout", TypeSize: 4}}}, }}, + {NR: 474, Name: "posix_spawn", CallName: "posix_spawn", Args: []Type{ + &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4}}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", IsVarlen: true}, Kind: 2}}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "file_actions", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "posix_spawn_file_actions"}}}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "attrp", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "posix_spawnattr"}}}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "argv", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", IsVarlen: true}, Kind: 2}}}, + &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "envp", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", IsVarlen: true}, Kind: 2}}}, + }, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "ret", TypeSize: 4, ArgDir: 1}}}, {NR: 173, Name: "pread", CallName: "pread", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "buf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}}}, @@ -1391,6 +1434,7 @@ var syscalls_amd64 = []*Syscall{ &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "filename", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "times", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "itimerval"}}}, }}, + {NR: 66, Name: "vfork", CallName: "vfork", Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "ret", TypeSize: 4, ArgDir: 1}}}, {NR: 449, Name: "wait4", CallName: "wait4", Args: []Type{ &ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4}}, &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "status", TypeSize: 8, IsOptional: true}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4, ArgDir: 1}}}}, @@ -1592,6 +1636,15 @@ var consts_amd64 = []ConstValue{ {Name: "RLIMIT_STACK", Value: 3}, {Name: "RUSAGE_CHILDREN", Value: 18446744073709551615}, {Name: "RUSAGE_SELF"}, + {Name: "SA_ALLBITS", Value: 255}, + {Name: "SA_NOCLDSTOP", Value: 8}, + {Name: "SA_NOCLDWAIT", Value: 32}, + {Name: "SA_NODEFER", Value: 16}, + {Name: "SA_NOKERNINFO", Value: 128}, + {Name: "SA_ONSTACK", Value: 1}, + {Name: "SA_RESETHAND", Value: 4}, + {Name: "SA_RESTART", Value: 2}, + {Name: "SA_SIGINFO", Value: 64}, {Name: "SCM_RIGHTS", Value: 1}, {Name: "SEEK_CUR", Value: 1}, {Name: "SEEK_END", Value: 2}, @@ -1681,6 +1734,7 @@ var consts_amd64 = []ConstValue{ {Name: "SYS_fcntl", Value: 92}, {Name: "SYS_fdatasync", Value: 241}, {Name: "SYS_flock", Value: 131}, + {Name: "SYS_fork", Value: 2}, {Name: "SYS_fsync", Value: 95}, {Name: "SYS_ftruncate", Value: 201}, {Name: "SYS_getdents", Value: 390}, @@ -1729,6 +1783,7 @@ var consts_amd64 = []ConstValue{ {Name: "SYS_pipe", Value: 42}, {Name: "SYS_pipe2", Value: 453}, {Name: "SYS_poll", Value: 209}, + {Name: "SYS_posix_spawn", Value: 474}, {Name: "SYS_pread", Value: 173}, {Name: "SYS_preadv", Value: 289}, {Name: "SYS_ptrace", Value: 26}, @@ -1776,6 +1831,7 @@ var consts_amd64 = []ConstValue{ {Name: "SYS_unlinkat", Value: 471}, {Name: "SYS_utimensat", Value: 467}, {Name: "SYS_utimes", Value: 420}, + {Name: "SYS_vfork", Value: 66}, {Name: "SYS_wait4", Value: 449}, {Name: "SYS_write", Value: 4}, {Name: "SYS_writev", Value: 121}, @@ -1810,4 +1866,4 @@ var consts_amd64 = []ConstValue{ {Name: "_UC_STACK", Value: 2}, } -const revision_amd64 = "b6416c3989d53e293342b0c671fdfa10fb72463f" +const revision_amd64 = "49e283b548f639c19dd9a36c2985100da8d35119" diff --git a/sys/netbsd/sys.txt b/sys/netbsd/sys.txt index a394317c0..df77c5339 100644 --- a/sys/netbsd/sys.txt +++ b/sys/netbsd/sys.txt @@ -17,6 +17,7 @@ include <signal.h> include <sys/wait.h> include <sys/ptrace.h> include <sys/sched.h> +include <sys/signal.h> syz_execute_func(text ptr[in, text[target]]) @@ -113,6 +114,9 @@ wait4(pid pid, status ptr[out, int32, opt], options flags[wait_options], ru ptr[ exit(code intptr) ptrace(request intptr, pid pid, addr ptr[out, intptr], data intptr) __clone(flags flags[clone_flags], sp buffer[in]) pid +fork() pid +vfork() pid +posix_spawn(pid pid, path ptr[in, string], file_actions ptr[in, posix_spawn_file_actions], attrp ptr[in, posix_spawnattr], argv ptr[in, array[string]], envp ptr[in, array[string]]) pid pollfd { fd fd @@ -190,6 +194,46 @@ ucred { gid gid } +posix_spawn_file_actions { + size int32 + len int32 + fae ptr[in, posix_spawn_file_actions_entry] +} + +posix_spawn_file_actions_entry { + fae_action int32 + fae_filedes int32 + fae_data fae_data_t +} + +fae_data_t [ + open open_t + dup2 dup2_t +] + +open_t { + path ptr[in, string] + oflag int32 + mode int32 +} + +dup2_t { + newfildes int32 +} + +posix_spawnattr { + sa_flags flags[sa_flags, int16] + sa_pgroup pid + sa_schedparam sched_param + sa_schedpolicy int32 + sa_sigdefault sigset_t + sa_sigmask sigset_t +} + +sched_param { + sched_priority int32 +} + pollfd_events = POLLIN, POLLPRI, POLLOUT, POLLERR, POLLHUP, POLLNVAL, POLLRDNORM, POLLRDBAND, POLLWRNORM, POLLWRBAND mknod_mode = S_IFREG, S_IFCHR, S_IFBLK, S_IFIFO, S_IFSOCK, S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IWGRP, S_IXGRP, S_IROTH, S_IWOTH, S_IXOTH at_flags = AT_SYMLINK_NOFOLLOW, AT_SYMLINK_FOLLOW @@ -211,3 +255,4 @@ fcntl_flags = FD_CLOEXEC fcntl_status = O_APPEND, O_ASYNC, O_NONBLOCK, O_DSYNC, O_RSYNC, O_ALT_IO, O_DIRECT, O_NOSIGPIPE flock_type = F_RDLCK, F_WRLCK, F_UNLCK clone_flags = CLONE_CSIGNAL, CLONE_VM, CLONE_FS, CLONE_FILES, CLONE_SIGHAND, CLONE_PID, CLONE_PTRACE, CLONE_VFORK +sa_flags = SA_ONSTACK, SA_RESTART, SA_RESETHAND, SA_NODEFER, SA_NOCLDSTOP, SA_NOCLDWAIT, SA_SIGINFO, SA_NOKERNINFO, SA_ALLBITS diff --git a/sys/netbsd/sys_amd64.const b/sys/netbsd/sys_amd64.const index 4118cbb34..af006dda2 100644 --- a/sys/netbsd/sys_amd64.const +++ b/sys/netbsd/sys_amd64.const @@ -71,6 +71,15 @@ RLIMIT_RSS = 5 RLIMIT_STACK = 3 RUSAGE_CHILDREN = 18446744073709551615 RUSAGE_SELF = 0 +SA_ALLBITS = 255 +SA_NOCLDSTOP = 8 +SA_NOCLDWAIT = 32 +SA_NODEFER = 16 +SA_NOKERNINFO = 128 +SA_ONSTACK = 1 +SA_RESETHAND = 4 +SA_RESTART = 2 +SA_SIGINFO = 64 SYS___clone = 287 SYS_chdir = 12 SYS_chmod = 15 @@ -92,6 +101,7 @@ SYS_fchroot = 297 SYS_fcntl = 92 SYS_fdatasync = 241 SYS_flock = 131 +SYS_fork = 2 SYS_fsync = 95 SYS_ftruncate = 201 SYS_getdents = 390 @@ -119,6 +129,7 @@ SYS_mknodat = 460 SYS_nanosleep = 430 SYS_pipe = 42 SYS_poll = 209 +SYS_posix_spawn = 474 SYS_ptrace = 26 SYS_readlink = 58 SYS_readlinkat = 469 @@ -145,6 +156,7 @@ SYS_unlink = 10 SYS_unlinkat = 471 SYS_utimensat = 467 SYS_utimes = 420 +SYS_vfork = 66 SYS_wait4 = 449 S_IFBLK = 24576 S_IFCHR = 8192 |
