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

     1  # Copyright 2022 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_NETLINK/NETLINK_GENERIC/nfc support.
     5  
     6  include <linux/net.h>
     7  include <uapi/linux/netlink.h>
     8  include <uapi/linux/genetlink.h>
     9  include <uapi/linux/nfc.h>
    10  include <net/sock.h>
    11  include <net/nfc/nfc.h>
    12  include <net/nfc/llcp.h>
    13  
    14  resource genl_nfc_family_id[int16]
    15  type msghdr_nl_nfc[CMD, POLICY] msghdr_netlink[netlink_msg_t[genl_nfc_family_id, genlmsghdr_t[CMD], POLICY]]
    16  
    17  syz_genetlink_get_family_id$nfc(name ptr[in, string["nfc"]], fd sock_nl_generic_init) genl_nfc_family_id
    18  
    19  # TODO: it's unclear if anybody uses target idx other than 0. I only see 0.
    20  type nfc_target_idx int32[NFC_TARGET_IDX_ANY:1]
    21  
    22  sendmsg$NFC_CMD_GET_DEVICE(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_GET_DEVICE, nfc_genl_policy_dev_index]], f flags[send_flags])
    23  sendmsg$NFC_CMD_DEV_UP(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_DEV_UP, nfc_genl_policy_dev_index]], f flags[send_flags])
    24  sendmsg$NFC_CMD_DEV_DOWN(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_DEV_DOWN, nfc_genl_policy_dev_index]], f flags[send_flags])
    25  sendmsg$NFC_CMD_START_POLL(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_START_POLL, nfc_genl_policy_START_POLL]], f flags[send_flags])
    26  sendmsg$NFC_CMD_ACTIVATE_TARGET(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_ACTIVATE_TARGET, nfc_genl_policy_ACTIVATE_TARGET]], f flags[send_flags])
    27  sendmsg$NFC_CMD_DEACTIVATE_TARGET(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_DEACTIVATE_TARGET, nfc_genl_policy_DEACTIVATE_TARGET]], f flags[send_flags])
    28  sendmsg$NFC_CMD_DEP_LINK_UP(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_DEP_LINK_UP, nfc_genl_policy_DEP_LINK_UP]], f flags[send_flags])
    29  sendmsg$NFC_CMD_DEP_LINK_DOWN(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_DEP_LINK_DOWN, nfc_genl_policy_DEP_LINK_DOWN]], f flags[send_flags])
    30  sendmsg$NFC_CMD_GET_TARGET(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_GET_TARGET, void]], f flags[send_flags])
    31  sendmsg$NFC_CMD_LLC_GET_PARAMS(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_LLC_GET_PARAMS, nfc_genl_policy_LLC_GET_PARAMS]], f flags[send_flags])
    32  sendmsg$NFC_CMD_LLC_SET_PARAMS(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_LLC_SET_PARAMS, nfc_genl_policy_LLC_SET_PARAMS]], f flags[send_flags])
    33  sendmsg$NFC_CMD_LLC_SDREQ(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_LLC_SDREQ, nfc_genl_policy_LLC_SDREQ]], f flags[send_flags])
    34  sendmsg$NFC_CMD_ENABLE_SE(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_ENABLE_SE, nfc_genl_policy_se]], f flags[send_flags])
    35  sendmsg$NFC_CMD_DISABLE_SE(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_DISABLE_SE, nfc_genl_policy_se]], f flags[send_flags])
    36  sendmsg$NFC_CMD_FW_DOWNLOAD(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_FW_DOWNLOAD, nfc_genl_policy_FW_DOWNLOAD]], f flags[send_flags])
    37  sendmsg$NFC_CMD_GET_SE(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_GET_SE, void]], f flags[send_flags])
    38  sendmsg$NFC_CMD_SE_IO(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_SE_IO, nfc_genl_policy_SE_IO]], f flags[send_flags])
    39  sendmsg$NFC_CMD_VENDOR(fd sock_nl_generic_init, msg ptr[in, msghdr_nl_nfc[NFC_CMD_VENDOR, nfc_genl_policy_VENDOR]], f flags[send_flags])
    40  
    41  nfc_genl_policy_dev_index [
    42  	NFC_ATTR_DEVICE_INDEX	nlattr[NFC_ATTR_DEVICE_INDEX, nfc_dev_id]
    43  ] [varlen]
    44  
    45  nfc_genl_policy_START_POLL [
    46  	NFC_ATTR_DEVICE_INDEX	nlattr[NFC_ATTR_DEVICE_INDEX, nfc_dev_id]
    47  	NFC_ATTR_PROTOCOLS	nlattr[NFC_ATTR_PROTOCOLS, flags[nfc_proto_mask, int32]]
    48  	NFC_ATTR_IM_PROTOCOLS	nlattr[NFC_ATTR_IM_PROTOCOLS, flags[nfc_proto_mask, int32]]
    49  	NFC_ATTR_TM_PROTOCOLS	nlattr[NFC_ATTR_TM_PROTOCOLS, flags[nfc_proto_mask, int32]]
    50  ] [varlen]
    51  
    52  nfc_genl_policy_ACTIVATE_TARGET [
    53  	NFC_ATTR_DEVICE_INDEX	nlattr[NFC_ATTR_DEVICE_INDEX, nfc_dev_id]
    54  	NFC_ATTR_TARGET_INDEX	nlattr[NFC_ATTR_TARGET_INDEX, nfc_target_idx]
    55  	NFC_ATTR_PROTOCOLS	nlattr[NFC_ATTR_PROTOCOLS, flags[nfc_proto, int32]]
    56  ] [varlen]
    57  
    58  nfc_genl_policy_DEACTIVATE_TARGET [
    59  	NFC_ATTR_DEVICE_INDEX	nlattr[NFC_ATTR_DEVICE_INDEX, nfc_dev_id]
    60  	NFC_ATTR_TARGET_INDEX	nlattr[NFC_ATTR_TARGET_INDEX, nfc_target_idx]
    61  ] [varlen]
    62  
    63  nfc_genl_policy_DEP_LINK_UP [
    64  	NFC_ATTR_DEVICE_INDEX	nlattr[NFC_ATTR_DEVICE_INDEX, nfc_dev_id]
    65  	NFC_ATTR_TARGET_INDEX	nlattr[NFC_ATTR_TARGET_INDEX, nfc_target_idx]
    66  	NFC_ATTR_COMM_MODE	nlattr[NFC_ATTR_COMM_MODE, flags[nfc_comm_mode, int8]]
    67  ] [varlen]
    68  
    69  nfc_genl_policy_DEP_LINK_DOWN [
    70  	NFC_ATTR_DEVICE_INDEX	nlattr[NFC_ATTR_DEVICE_INDEX, nfc_dev_id]
    71  	NFC_ATTR_TARGET_INDEX	nlattr[NFC_ATTR_TARGET_INDEX, nfc_target_idx]
    72  ] [varlen]
    73  
    74  nfc_genl_policy_LLC_GET_PARAMS [
    75  	NFC_ATTR_DEVICE_INDEX	nlattr[NFC_ATTR_DEVICE_INDEX, nfc_dev_id]
    76  	NFC_ATTR_FIRMWARE_NAME	nlattr[NFC_ATTR_FIRMWARE_NAME, stringnoz]
    77  ] [varlen]
    78  
    79  nfc_genl_policy_LLC_SET_PARAMS [
    80  	NFC_ATTR_DEVICE_INDEX	nlattr[NFC_ATTR_DEVICE_INDEX, nfc_dev_id]
    81  	NFC_ATTR_LLC_PARAM_LTO	nlattr[NFC_ATTR_LLC_PARAM_LTO, int8]
    82  	NFC_ATTR_LLC_PARAM_RW	nlattr[NFC_ATTR_LLC_PARAM_RW, int8[0:LLCP_MAX_RW]]
    83  	NFC_ATTR_LLC_PARAM_MIUX	nlattr[NFC_ATTR_LLC_PARAM_MIUX, int16[0:LLCP_MAX_MIUX]]
    84  ] [varlen]
    85  
    86  nfc_genl_policy_se [
    87  	NFC_ATTR_DEVICE_INDEX	nlattr[NFC_ATTR_DEVICE_INDEX, nfc_dev_id]
    88  	NFC_ATTR_SE_INDEX	nlattr[NFC_ATTR_SE_INDEX, flags[nfc_se_index, int32]]
    89  ] [varlen]
    90  
    91  nfc_genl_policy_LLC_SDREQ [
    92  	NFC_ATTR_DEVICE_INDEX	nlattr[NFC_ATTR_DEVICE_INDEX, nfc_dev_id]
    93  	NFC_ATTR_LLC_SDP	nlnest[NFC_ATTR_LLC_SDP, array[nlnest[0, array[nlattr[NFC_SDP_ATTR_URI, stringnoz]]]]]
    94  ] [varlen]
    95  
    96  nfc_genl_policy_FW_DOWNLOAD [
    97  	NFC_ATTR_DEVICE_INDEX	nlattr[NFC_ATTR_DEVICE_INDEX, nfc_dev_id]
    98  	NFC_ATTR_FIRMWARE_NAME	nlattr[NFC_ATTR_FIRMWARE_NAME, stringnoz]
    99  ] [varlen]
   100  
   101  nfc_genl_policy_SE_IO [
   102  	NFC_ATTR_DEVICE_INDEX	nlattr[NFC_ATTR_DEVICE_INDEX, nfc_dev_id]
   103  	NFC_ATTR_SE_INDEX	nlattr[NFC_ATTR_SE_INDEX, flags[nfc_se_index, int32]]
   104  	NFC_ATTR_SE_APDU	nlattr[NFC_ATTR_SE_APDU, array[int8]]
   105  ] [varlen]
   106  
   107  nfc_genl_policy_VENDOR [
   108  	NFC_ATTR_DEVICE_INDEX	nlattr[NFC_ATTR_DEVICE_INDEX, nfc_dev_id]
   109  	NFC_ATTR_VENDOR_ID	nlattr[NFC_ATTR_VENDOR_ID, int32]
   110  	NFC_ATTR_VENDOR_SUBCMD	nlattr[NFC_ATTR_VENDOR_SUBCMD, int32]
   111  	NFC_ATTR_VENDOR_DATA	nlattr[NFC_ATTR_VENDOR_DATA, array[int8]]
   112  ] [varlen]
   113  
   114  nfc_comm_mode = NFC_COMM_ACTIVE, NFC_COMM_PASSIVE
   115  # These are taken from nfc_add_se() arguments.
   116  nfc_se_index = 0, 1, 2, 192