github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/socket_unix.txt (about)

     1  # Copyright 2017 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  # AF_UNIX support.
     5  
     6  include <linux/net.h>
     7  include <linux/socket.h>
     8  include <uapi/linux/un.h>
     9  include <uapi/asm-generic/socket.h>
    10  
    11  resource sock_unix[sock]
    12  
    13  socket$unix(domain const[AF_UNIX], type flags[unix_socket_type], proto const[0]) sock_unix
    14  socketpair$unix(domain const[AF_UNIX], type flags[unix_socket_type], proto const[0], fds ptr[out, unix_pair])
    15  bind$unix(fd sock_unix, addr ptr[in, sockaddr_un], addrlen len[addr])
    16  connect$unix(fd sock_unix, addr ptr[in, sockaddr_un], addrlen len[addr])
    17  accept$unix(fd sock_unix, peer ptr[out, sockaddr_un, opt], peerlen ptr[inout, len[peer, int32]]) sock_unix
    18  accept4$unix(fd sock_unix, peer ptr[out, sockaddr_un, opt], peerlen ptr[inout, len[peer, int32]], flags flags[accept_flags]) sock_unix
    19  
    20  sendto$unix(fd sock_unix, buf buffer[in], len len[buf], f flags[send_flags], addr ptr[in, sockaddr_un, opt], addrlen len[addr])
    21  sendmsg$unix(fd sock_unix, msg ptr[in, send_msghdr_un], f flags[send_flags])
    22  sendmmsg$unix(fd sock_unix, mmsg ptr[in, array[send_mmsghdr_un]], vlen len[mmsg], f flags[send_flags])
    23  recvfrom$unix(fd sock_unix, buf buffer[out], len len[buf], f flags[recv_flags], addr ptr[in, sockaddr_un, opt], addrlen len[addr])
    24  recvmsg$unix(fd sock_unix, msg ptr[inout, recv_msghdr_un], f flags[recv_flags])
    25  recvmmsg$unix(fd sock_unix, mmsg ptr[in, array[recv_mmsghdr_un]], vlen len[mmsg], f flags[recv_flags], timeout ptr[in, timespec, opt])
    26  getsockname$unix(fd sock_unix, addr ptr[out, sockaddr_un], addrlen ptr[inout, len[addr, int32]])
    27  getpeername$unix(fd sock_unix, peer ptr[out, sockaddr_un], peerlen ptr[inout, len[peer, int32]])
    28  
    29  unix_socket_type = SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET
    30  unix_socket_family = AF_UNIX, AF_UNSPEC
    31  
    32  unix_pair {
    33  	fd0	sock_unix
    34  	fd1	sock_unix
    35  }
    36  
    37  sockaddr_un [
    38  	file	sockaddr_un_file
    39  	abs	sockaddr_un_abstract
    40  ]
    41  
    42  sockaddr_un_file {
    43  	family	flags[unix_socket_family, int16]
    44  	path	string[filename, UNIX_PATH_MAX]
    45  }
    46  
    47  sockaddr_un_abstract {
    48  	family	flags[unix_socket_family, int16]
    49  	ind	const[0, int8]
    50  	id	int32[20000:20004]
    51  }
    52  
    53  send_msghdr_un {
    54  	addr	ptr[in, sockaddr_un, opt]
    55  	addrlen	len[addr, int32]
    56  	vec	ptr[in, array[iovec_in]]
    57  	vlen	len[vec, intptr]
    58  	ctrl	ptr[in, array[cmsghdr_un], opt]
    59  	ctrllen	bytesize[ctrl, intptr]
    60  	f	flags[send_flags, int32]
    61  }
    62  
    63  send_mmsghdr_un {
    64  	msg_hdr	send_msghdr_un
    65  	msg_len	const[0, int32]
    66  }
    67  
    68  recv_msghdr_un {
    69  	addr	ptr[out, sockaddr_un, opt]
    70  	addrlen	len[addr, int32]
    71  	vec	ptr[in, array[iovec_out]]
    72  	vlen	len[vec, intptr]
    73  	ctrl	ptr[out, array[cmsghdr_un], opt]
    74  	ctrllen	bytesize[ctrl, intptr]
    75  	f	const[0, int32]
    76  }
    77  
    78  recv_mmsghdr_un {
    79  	msg_hdr	recv_msghdr_un
    80  	msg_len	const[0, int32]
    81  }
    82  
    83  cmsghdr_un [
    84  	rights	cmsghdr_t[SOL_SOCKET, SCM_RIGHTS, array[fd]]
    85  	cred	cmsghdr_t[SOL_SOCKET, SCM_CREDENTIALS, cmsg_un_cred]
    86  ] [varlen]
    87  
    88  cmsg_un_cred {
    89  	pid	pid
    90  	uid	uid
    91  	gid	gid
    92  }