syzkaller/sys/netbsd/socket_unix.txt
Dmitry Vyukov ecb386fe6f sys: check that target consts are defined
Currently when we get target consts with target.ConstMap["name"]
during target initialization, we just get 0 for missing consts.
This is error-prone as we can mis-type a const, or a const may
be undefined only on some archs (as we have common unix code
shared between several OSes).
Check that all the consts are actually defined.
The check detects several violations, to fix them:
1. move mremap to linux as it's only defined on linux
2. move S_IFMT to openbsd, as it's only defined and used on openbsd
3. define missing MAP_ANONYMOUS for freebsd and netbsd
4. fix extract for netbsd
2018-10-19 19:11:22 +01:00

80 lines
2.3 KiB
Plaintext

# Copyright 2017 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
# AF_UNIX support.
include <stddef.h>
include <sys/types.h>
include <sys/socket.h>
include <netinet/in.h>
include <compat/linux/common/linux_socket.h>
resource sock_unix[sock]
socket$unix(domain const[AF_UNIX], type flags[unix_socket_type], proto const[0]) sock_unix
socketpair$unix(domain const[AF_UNIX], type flags[unix_socket_type], proto const[0], fds ptr[out, unix_pair])
bind$unix(fd sock_unix, addr ptr[in, sockaddr_un], addrlen len[addr])
connect$unix(fd sock_unix, addr ptr[in, sockaddr_un], addrlen len[addr])
accept$unix(fd sock_unix, peer ptr[out, sockaddr_un, opt], peerlen ptr[inout, len[peer, int32]]) sock_unix
sendto$unix(fd sock_unix, buf buffer[in], len len[buf], f flags[send_flags], addr ptr[in, sockaddr_un, opt], addrlen len[addr])
sendmsg$unix(fd sock_unix, msg ptr[in, msghdr_un], f flags[send_flags])
recvfrom$unix(fd sock_unix, buf buffer[out], len len[buf], f flags[recv_flags], addr ptr[in, sockaddr_un, opt], addrlen len[addr])
getsockname$unix(fd sock_unix, addr ptr[out, sockaddr_un], addrlen ptr[inout, len[addr, int32]])
getpeername$unix(fd sock_unix, peer ptr[out, sockaddr_un], peerlen ptr[inout, len[peer, int32]])
unix_socket_type = SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET
unix_socket_family = AF_UNIX, AF_UNSPEC
unix_pair {
fd0 sock_unix
fd1 sock_unix
}
sockaddr_un [
file sockaddr_un_file
abs sockaddr_un_abstract
] [varlen]
sockaddr_un_file {
family flags[unix_socket_family, int16]
path filename
} [packed]
sockaddr_un_abstract {
family flags[unix_socket_family, int16]
ind const[0, int8]
id proc[20000, 4, int32]
}
msghdr_un {
addr ptr[in, sockaddr_un]
addrlen len[addr, int32]
vec ptr[in, array[iovec_in]]
vlen len[vec, intptr]
ctrl ptr[in, array[cmsghdr_un], opt]
ctrllen bytesize[ctrl, intptr]
f flags[send_flags, int32]
}
cmsghdr_un [
rights cmsghdr_un_rights
cred cmsghdr_un_cred
] [varlen]
cmsghdr_un_rights {
len len[parent, intptr]
level const[SOL_SOCKET, int32]
type const[SCM_RIGHTS, int32]
fds array[fd]
} [align_ptr]
cmsghdr_un_cred {
len len[parent, intptr]
level const[SOL_SOCKET, int32]
type const[LINUX_SCM_CREDENTIALS, int32]
pid pid
uid uid
gid gid
} [align_ptr]