sys/freebsd: avoid mangling syscall names

syz-extract was removing certain prefixes from syscall names, but this
caused some problems:
- freebsd* prefixes are for compatibility syscalls when the syscall ABI
  has changed.  For instance, we have both fstat() and
  freebsd11_fstat(), and it is desirable to fuzz them both.
- Stripping prefixes may leave us with undefined SYS_ constants.  This
  resulted in some test failures in pkg/csource, which emitted code
  referencing SYS_semctl when it should have been SYS___semctl.

Fix the problem by updating syscall descriptions to match the names
given by the FreeBSD kernel.  Add some new descriptions for
compatibility syscalls, fix the mknodat() description (dev_t is now 64
bits wide on FreeBSD), and remove mknod$loop, which appears to be
Linux-specific.
This commit is contained in:
Mark Johnston 2019-03-06 20:29:33 -05:00 committed by Dmitry Vyukov
parent c08c1cd05c
commit 4fc2fa55ac
10 changed files with 257 additions and 231 deletions

View File

@ -20,7 +20,7 @@
#if GOARCH_amd64
#define GOARCH "amd64"
#define SYZ_REVISION "87222f38848c14df07a6a0304da0b1915e3396bb"
#define SYZ_REVISION "873616249e74ae100e93afb6a14e4fef92b3acc4"
#define SYZ_EXECUTOR_USES_FORK_SERVER 1
#define SYZ_EXECUTOR_USES_SHMEM 1
#define SYZ_PAGE_SIZE 4096

View File

@ -226,6 +226,20 @@ const call_t syscalls[] = {
#if GOARCH_amd64
const call_t syscalls[] = {
{"__getcwd", 326},
{"__semctl$GETALL", 510},
{"__semctl$GETNCNT", 510},
{"__semctl$GETPID", 510},
{"__semctl$GETVAL", 510},
{"__semctl$GETZCNT", 510},
{"__semctl$IPC_INFO", 510},
{"__semctl$IPC_RMID", 510},
{"__semctl$IPC_SET", 510},
{"__semctl$IPC_STAT", 510},
{"__semctl$SEM_INFO", 510},
{"__semctl$SEM_STAT", 510},
{"__semctl$SETALL", 510},
{"__semctl$SETVAL", 510},
{"accept", 30},
{"accept$inet", 30},
{"accept$inet6", 30},
@ -270,12 +284,17 @@ const call_t syscalls[] = {
{"fcntl$setstatus", 92},
{"fdatasync", 550},
{"flock", 131},
{"freebsd10_pipe", 42},
{"freebsd11_fstat", 189},
{"freebsd11_getdents", 272},
{"freebsd11_lstat", 190},
{"freebsd11_mknod", 14},
{"freebsd11_mknodat", 498},
{"freebsd11_stat", 188},
{"fstat", 551},
{"fsync", 95},
{"ftruncate", 480},
{"futimesat", 494},
{"getcwd", 326},
{"getdents", 272},
{"getegid", 43},
{"geteuid", 25},
{"getgid", 47},
@ -409,13 +428,10 @@ const call_t syscalls[] = {
{"linkat", 495},
{"listen", 106},
{"lseek", 478},
{"lstat", 190},
{"madvise", 75},
{"mincore", 78},
{"mkdir", 136},
{"mkdirat", 496},
{"mknod", 14},
{"mknod$loop", 14},
{"mknodat", 559},
{"mlock", 203},
{"mlockall", 324},
@ -437,7 +453,6 @@ const call_t syscalls[] = {
{"open", 5},
{"open$dir", 5},
{"openat", 499},
{"pipe", 42},
{"pipe2", 542},
{"poll", 209},
{"ppoll", 545},
@ -456,19 +471,6 @@ const call_t syscalls[] = {
{"renameat", 501},
{"rmdir", 137},
{"select", 93},
{"semctl$GETALL", 510},
{"semctl$GETNCNT", 510},
{"semctl$GETPID", 510},
{"semctl$GETVAL", 510},
{"semctl$GETZCNT", 510},
{"semctl$IPC_INFO", 510},
{"semctl$IPC_RMID", 510},
{"semctl$IPC_SET", 510},
{"semctl$IPC_STAT", 510},
{"semctl$SEM_INFO", 510},
{"semctl$SEM_STAT", 510},
{"semctl$SETALL", 510},
{"semctl$SETVAL", 510},
{"semget", 221},
{"semget$private", 221},
{"semop", 222},
@ -647,7 +649,6 @@ const call_t syscalls[] = {
{"socket$unix", 97},
{"socketpair", 135},
{"socketpair$unix", 135},
{"stat", 188},
{"symlink", 57},
{"symlinkat", 502},
{"sync", 36},

View File

@ -145,6 +145,29 @@ var structDescs_amd64 = []*KeyedStruct{
&ResourceType{TypeCommon: TypeCommon{TypeName: "pid", FldName: "pid", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 4}}, IsPad: true},
}}},
{Key: StructKey{Name: "freebsd11_stat", Dir: 1}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "freebsd11_stat", TypeSize: 120, ArgDir: 1}, Fields: []Type{
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "dev", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "ino", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "mode", TypeSize: 2, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "nlink", TypeSize: 2, ArgDir: 1}}},
&ResourceType{TypeCommon: TypeCommon{TypeName: "uid", FldName: "uid", TypeSize: 4, ArgDir: 1}},
&ResourceType{TypeCommon: TypeCommon{TypeName: "gid", FldName: "gid", TypeSize: 4, ArgDir: 1}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "rdev", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "atime", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "ansec", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "mtime", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "mnsec", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "ctime", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "cnsec", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "size", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "blocks", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "blksize", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "flags", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "gen", TypeSize: 4, ArgDir: 1}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "__spare", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "btime", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "bnsec", TypeSize: 8, ArgDir: 1}}},
}}},
{Key: StructKey{Name: "group_req_in"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "group_req_in", TypeSize: 144}, Fields: []Type{
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "gr_interface", TypeSize: 4}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 4}}, IsPad: true},
@ -948,27 +971,30 @@ var structDescs_amd64 = []*KeyedStruct{
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "unix_socket_family", FldName: "family", TypeSize: 2, ArgDir: 1}}, Vals: []uint64{1, 0}, BitMask: true},
&BufferType{TypeCommon: TypeCommon{TypeName: "filename", FldName: "path", ArgDir: 1, IsVarlen: true}, Kind: 3},
}}},
{Key: StructKey{Name: "stat", Dir: 1}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "stat", TypeSize: 68, ArgDir: 1}, Fields: []Type{
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "dev", TypeSize: 2, ArgDir: 1}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 2}}, IsPad: true},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "ino", TypeSize: 4, ArgDir: 1}}},
{Key: StructKey{Name: "stat", Dir: 1}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "stat", TypeSize: 224, ArgDir: 1}, Fields: []Type{
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "dev", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "ino", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "nlink", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "mode", TypeSize: 2, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "nlink", TypeSize: 2, ArgDir: 1}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "__pad0", TypeSize: 2, ArgDir: 1}}},
&ResourceType{TypeCommon: TypeCommon{TypeName: "uid", FldName: "uid", TypeSize: 4, ArgDir: 1}},
&ResourceType{TypeCommon: TypeCommon{TypeName: "gid", FldName: "gid", TypeSize: 4, ArgDir: 1}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", FldName: "rdev", TypeSize: 2, ArgDir: 1}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pad", TypeSize: 2}}, IsPad: true},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "size", TypeSize: 4, ArgDir: 1}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "__pad1", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "rdev", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "atime", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "ansec", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "mtime", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "mnsec", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "ctime", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "cnsec", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "btime", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "bnsec", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "size", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "blocks", TypeSize: 8, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "blksize", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "blocks", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "atime", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "ansec", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "mtime", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "mnsec", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "ctime", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "cnsec", TypeSize: 4, ArgDir: 1}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "pad1", TypeSize: 4, ArgDir: 1}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "pad2", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "flags", TypeSize: 4, ArgDir: 1}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "gen", TypeSize: 8, ArgDir: 1}}},
&ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "__spare", TypeSize: 80, ArgDir: 1}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", TypeSize: 8, ArgDir: 1}}}, Kind: 1, RangeBegin: 10, RangeEnd: 10},
}}},
{Key: StructKey{Name: "tcp_fastopen"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "tcp_fastopen", TypeSize: 20}, Fields: []Type{
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "enable", TypeSize: 4}}},
@ -1009,6 +1035,87 @@ var structDescs_amd64 = []*KeyedStruct{
}
var syscalls_amd64 = []*Syscall{
{NR: 326, Name: "__getcwd", CallName: "__getcwd", Args: []Type{
&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: "size", TypeSize: 8}}, Buf: "buf"},
}},
{NR: 510, Name: "__semctl$GETALL", CallName: "__semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "semnum", TypeSize: 8}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 6},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "__semctl$GETNCNT", CallName: "__semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 3},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "__semctl$GETPID", CallName: "__semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 4},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "__semctl$GETVAL", CallName: "__semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 5},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "__semctl$GETZCNT", CallName: "__semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 7},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "__semctl$IPC_INFO", CallName: "__semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 3},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "buf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "__semctl$IPC_RMID", CallName: "__semctl", MissingArgs: 1, Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "semnum", TypeSize: 8}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}},
}},
{NR: 510, Name: "__semctl$IPC_SET", CallName: "__semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "semnum", TypeSize: 8}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 1},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "arg", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "semid_ds"}}},
}},
{NR: 510, Name: "__semctl$IPC_STAT", CallName: "__semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "semnum", TypeSize: 8}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 2},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "__semctl$SEM_INFO", CallName: "__semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 11},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "__semctl$SEM_STAT", CallName: "__semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 10},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "__semctl$SETALL", CallName: "__semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "semnum", TypeSize: 8}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 9},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "arg", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", TypeSize: 2}}}}},
}},
{NR: 510, Name: "__semctl$SETVAL", CallName: "__semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 8},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "arg", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}},
}},
{NR: 30, Name: "accept", CallName: "accept", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "sock", FldName: "fd", TypeSize: 4}},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "peer", TypeSize: 8, IsOptional: true}, Type: &UnionType{Key: StructKey{Name: "sockaddr_storage", Dir: 1}}},
@ -1214,6 +1321,37 @@ 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: 42, Name: "freebsd10_pipe", CallName: "freebsd10_pipe", Args: []Type{
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "pipefd", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "pipefd", Dir: 1}}},
}},
{NR: 189, Name: "freebsd11_fstat", CallName: "freebsd11_fstat", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "statbuf", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "freebsd11_stat", Dir: 1}}},
}},
{NR: 272, Name: "freebsd11_getdents", CallName: "freebsd11_getdents", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd_dir", FldName: "fd", TypeSize: 4}},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "ent", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
&LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "count", TypeSize: 8}}, Buf: "ent"},
}},
{NR: 190, Name: "freebsd11_lstat", CallName: "freebsd11_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: &StructType{Key: StructKey{Name: "freebsd11_stat", Dir: 1}}},
}},
{NR: 14, Name: "freebsd11_mknod", CallName: "freebsd11_mknod", Args: []Type{
&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: "mknod_mode", FldName: "mod", TypeSize: 8}}, Vals: []uint64{32768, 8192, 24576, 4096, 49152, 256, 128, 64, 32, 16, 8, 4, 2, 1}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "dev", TypeSize: 4}}},
}},
{NR: 498, Name: "freebsd11_mknodat", CallName: "freebsd11_mknodat", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd_dir", FldName: "dirfd", TypeSize: 4}},
&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: "mknod_mode", FldName: "mod", TypeSize: 8}}, Vals: []uint64{32768, 8192, 24576, 4096, 49152, 256, 128, 64, 32, 16, 8, 4, 2, 1}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "dev", TypeSize: 4}}},
}},
{NR: 188, Name: "freebsd11_stat", CallName: "freebsd11_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: &StructType{Key: StructKey{Name: "freebsd11_stat", Dir: 1}}},
}},
{NR: 551, 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: &StructType{Key: StructKey{Name: "stat", Dir: 1}}},
@ -1230,15 +1368,6 @@ var syscalls_amd64 = []*Syscall{
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "pathname", 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: 326, Name: "getcwd", CallName: "getcwd", Args: []Type{
&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: "size", TypeSize: 8}}, Buf: "buf"},
}},
{NR: 272, Name: "getdents", CallName: "getdents", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd_dir", FldName: "fd", TypeSize: 4}},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "ent", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
&LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "count", TypeSize: 8}}, Buf: "ent"},
}},
{NR: 43, Name: "getegid", CallName: "getegid", Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "gid", FldName: "ret", TypeSize: 4, ArgDir: 1}}},
{NR: 25, Name: "geteuid", CallName: "geteuid", Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "uid", FldName: "ret", TypeSize: 4, ArgDir: 1}}},
{NR: 47, Name: "getgid", CallName: "getgid", Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "gid", FldName: "ret", TypeSize: 4, ArgDir: 1}}},
@ -2090,10 +2219,6 @@ var syscalls_amd64 = []*Syscall{
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "fileoff", FldName: "offset", TypeSize: 8}}, Kind: 1},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "seek_whence", FldName: "whence", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
}},
{NR: 190, 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: &StructType{Key: StructKey{Name: "stat", Dir: 1}}},
}},
{NR: 75, Name: "madvise", CallName: "madvise", Args: []Type{
&VmaType{TypeCommon: TypeCommon{TypeName: "vma", FldName: "addr", TypeSize: 8}},
&LenType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "len", FldName: "len", TypeSize: 8}}, Buf: "addr"},
@ -2113,21 +2238,11 @@ var syscalls_amd64 = []*Syscall{
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "path", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, 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}, BitMask: true},
}},
{NR: 14, Name: "mknod", CallName: "mknod", Args: []Type{
&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: "mknod_mode", FldName: "mode", TypeSize: 8}}, Vals: []uint64{32768, 8192, 24576, 4096, 49152, 256, 128, 64, 32, 16, 8, 4, 2, 1}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "dev", TypeSize: 4}}},
}},
{NR: 14, Name: "mknod$loop", CallName: "mknod", Args: []Type{
&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: "mknod_mode", FldName: "mode", TypeSize: 8}}, Vals: []uint64{32768, 8192, 24576, 4096, 49152, 256, 128, 64, 32, 16, 8, 4, 2, 1}},
&ProcType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "proc", FldName: "dev", TypeSize: 8}}, ValuesStart: 1792, ValuesPerProc: 2},
}},
{NR: 559, Name: "mknodat", CallName: "mknodat", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd_dir", FldName: "dirfd", TypeSize: 4}},
&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: "mknod_mode", FldName: "mode", TypeSize: 8}}, Vals: []uint64{32768, 8192, 24576, 4096, 49152, 256, 128, 64, 32, 16, 8, 4, 2, 1}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", FldName: "dev", TypeSize: 4}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "dev", TypeSize: 8}}},
}},
{NR: 203, Name: "mlock", CallName: "mlock", Args: []Type{
&VmaType{TypeCommon: TypeCommon{TypeName: "vma", FldName: "addr", TypeSize: 8}},
@ -2223,9 +2338,6 @@ var syscalls_amd64 = []*Syscall{
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 8, 64, 1048576, 512, 65536, 131072, 2048, 32768, 256, 4, 128, 1024}, BitMask: true},
&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: 42, Name: "pipe", CallName: "pipe", Args: []Type{
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "pipefd", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "pipefd", Dir: 1}}},
}},
{NR: 542, Name: "pipe2", CallName: "pipe2", Args: []Type{
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "pipefd", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "pipefd", Dir: 1}}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "pipe_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{4, 1048576}, BitMask: true},
@ -2332,83 +2444,6 @@ var syscalls_amd64 = []*Syscall{
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "exp", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "fd_set", Dir: 2}}},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "tvp", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "timeval", Dir: 2}}},
}},
{NR: 510, Name: "semctl$GETALL", CallName: "semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "semnum", TypeSize: 8}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 6},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "semctl$GETNCNT", CallName: "semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 3},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "semctl$GETPID", CallName: "semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 4},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "semctl$GETVAL", CallName: "semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 5},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "semctl$GETZCNT", CallName: "semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 7},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "semctl$IPC_INFO", CallName: "semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 3},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "buf", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "semctl$IPC_RMID", CallName: "semctl", MissingArgs: 1, Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "semnum", TypeSize: 8}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}},
}},
{NR: 510, Name: "semctl$IPC_SET", CallName: "semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "semnum", TypeSize: 8}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 1},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "arg", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "semid_ds"}}},
}},
{NR: 510, Name: "semctl$IPC_STAT", CallName: "semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "semnum", TypeSize: 8}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 2},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "semctl$SEM_INFO", CallName: "semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 11},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "semctl$SEM_STAT", CallName: "semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 10},
&PtrType{TypeCommon: TypeCommon{TypeName: "buffer", FldName: "arg", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{ArgDir: 1, IsVarlen: true}}},
}},
{NR: 510, Name: "semctl$SETALL", CallName: "semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "semnum", TypeSize: 8}}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 9},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "arg", TypeSize: 8}, Type: &ArrayType{TypeCommon: TypeCommon{TypeName: "array", IsVarlen: true}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int16", TypeSize: 2}}}}},
}},
{NR: 510, Name: "semctl$SETVAL", CallName: "semctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "ipc_sem", FldName: "semid", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "semnum", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 8},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "arg", TypeSize: 8}, Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}},
}},
{NR: 221, Name: "semget", CallName: "semget", Args: []Type{
&ProcType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "proc", FldName: "key", TypeSize: 8}}, ValuesStart: 2039359027, ValuesPerProc: 4},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "sem_sem_id", FldName: "nsems", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 3, 4}},
@ -3548,10 +3583,6 @@ var syscalls_amd64 = []*Syscall{
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "proto", TypeSize: 8}}},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "fds", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "unix_pair", Dir: 1}}},
}},
{NR: 188, 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: &StructType{Key: StructKey{Name: "stat", Dir: 1}}},
}},
{NR: 57, 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}},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "new", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}},
@ -3997,6 +4028,7 @@ var consts_amd64 = []ConstValue{
{Name: "SPP_IPV6_FLOWLABEL", Value: 256},
{Name: "SPP_PMTUD_DISABLE", Value: 16},
{Name: "SPP_PMTUD_ENABLE", Value: 8},
{Name: "SYS___getcwd", Value: 326},
{Name: "SYS___semctl", Value: 510},
{Name: "SYS_accept", Value: 30},
{Name: "SYS_accept4", Value: 541},
@ -4024,16 +4056,17 @@ var consts_amd64 = []ConstValue{
{Name: "SYS_fcntl", Value: 92},
{Name: "SYS_fdatasync", Value: 550},
{Name: "SYS_flock", Value: 131},
{Name: "SYS_freebsd10_pipe", Value: 42},
{Name: "SYS_freebsd11_fstat", Value: 189},
{Name: "SYS_freebsd11_getdents", Value: 272},
{Name: "SYS_freebsd11_lstat", Value: 190},
{Name: "SYS_freebsd11_mknod", Value: 14},
{Name: "SYS_freebsd11_mknodat", Value: 498},
{Name: "SYS_freebsd7_msgctl", Value: 224},
{Name: "SYS_freebsd7_shmctl", Value: 229},
{Name: "SYS_freebsd11_stat", Value: 188},
{Name: "SYS_fstat", Value: 551},
{Name: "SYS_fsync", Value: 95},
{Name: "SYS_ftruncate", Value: 480},
{Name: "SYS_futimesat", Value: 494},
{Name: "SYS_getcwd", Value: 326},
{Name: "SYS_getdents", Value: 272},
{Name: "SYS_getegid", Value: 43},
{Name: "SYS_geteuid", Value: 25},
{Name: "SYS_getgid", Value: 47},
@ -4055,12 +4088,10 @@ var consts_amd64 = []ConstValue{
{Name: "SYS_linkat", Value: 495},
{Name: "SYS_listen", Value: 106},
{Name: "SYS_lseek", Value: 478},
{Name: "SYS_lstat", Value: 190},
{Name: "SYS_madvise", Value: 75},
{Name: "SYS_mincore", Value: 78},
{Name: "SYS_mkdir", Value: 136},
{Name: "SYS_mkdirat", Value: 496},
{Name: "SYS_mknod", Value: 14},
{Name: "SYS_mknodat", Value: 559},
{Name: "SYS_mlock", Value: 203},
{Name: "SYS_mlockall", Value: 324},
@ -4077,7 +4108,6 @@ var consts_amd64 = []ConstValue{
{Name: "SYS_nanosleep", Value: 240},
{Name: "SYS_open", Value: 5},
{Name: "SYS_openat", Value: 499},
{Name: "SYS_pipe", Value: 42},
{Name: "SYS_pipe2", Value: 542},
{Name: "SYS_poll", Value: 209},
{Name: "SYS_ppoll", Value: 545},
@ -4093,7 +4123,6 @@ var consts_amd64 = []ConstValue{
{Name: "SYS_renameat", Value: 501},
{Name: "SYS_rmdir", Value: 137},
{Name: "SYS_select", Value: 93},
{Name: "SYS_semctl", Value: 510},
{Name: "SYS_semget", Value: 221},
{Name: "SYS_semop", Value: 222},
{Name: "SYS_sendfile", Value: 393},
@ -4118,7 +4147,6 @@ var consts_amd64 = []ConstValue{
{Name: "SYS_sigaltstack", Value: 53},
{Name: "SYS_socket", Value: 97},
{Name: "SYS_socketpair", Value: 135},
{Name: "SYS_stat", Value: 188},
{Name: "SYS_symlink", Value: 57},
{Name: "SYS_symlinkat", Value: 502},
{Name: "SYS_sync", Value: 36},
@ -4180,4 +4208,4 @@ var consts_amd64 = []ConstValue{
{Name: "WUNTRACED", Value: 2},
}
const revision_amd64 = "87222f38848c14df07a6a0304da0b1915e3396bb"
const revision_amd64 = "873616249e74ae100e93afb6a14e4fef92b3acc4"

View File

@ -13,7 +13,7 @@ resource ipc[int32]: 0, 0xffffffffffffffff
# TODO: describe ipc syscall
define SYS_semctl 510
define SYS___semctl 510
resource ipc_msq[ipc]
msgget(key proc[2039379027, 4], flags flags[msgget_flags]) ipc_msq
@ -29,19 +29,19 @@ resource ipc_sem[ipc]
semget(key proc[2039359027, 4], nsems flags[sem_sem_id], flags flags[semget_flags]) ipc_sem
semget$private(key const[IPC_PRIVATE], nsems flags[sem_sem_id], flags flags[semget_flags]) ipc_sem
semop(semid ipc_sem, ops ptr[in, array[sembuf]], nops len[ops])
semctl$IPC_STAT(semid ipc_sem, semnum const[0], cmd const[IPC_STAT], arg buffer[out])
semctl$IPC_SET(semid ipc_sem, semnum const[0], cmd const[IPC_SET], arg ptr[in, semid_ds])
semctl$IPC_RMID(semid ipc_sem, semnum const[0], cmd const[IPC_RMID])
semctl$IPC_INFO(semid ipc_sem, semnum flags[sem_sem_id], cmd const[IPC_INFO], buf buffer[out])
semctl$SEM_INFO(semid ipc_sem, semnum flags[sem_sem_id], cmd const[SEM_INFO], arg buffer[out])
semctl$SEM_STAT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[SEM_STAT], arg buffer[out])
semctl$GETALL(semid ipc_sem, semnum const[0], cmd const[GETALL], arg buffer[out])
semctl$GETNCNT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETNCNT], arg buffer[out])
semctl$GETPID(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETPID], arg buffer[out])
semctl$GETVAL(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETVAL], arg buffer[out])
semctl$GETZCNT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETZCNT], arg buffer[out])
semctl$SETALL(semid ipc_sem, semnum const[0], cmd const[SETALL], arg ptr[in, array[int16]])
semctl$SETVAL(semid ipc_sem, semnum flags[sem_sem_id], cmd const[SETVAL], arg ptr[in, int32])
__semctl$IPC_STAT(semid ipc_sem, semnum const[0], cmd const[IPC_STAT], arg buffer[out])
__semctl$IPC_SET(semid ipc_sem, semnum const[0], cmd const[IPC_SET], arg ptr[in, semid_ds])
__semctl$IPC_RMID(semid ipc_sem, semnum const[0], cmd const[IPC_RMID])
__semctl$IPC_INFO(semid ipc_sem, semnum flags[sem_sem_id], cmd const[IPC_INFO], buf buffer[out])
__semctl$SEM_INFO(semid ipc_sem, semnum flags[sem_sem_id], cmd const[SEM_INFO], arg buffer[out])
__semctl$SEM_STAT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[SEM_STAT], arg buffer[out])
__semctl$GETALL(semid ipc_sem, semnum const[0], cmd const[GETALL], arg buffer[out])
__semctl$GETNCNT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETNCNT], arg buffer[out])
__semctl$GETPID(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETPID], arg buffer[out])
__semctl$GETVAL(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETVAL], arg buffer[out])
__semctl$GETZCNT(semid ipc_sem, semnum flags[sem_sem_id], cmd const[GETZCNT], arg buffer[out])
__semctl$SETALL(semid ipc_sem, semnum const[0], cmd const[SETALL], arg ptr[in, array[int16]])
__semctl$SETVAL(semid ipc_sem, semnum flags[sem_sem_id], cmd const[SETVAL], arg ptr[in, int32])
resource ipc_shm[ipc]
resource shmaddr[intptr]: 0

View File

@ -25,13 +25,10 @@ SHM_RND = 8192
SHM_STAT = 13
SHM_UNLOCK = 12
SYS___semctl = 510
SYS_freebsd7_msgctl = 224
SYS_freebsd7_shmctl = 229
SYS_msgctl = 511
SYS_msgget = 225
SYS_msgrcv = 227
SYS_msgsnd = 226
SYS_semctl = 510
SYS_semget = 221
SYS_semop = 222
SYS_shmat = 228

View File

@ -28,7 +28,11 @@ lseek(fd fd, offset fileoff, whence flags[seek_whence])
dup(oldfd fd) fd
dup2(oldfd fd, newfd fd) fd
pipe2(pipefd ptr[out, pipefd], flags flags[pipe_flags])
freebsd10_pipe(pipefd ptr[out, pipefd])
fstat(fd fd, statbuf ptr[out, stat])
freebsd11_stat(file ptr[in, filename], statbuf ptr[out, freebsd11_stat])
freebsd11_fstat(fd fd, statbuf ptr[out, freebsd11_stat])
freebsd11_lstat(file ptr[in, filename], statbuf ptr[out, freebsd11_stat])
pipefd {
rfd fd
@ -45,25 +49,54 @@ iovec_out {
len len[addr, intptr]
}
stat {
dev int16
freebsd11_stat {
dev int32
ino int32
mode int16
nlink int16
uid uid
gid gid
rdev int16
size int32
rdev int32
atime int64
ansec int64
mtime int64
mnsec int64
ctime int64
cnsec int64
size int64
blocks int64
blksize int32
blocks int32
atime int32
ansec int32
mtime int32
mnsec int32
ctime int32
cnsec int32
pad1 const[0, int32]
pad2 const[0, int32]
flags int32
gen int32
__spare const[0, int32]
btime int64
bnsec int64
}
stat {
dev int64
ino int64
nlink int64
mode int16
__pad0 const[0, int16]
uid uid
gid gid
__pad1 const[0, int32]
rdev int64
atime int64
ansec int64
mtime int64
mnsec int64
ctime int64
cnsec int64
btime int64
bnsec int64
size int64
blocks int64
blksize int32
flags int32
gen int64
__spare array[int64, 10]
}
open_flags = O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, FASYNC, O_CLOEXEC, O_CREAT, O_DIRECT, O_DIRECTORY, O_EXCL, O_NOCTTY, O_NOFOLLOW, O_NONBLOCK, O_SYNC, O_TRUNC

View File

@ -23,7 +23,10 @@ SEEK_SET = 0
SYS_close = 6
SYS_dup = 41
SYS_dup2 = 90
SYS_freebsd10_pipe = 42
SYS_freebsd11_fstat = 189
SYS_freebsd11_lstat = 190
SYS_freebsd11_stat = 188
SYS_fstat = 551
SYS_lseek = 478
SYS_open = 5

View File

@ -19,13 +19,8 @@ include <sys/wait.h>
syz_execute_func(text ptr[in, text[target]])
pipe(pipefd ptr[out, pipefd])
sendfile(fdout fd, fdin fd, off ptr[inout, fileoff[int64], opt], count int64)
stat(file ptr[in, filename], statbuf ptr[out, stat])
lstat(file ptr[in, filename], statbuf ptr[out, stat])
poll(fds ptr[in, array[pollfd]], nfds len[fds], timeout int32)
ppoll(fds ptr[in, array[pollfd]], nfds len[fds], tsp ptr[in, timespec], sigmask ptr[in, sigset], size len[sigmask])
select(n len[inp], inp ptr[inout, fd_set], outp ptr[inout, fd_set], exp ptr[inout, fd_set], tvp ptr[inout, timeval])
@ -40,9 +35,9 @@ fcntl$lock(fd fd, cmd flags[fcntl_lock], lock ptr[in, flock])
fcntl$getown(fd fd, cmd const[F_GETOWN]) pid
fcntl$setown(fd fd, cmd const[F_SETOWN], pid pid)
mknod(file ptr[in, filename], mode flags[mknod_mode], dev int32)
mknod$loop(file ptr[in, filename], mode flags[mknod_mode], dev proc[1792, 2])
mknodat(dirfd fd_dir, file ptr[in, filename], mode flags[mknod_mode], dev int32)
mknodat(dirfd fd_dir, file ptr[in, filename], mode flags[mknod_mode], dev int64)
freebsd11_mknod(file ptr[in, filename], mod flags[mknod_mode], dev int32)
freebsd11_mknodat(dirfd fd_dir, file ptr[in, filename], mod flags[mknod_mode], dev int32)
chmod(file ptr[in, filename], mode flags[open_mode])
fchmod(fd fd, mode flags[open_mode])
fchmodat(dirfd fd_dir, file ptr[in, filename], mode flags[open_mode])
@ -95,9 +90,9 @@ flock(fd fd, op flags[flock_op])
fsync(fd fd)
fdatasync(fd fd)
sync()
getdents(fd fd_dir, ent buffer[out], count len[ent])
freebsd11_getdents(fd fd_dir, ent buffer[out], count len[ent])
chroot(dir ptr[in, filename])
getcwd(buf buffer[out], size len[buf])
__getcwd(buf buffer[out], size len[buf])
chdir(dir ptr[in, filename])
fchdir(fd fd)

View File

@ -56,6 +56,7 @@ RLIMIT_STACK = 3
RUSAGE_CHILDREN = 18446744073709551615
RUSAGE_SELF = 0
RUSAGE_THREAD = 1
SYS___getcwd = 326
SYS_chdir = 12
SYS_chmod = 15
SYS_chown = 16
@ -75,12 +76,12 @@ SYS_fchownat = 491
SYS_fcntl = 92
SYS_fdatasync = 550
SYS_flock = 131
SYS_freebsd11_getdents = 272
SYS_freebsd11_mknod = 14
SYS_freebsd11_mknodat = 498
SYS_fsync = 95
SYS_ftruncate = 480
SYS_futimesat = 494
SYS_getcwd = 326
SYS_getdents = 272
SYS_getegid = 43
SYS_geteuid = 25
SYS_getgid = 47
@ -97,14 +98,11 @@ SYS_getuid = 24
SYS_lchown = 254
SYS_link = 9
SYS_linkat = 495
SYS_lstat = 190
SYS_mincore = 78
SYS_mkdir = 136
SYS_mkdirat = 496
SYS_mknod = 14
SYS_mknodat = 559
SYS_nanosleep = 240
SYS_pipe = 42
SYS_poll = 209
SYS_ppoll = 545
SYS_readlink = 58
@ -125,7 +123,6 @@ SYS_setreuid = 126
SYS_setrlimit = 195
SYS_setuid = 23
SYS_sigaltstack = 53
SYS_stat = 188
SYS_symlink = 57
SYS_symlinkat = 502
SYS_sync = 36

View File

@ -55,33 +55,5 @@ func (*freebsd) processFile(arch *Arch, info *compiler.ConstInfo) (map[string]ui
args = append(args, "-I"+dir)
}
}
// Syscall consts on freebsd have weird prefixes sometimes,
// try to extract consts with these prefixes as well.
compatNames := make(map[string][]string)
for _, val := range info.Consts {
const SYS = "SYS_"
if strings.HasPrefix(val, SYS) {
for _, prefix := range []string{"__", "freebsd11_", "freebsd10_", "freebsd7_"} {
compat := SYS + prefix + val[len(SYS):]
compatNames[val] = append(compatNames[val], compat)
info.Consts = append(info.Consts, compat)
}
} else {
compat := "LINUX_" + val
compatNames[val] = append(compatNames[val], compat)
info.Consts = append(info.Consts, compat)
}
}
res, undeclared, err := extract(info, "gcc", args, "#include <sys/syscall.h>", true)
for orig, compats := range compatNames {
for _, compat := range compats {
if undeclared[orig] && !undeclared[compat] {
res[orig] = res[compat]
delete(res, compat)
delete(undeclared, orig)
}
delete(undeclared, compat)
}
}
return res, undeclared, err
return extract(info, "gcc", args, "#include <sys/syscall.h>", true)
}