github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/dev_nbd.txt (about) 1 # Copyright 2018 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 include <uapi/linux/fcntl.h> 5 include <uapi/linux/netlink.h> 6 include <uapi/linux/genetlink.h> 7 include <uapi/linux/nbd.h> 8 include <uapi/linux/nbd-netlink.h> 9 10 resource fd_nbd[fd_block] 11 resource sock_nbd_client[sock] 12 resource sock_nbd_server[sock] 13 resource genl_nbd_family_id[int16] 14 15 syz_open_dev$ndb(dev ptr[in, string["/dev/nbd#"]], id proc[0, 1], flags flags[open_flags]) fd_nbd 16 17 ioctl$NBD_DISCONNECT(fd fd_nbd, cmd const[NBD_DISCONNECT]) 18 ioctl$NBD_CLEAR_SOCK(fd fd_nbd, cmd const[NBD_CLEAR_SOCK]) 19 ioctl$NBD_SET_SOCK(fd fd_nbd, cmd const[NBD_SET_SOCK], arg sock_nbd_client) 20 ioctl$NBD_SET_BLKSIZE(fd fd_nbd, cmd const[NBD_SET_BLKSIZE], arg intptr) 21 ioctl$NBD_SET_SIZE(fd fd_nbd, cmd const[NBD_SET_SIZE], arg intptr) 22 ioctl$NBD_SET_SIZE_BLOCKS(fd fd_nbd, cmd const[NBD_SET_SIZE_BLOCKS], arg intptr) 23 ioctl$NBD_SET_TIMEOUT(fd fd_nbd, cmd const[NBD_SET_TIMEOUT], arg intptr) 24 ioctl$NBD_SET_FLAGS(fd fd_nbd, cmd const[NBD_SET_FLAGS], arg intptr) 25 ioctl$NBD_DO_IT(fd fd_nbd, cmd const[NBD_DO_IT]) 26 ioctl$NBD_CLEAR_QUE(fd fd_nbd, cmd const[NBD_CLEAR_QUE]) 27 ioctl$NBD_PRINT_DEBUG(fd fd_nbd, cmd const[NBD_PRINT_DEBUG]) 28 29 type msghdr_nl_nbd[CMD] msghdr_netlink[netlink_msg_t[genl_nbd_family_id, genlmsghdr_t[CMD], nbd_attr_policy]] 30 31 syz_genetlink_get_family_id$nbd(name ptr[in, string["nbd"]], fd sock_nl_generic_init) genl_nbd_family_id 32 33 sendmsg$NBD_CMD_CONNECT(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nbd[NBD_CMD_CONNECT]], f flags[send_flags]) 34 sendmsg$NBD_CMD_DISCONNECT(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nbd[NBD_CMD_DISCONNECT]], f flags[send_flags]) 35 sendmsg$NBD_CMD_RECONFIGURE(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nbd[NBD_CMD_RECONFIGURE]], f flags[send_flags]) 36 sendmsg$NBD_CMD_STATUS(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nbd[NBD_CMD_STATUS]], f flags[send_flags]) 37 38 nbd_attr_policy [ 39 NBD_ATTR_INDEX nlattr[NBD_ATTR_INDEX, proc[0, 1, int32]] 40 NBD_ATTR_SIZE_BYTES nlattr[NBD_ATTR_SIZE_BYTES, int64] 41 NBD_ATTR_BLOCK_SIZE_BYTES nlattr[NBD_ATTR_BLOCK_SIZE_BYTES, int64] 42 NBD_ATTR_TIMEOUT nlattr[NBD_ATTR_TIMEOUT, int64] 43 NBD_ATTR_SERVER_FLAGS nlattr[NBD_ATTR_SERVER_FLAGS, flags[nbd_server_flags, int64]] 44 NBD_ATTR_CLIENT_FLAGS nlattr[NBD_ATTR_CLIENT_FLAGS, flags[nbd_client_flags, int64]] 45 NBD_ATTR_SOCKETS nlnest[NBD_ATTR_SOCKETS, array[nlattr[NBD_SOCK_FD, sock_nbd_client]]] 46 NBD_ATTR_DEAD_CONN_TIMEOUT nlattr[NBD_ATTR_DEAD_CONN_TIMEOUT, int64] 47 NBD_ATTR_BACKEND_IDENTIFIER nlattr[NBD_ATTR_BACKEND_IDENTIFIER, stringnoz] 48 ] [varlen] 49 50 nbd_server_flags = NBD_FLAG_HAS_FLAGS, NBD_FLAG_READ_ONLY, NBD_FLAG_SEND_FLUSH, NBD_FLAG_SEND_FUA, NBD_FLAG_SEND_TRIM, NBD_FLAG_CAN_MULTI_CONN 51 nbd_client_flags = NBD_CFLAG_DESTROY_ON_DISCONNECT, NBD_CFLAG_DISCONNECT_ON_CLOSE 52 53 socketpair$nbd(domain const[AF_UNIX], type const[SOCK_STREAM], proto const[0], fds ptr[out, nbd_sock_pair]) 54 55 nbd_sock_pair { 56 client sock_nbd_client 57 server sock_nbd_server 58 } 59 60 write$nbd(fd sock_nbd_server, data ptr[in, nbd_reply], size len[data]) 61 62 nbd_reply { 63 magic const[NBD_REPLY_MAGIC, int32be] 64 error bool32 65 handle_tag int16[0:4] 66 handle_hwq int16[0:4] 67 handle_cookie int32[1:4] 68 payload array[int8] 69 }