Skip to content
Permalink
Browse files

sys/netbsd: Add new syscalls exit and ptrace

  • Loading branch information...
R3x authored and dvyukov committed Jun 26, 2019
1 parent 0a8d1a9 commit c0d1d69763c1595166d593a26fa6e1764c2df830
Showing with 21 additions and 2 deletions.
  1. +1 −1 executor/defs.h
  2. +2 −0 executor/syscalls.h
  3. +12 −1 sys/netbsd/gen/amd64.go
  4. +4 −0 sys/netbsd/sys.txt
  5. +2 −0 sys/netbsd/sys_amd64.const
@@ -125,7 +125,7 @@

#if GOARCH_amd64
#define GOARCH "amd64"
#define SYZ_REVISION "db1d9602f5022150750b100d946feef07e2446c4"
#define SYZ_REVISION "96be9781647711050e565dac893dacbf183be15d"
#define SYZ_EXECUTOR_USES_FORK_SERVER 1
#define SYZ_EXECUTOR_USES_SHMEM 1
#define SYZ_PAGE_SIZE 4096
{"dup", 41},
{"dup2", 90},
{"execve", 59},
{"exit", 1},
{"faccessat", 462},
{"fchdir", 13},
{"fchmod", 124},
{"pipe2", 453},
{"poll", 209},
{"preadv", 289},
{"ptrace", 26},
{"pwritev", 290},
{"read", 3},
{"readlink", 58},
@@ -470,6 +470,9 @@ var syscalls_amd64 = []*Syscall{
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "argv", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}, Type: &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", TypeSize: 8}, 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: &PtrType{TypeCommon: TypeCommon{TypeName: "ptr", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", IsVarlen: true}, Kind: 2}}}},
}},
{NR: 1, Name: "exit", CallName: "exit", Args: []Type{
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "code", TypeSize: 8}}},
}},
{NR: 462, Name: "faccessat", CallName: "faccessat", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd_dir", FldName: "dirfd", TypeSize: 4}},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "pathname", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}},
@@ -844,6 +847,12 @@ var syscalls_amd64 = []*Syscall{
&LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "vlen", TypeSize: 8}}, Path: []string{"vec"}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "fileoff", FldName: "off", TypeSize: 8}}, Kind: 1},
}},
{NR: 26, Name: "ptrace", CallName: "ptrace", Args: []Type{
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "request", TypeSize: 8}}},
&ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4}},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "addr", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", TypeSize: 8, ArgDir: 1}}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "intptr", FldName: "data", TypeSize: 8}}},
}},
{NR: 290, Name: "pwritev", CallName: "pwritev", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "vec", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}, Type: &StructType{Key: StructKey{Name: "iovec_in"}}}},
@@ -1510,6 +1519,7 @@ var consts_amd64 = []ConstValue{
{Name: "SYS_dup", Value: 41},
{Name: "SYS_dup2", Value: 90},
{Name: "SYS_execve", Value: 59},
{Name: "SYS_exit", Value: 1},
{Name: "SYS_faccessat", Value: 462},
{Name: "SYS_fchdir", Value: 13},
{Name: "SYS_fchmod", Value: 124},
@@ -1569,6 +1579,7 @@ var consts_amd64 = []ConstValue{
{Name: "SYS_pipe2", Value: 453},
{Name: "SYS_poll", Value: 209},
{Name: "SYS_preadv", Value: 289},
{Name: "SYS_ptrace", Value: 26},
{Name: "SYS_pwritev", Value: 290},
{Name: "SYS_read", Value: 3},
{Name: "SYS_readlink", Value: 58},
@@ -1641,4 +1652,4 @@ var consts_amd64 = []ConstValue{
{Name: "WUNTRACED", Value: 2},
}

const revision_amd64 = "db1d9602f5022150750b100d946feef07e2446c4"
const revision_amd64 = "96be9781647711050e565dac893dacbf183be15d"
@@ -15,6 +15,7 @@ include <sys/resource.h>
include <time.h>
include <signal.h>
include <sys/wait.h>
include <sys/ptrace.h>

syz_execute_func(text ptr[in, text[target]])

@@ -108,6 +109,9 @@ getitimer(which flags[getitimer_which], cur ptr[out, itimerval])
setitimer(which flags[getitimer_which], new ptr[in, itimerval], old ptr[out, itimerval, opt])
wait4(pid pid, status ptr[out, int32, opt], options flags[wait_options], ru ptr[out, rusage, opt])

exit(code intptr)
ptrace(request intptr, pid pid, addr ptr[out, intptr], data intptr)

pollfd {
fd fd
events flags[pollfd_events, int16]
@@ -72,6 +72,7 @@ SYS_clock_gettime = 427
SYS_clock_nanosleep = 477
SYS_clock_settime = 428
SYS_execve = 59
SYS_exit = 1
SYS_faccessat = 462
SYS_fchdir = 13
SYS_fchmod = 124
@@ -109,6 +110,7 @@ SYS_mknodat = 460
SYS_nanosleep = 430
SYS_pipe = 42
SYS_poll = 209
SYS_ptrace = 26
SYS_readlink = 58
SYS_readlinkat = 469
SYS_rename = 128

0 comments on commit c0d1d69

Please sign in to comment.
You can’t perform that action at this time.