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

     1  # Copyright 2020 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 <linux/net.h>
     5  include <uapi/linux/netlink.h>
     6  include <uapi/rdma/rdma_netlink.h>
     7  
     8  resource sock_nl_rdma[sock_netlink]
     9  
    10  socket$nl_rdma(domain const[AF_NETLINK], type const[SOCK_RAW], proto const[NETLINK_RDMA]) sock_nl_rdma
    11  # Some messages onl work in init namespace.
    12  syz_init_net_socket$nl_rdma(domain const[AF_NETLINK], type const[SOCK_RAW], proto const[NETLINK_RDMA]) sock_nl_rdma
    13  
    14  type msg_nl_rdma[CMD, POLICY] ptr[in, msghdr_netlink[netlink_msg[CMD, void, POLICY]]]
    15  
    16  sendmsg$RDMA_NLDEV_CMD_GET(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_GET, nldev_policy$DEV], f flags[send_flags])
    17  sendmsg$RDMA_NLDEV_CMD_SET(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_SET, nldev_policy$SET], f flags[send_flags])
    18  sendmsg$RDMA_NLDEV_CMD_NEWLINK(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_NEWLINK, nldev_policy$NEWLINK], f flags[send_flags])
    19  sendmsg$RDMA_NLDEV_CMD_DELLINK(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_DELLINK, nldev_policy$DEV], f flags[send_flags])
    20  sendmsg$RDMA_NLDEV_CMD_PORT_GET(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_PORT_GET, nldev_policy$PORT_GET], f flags[send_flags])
    21  sendmsg$RDMA_NLDEV_CMD_SYS_GET(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_SYS_GET, nldev_policy$DEV], f flags[send_flags])
    22  sendmsg$RDMA_NLDEV_CMD_SYS_SET(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_SYS_SET, nldev_policy$SET], f flags[send_flags])
    23  sendmsg$RDMA_NLDEV_CMD_RES_GET(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_RES_GET, nldev_policy$DEV], f flags[send_flags])
    24  sendmsg$RDMA_NLDEV_CMD_RES_QP_GET(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_RES_QP_GET, nldev_policy$RES_QP_GET], f flags[send_flags])
    25  sendmsg$RDMA_NLDEV_CMD_RES_CM_ID_GET(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_RES_CM_ID_GET, nldev_policy$RES_CM_ID_GET], f flags[send_flags])
    26  sendmsg$RDMA_NLDEV_CMD_RES_CQ_GET(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_RES_CQ_GET, nldev_policy$RES_CQ_GET], f flags[send_flags])
    27  sendmsg$RDMA_NLDEV_CMD_RES_MR_GET(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_RES_MR_GET, nldev_policy$RES_MR_GET], f flags[send_flags])
    28  sendmsg$RDMA_NLDEV_CMD_RES_PD_GET(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_RES_PD_GET, nldev_policy$RES_PD_GET], f flags[send_flags])
    29  sendmsg$RDMA_NLDEV_CMD_GET_CHARDEV(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_GET_CHARDEV, nldev_policy$GET_CHARDEV], f flags[send_flags])
    30  sendmsg$RDMA_NLDEV_CMD_STAT_SET(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_STAT_SET, nldev_policy$STAT_SET], f flags[send_flags])
    31  sendmsg$RDMA_NLDEV_CMD_STAT_GET(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_STAT_GET, nldev_policy$STAT_GET], f flags[send_flags])
    32  sendmsg$RDMA_NLDEV_CMD_STAT_DEL(fd sock_nl_rdma, msg msg_nl_rdma[RDMA_NLDEV_STAT_DEL, nldev_policy$STAT_DEL], f flags[send_flags])
    33  
    34  define RDMA_NLDEV_GET	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_GET)
    35  define RDMA_NLDEV_SET	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_SET)
    36  define RDMA_NLDEV_NEWLINK	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_NEWLINK)
    37  define RDMA_NLDEV_DELLINK	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_DELLINK)
    38  define RDMA_NLDEV_PORT_GET	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_PORT_GET)
    39  define RDMA_NLDEV_SYS_GET	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_SYS_GET)
    40  define RDMA_NLDEV_SYS_SET	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_SYS_SET)
    41  define RDMA_NLDEV_RES_GET	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_GET)
    42  define RDMA_NLDEV_RES_QP_GET	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_QP_GET)
    43  define RDMA_NLDEV_RES_CM_ID_GET	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_CM_ID_GET)
    44  define RDMA_NLDEV_RES_CQ_GET	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_CQ_GET)
    45  define RDMA_NLDEV_RES_MR_GET	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_MR_GET)
    46  define RDMA_NLDEV_RES_PD_GET	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_PD_GET)
    47  define RDMA_NLDEV_GET_CHARDEV	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_GET_CHARDEV)
    48  define RDMA_NLDEV_STAT_SET	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_STAT_SET)
    49  define RDMA_NLDEV_STAT_GET	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_STAT_GET)
    50  define RDMA_NLDEV_STAT_DEL	RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_STAT_DEL)
    51  
    52  nldev_name = "syz0", "syz1", "syz2"
    53  nldev_type = "siw", "rxe"
    54  
    55  nldev_policy$DEV [
    56  	RDMA_NLDEV_ATTR_DEV_INDEX	nlattr[RDMA_NLDEV_ATTR_DEV_INDEX, int32[0:2]]
    57  ] [varlen]
    58  
    59  nldev_policy$SET [
    60  	RDMA_NLDEV_ATTR_DEV_INDEX	nlattr[RDMA_NLDEV_ATTR_DEV_INDEX, int32[0:2]]
    61  	RDMA_NLDEV_ATTR_DEV_NAME	nlattr[RDMA_NLDEV_ATTR_DEV_NAME, string[nldev_name]]
    62  	RDMA_NLDEV_NET_NS_FD		nlattr[RDMA_NLDEV_NET_NS_FD, fd_namespace]
    63  	RDMA_NLDEV_ATTR_DEV_DIM		nlattr[RDMA_NLDEV_ATTR_DEV_DIM, bool8]
    64  ] [varlen]
    65  
    66  nldev_policy$NEWLINK {
    67  	RDMA_NLDEV_ATTR_DEV_NAME	nlattr[RDMA_NLDEV_ATTR_DEV_NAME, string[nldev_name]]
    68  	RDMA_NLDEV_ATTR_LINK_TYPE	nlattr[RDMA_NLDEV_ATTR_LINK_TYPE, string[nldev_type]]
    69  	RDMA_NLDEV_ATTR_NDEV_NAME	nlattr[RDMA_NLDEV_ATTR_NDEV_NAME, devname]
    70  } [packed]
    71  
    72  nldev_policy$PORT_GET {
    73  	RDMA_NLDEV_ATTR_DEV_INDEX	nlattr[RDMA_NLDEV_ATTR_DEV_INDEX, int32[0:2]]
    74  	RDMA_NLDEV_ATTR_PORT_INDEX	nlattr[RDMA_NLDEV_ATTR_PORT_INDEX, int32[0:4]]
    75  } [packed]
    76  
    77  nldev_policy$RES_QP_GET [
    78  	RDMA_NLDEV_ATTR_DEV_INDEX	nlattr[RDMA_NLDEV_ATTR_DEV_INDEX, int32[0:2]]
    79  	RDMA_NLDEV_ATTR_PORT_INDEX	nlattr[RDMA_NLDEV_ATTR_PORT_INDEX, int32[0:4]]
    80  	RDMA_NLDEV_ATTR_RES_LQPN	nlattr[RDMA_NLDEV_ATTR_RES_LQPN, int32[0:5]]
    81  ] [varlen]
    82  
    83  nldev_policy$RES_CM_ID_GET [
    84  	RDMA_NLDEV_ATTR_DEV_INDEX	nlattr[RDMA_NLDEV_ATTR_DEV_INDEX, int32[0:2]]
    85  	RDMA_NLDEV_ATTR_PORT_INDEX	nlattr[RDMA_NLDEV_ATTR_PORT_INDEX, int32[0:4]]
    86  	RDMA_NLDEV_ATTR_RES_CM_IDN	nlattr[RDMA_NLDEV_ATTR_RES_CM_IDN, int32[0:5]]
    87  ] [varlen]
    88  
    89  nldev_policy$RES_CQ_GET [
    90  	RDMA_NLDEV_ATTR_DEV_INDEX	nlattr[RDMA_NLDEV_ATTR_DEV_INDEX, int32[0:2]]
    91  	RDMA_NLDEV_ATTR_PORT_INDEX	nlattr[RDMA_NLDEV_ATTR_PORT_INDEX, int32[0:4]]
    92  	RDMA_NLDEV_ATTR_RES_CQN		nlattr[RDMA_NLDEV_ATTR_RES_CQN, int32[0:5]]
    93  ] [varlen]
    94  
    95  nldev_policy$RES_MR_GET [
    96  	RDMA_NLDEV_ATTR_DEV_INDEX	nlattr[RDMA_NLDEV_ATTR_DEV_INDEX, int32[0:2]]
    97  	RDMA_NLDEV_ATTR_PORT_INDEX	nlattr[RDMA_NLDEV_ATTR_PORT_INDEX, int32[0:4]]
    98  	RDMA_NLDEV_ATTR_RES_MRN		nlattr[RDMA_NLDEV_ATTR_RES_MRN, int32[0:5]]
    99  ] [varlen]
   100  
   101  nldev_policy$RES_PD_GET [
   102  	RDMA_NLDEV_ATTR_DEV_INDEX	nlattr[RDMA_NLDEV_ATTR_DEV_INDEX, int32[0:2]]
   103  	RDMA_NLDEV_ATTR_PORT_INDEX	nlattr[RDMA_NLDEV_ATTR_PORT_INDEX, int32[0:4]]
   104  	RDMA_NLDEV_ATTR_RES_PDN		nlattr[RDMA_NLDEV_ATTR_RES_PDN, int32[0:5]]
   105  ] [varlen]
   106  
   107  nldev_policy$GET_CHARDEV [
   108  	RDMA_NLDEV_ATTR_DEV_INDEX	nlattr[RDMA_NLDEV_ATTR_DEV_INDEX, int32[0:2]]
   109  	RDMA_NLDEV_ATTR_PORT_INDEX	nlattr[RDMA_NLDEV_ATTR_PORT_INDEX, int32[0:4]]
   110  	RDMA_NLDEV_ATTR_CHARDEV_TYPE	nlattr[RDMA_NLDEV_ATTR_CHARDEV_TYPE, string[nldev_chardev_type]]
   111  ] [varlen]
   112  
   113  nldev_chardev_type = "ib_multicast", "sa", "umad", "issm", "rdma_cm", "cma", "mad", "uverbs", "cm", "ib_srpt", "ipoib", "opa_vnic", "srp", "smc_ib"
   114  
   115  nldev_policy$STAT_SET [
   116  	RDMA_NLDEV_ATTR_DEV_INDEX		nlattr[RDMA_NLDEV_ATTR_DEV_INDEX, int32[0:2]]
   117  	RDMA_NLDEV_ATTR_PORT_INDEX		nlattr[RDMA_NLDEV_ATTR_PORT_INDEX, int32[0:4]]
   118  	RDMA_NLDEV_ATTR_STAT_RES		nlattr[RDMA_NLDEV_ATTR_STAT_RES, const[RDMA_NLDEV_ATTR_RES_QP, int32]]
   119  	RDMA_NLDEV_ATTR_STAT_MODE		nlattr[RDMA_NLDEV_ATTR_STAT_MODE, flags[rdma_nl_counter_mode, int32]]
   120  	RDMA_NLDEV_ATTR_STAT_AUTO_MODE_MASK	nlattr[RDMA_NLDEV_ATTR_STAT_AUTO_MODE_MASK, bool32]
   121  	RDMA_NLDEV_ATTR_RES_LQPN		nlattr[RDMA_NLDEV_ATTR_RES_LQPN, int32[0:5]]
   122  	RDMA_NLDEV_ATTR_STAT_COUNTER_ID		nlattr[RDMA_NLDEV_ATTR_STAT_COUNTER_ID, int32[0:5]]
   123  ] [varlen]
   124  
   125  rdma_nl_counter_mode = RDMA_COUNTER_MODE_NONE, RDMA_COUNTER_MODE_AUTO, RDMA_COUNTER_MODE_MANUAL
   126  
   127  nldev_policy$STAT_GET [
   128  	RDMA_NLDEV_ATTR_DEV_INDEX	nlattr[RDMA_NLDEV_ATTR_DEV_INDEX, int32[0:2]]
   129  	RDMA_NLDEV_ATTR_PORT_INDEX	nlattr[RDMA_NLDEV_ATTR_PORT_INDEX, int32[0:4]]
   130  	RDMA_NLDEV_ATTR_STAT_RES	nlattr[RDMA_NLDEV_ATTR_STAT_RES, flags[nldev_stat_res, int32]]
   131  	RDMA_NLDEV_ATTR_RES_MRN		nlattr[RDMA_NLDEV_ATTR_RES_MRN, int32[0:5]]
   132  	RDMA_NLDEV_ATTR_STAT_COUNTER_ID	nlattr[RDMA_NLDEV_ATTR_STAT_COUNTER_ID, int32[0:5]]
   133  	RDMA_NLDEV_ATTR_STAT_MODE	nlattr[RDMA_NLDEV_ATTR_STAT_MODE, flags[rdma_nl_counter_mode, int32]]
   134  ] [varlen]
   135  
   136  nldev_stat_res = RDMA_NLDEV_ATTR_RES_QP, RDMA_NLDEV_ATTR_RES_MR
   137  
   138  nldev_policy$STAT_DEL [
   139  	RDMA_NLDEV_ATTR_DEV_INDEX	nlattr[RDMA_NLDEV_ATTR_DEV_INDEX, int32[0:2]]
   140  	RDMA_NLDEV_ATTR_PORT_INDEX	nlattr[RDMA_NLDEV_ATTR_PORT_INDEX, int32[0:4]]
   141  	RDMA_NLDEV_ATTR_STAT_RES	nlattr[RDMA_NLDEV_ATTR_STAT_RES, const[RDMA_NLDEV_ATTR_RES_QP, int32]]
   142  	RDMA_NLDEV_ATTR_STAT_COUNTER_ID	nlattr[RDMA_NLDEV_ATTR_STAT_COUNTER_ID, int32[0:5]]
   143  	RDMA_NLDEV_ATTR_RES_LQPN	nlattr[RDMA_NLDEV_ATTR_RES_LQPN, int32[0:5]]
   144  ] [varlen]
   145  
   146  #	RDMA_NL_IWCM = 2,
   147  #	RDMA_NL_RSVD,
   148  #	RDMA_NL_LS,	/* RDMA Local Services */
   149  #	RDMA_NL_NLDEV,	/* RDMA device interface */