github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/socket_netlink_generic_netlabel.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/linux/genetlink.h>
     7  include <net/netlabel.h>
     8  include <net/cipso_ipv4.h>
     9  include <net/calipso.h>
    10  include <net/netlabel/netlabel_mgmt.h>
    11  include <net/netlabel/netlabel_unlabeled.h>
    12  include <net/netlabel/netlabel_cipso_v4.h>
    13  include <net/netlabel/netlabel_calipso.h>
    14  
    15  # MGMT
    16  
    17  resource netlbl_mgmt_family_id[int16]
    18  type msghdr_netlbl_mgmt[CMD] msghdr_netlink[netlink_msg_t[netlbl_mgmt_family_id, genlmsghdr_t[CMD], netlbl_mgmt_genl_policy]]
    19  
    20  syz_genetlink_get_family_id$netlbl_mgmt(name ptr[in, string["NLBL_MGMT"]], fd sock_nl_generic_init) netlbl_mgmt_family_id
    21  
    22  sendmsg$NLBL_MGMT_C_ADD(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_mgmt[NLBL_MGMT_C_ADD]], f flags[send_flags])
    23  sendmsg$NLBL_MGMT_C_REMOVE(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_mgmt[NLBL_MGMT_C_REMOVE]], f flags[send_flags])
    24  sendmsg$NLBL_MGMT_C_LISTALL(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_mgmt[NLBL_MGMT_C_LISTALL]], f flags[send_flags])
    25  sendmsg$NLBL_MGMT_C_ADDDEF(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_mgmt[NLBL_MGMT_C_ADDDEF]], f flags[send_flags])
    26  sendmsg$NLBL_MGMT_C_REMOVEDEF(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_mgmt[NLBL_MGMT_C_REMOVEDEF]], f flags[send_flags])
    27  sendmsg$NLBL_MGMT_C_LISTDEF(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_mgmt[NLBL_MGMT_C_LISTDEF]], f flags[send_flags])
    28  sendmsg$NLBL_MGMT_C_PROTOCOLS(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_mgmt[NLBL_MGMT_C_PROTOCOLS]], f flags[send_flags])
    29  sendmsg$NLBL_MGMT_C_VERSION(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_mgmt[NLBL_MGMT_C_VERSION]], f flags[send_flags])
    30  
    31  netlbl_mgmt_genl_policy [
    32  # NLBL_MGMT_A_VERSION, NLBL_MGMT_A_ADDRSELECTOR, NLBL_MGMT_A_SELECTORLIST are output.
    33  	NLBL_MGMT_A_DOMAIN	nlattr[NLBL_MGMT_A_DOMAIN, string]
    34  	NLBL_MGMT_A_PROTOCOL	nlattr[NLBL_MGMT_A_PROTOCOL, flags[nlbl_mgmt_protocol, int32]]
    35  	NLBL_MGMT_A_CV4DOI	nlattr[NLBL_MGMT_A_CV4DOI, flags[cipso_doi, int32]]
    36  	NLBL_MGMT_A_FAMILY	nlattr[NLBL_MGMT_A_FAMILY, flags[socket_domain, int16]]
    37  	NLBL_MGMT_A_CLPDOI	nlattr[NLBL_MGMT_A_CLPDOI, flags[calipso_doi, int32]]
    38  	NLBL_MGMT_A_IPV6ADDR	nlattr[NLBL_MGMT_A_IPV6ADDR, ipv6_addr]
    39  	NLBL_MGMT_A_IPV6MASK	nlattr[NLBL_MGMT_A_IPV6MASK, ipv6_addr]
    40  	NLBL_MGMT_A_IPV4ADDR	nlattr[NLBL_MGMT_A_IPV4ADDR, ipv4_addr]
    41  	NLBL_MGMT_A_IPV4MASK	nlattr[NLBL_MGMT_A_IPV4MASK, ipv4_addr]
    42  ] [varlen]
    43  
    44  nlbl_mgmt_protocol = NETLBL_NLTYPE_UNLABELED, NETLBL_NLTYPE_CIPSOV4, NETLBL_NLTYPE_CALIPSO
    45  
    46  # UNLABELLED
    47  
    48  resource netlbl_unlabel_family_id[int16]
    49  type msghdr_netlbl_unlabel[CMD] msghdr_netlink[netlink_msg_t[netlbl_unlabel_family_id, genlmsghdr_t[CMD], netlbl_unlabel_genl_policy]]
    50  
    51  syz_genetlink_get_family_id$netlbl_unlabel(name ptr[in, string["NLBL_UNLBL"]], fd sock_nl_generic_init) netlbl_unlabel_family_id
    52  
    53  sendmsg$NLBL_UNLABEL_C_STATICADD(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_unlabel[NLBL_UNLABEL_C_STATICADD]], f flags[send_flags])
    54  sendmsg$NLBL_UNLABEL_C_STATICREMOVE(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_unlabel[NLBL_UNLABEL_C_STATICREMOVE]], f flags[send_flags])
    55  sendmsg$NLBL_UNLABEL_C_STATICLIST(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_unlabel[NLBL_UNLABEL_C_STATICLIST]], f flags[send_flags])
    56  sendmsg$NLBL_UNLABEL_C_STATICADDDEF(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_unlabel[NLBL_UNLABEL_C_STATICADDDEF]], f flags[send_flags])
    57  sendmsg$NLBL_UNLABEL_C_STATICREMOVEDEF(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_unlabel[NLBL_UNLABEL_C_STATICREMOVEDEF]], f flags[send_flags])
    58  sendmsg$NLBL_UNLABEL_C_STATICLISTDEF(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_unlabel[NLBL_UNLABEL_C_STATICLISTDEF]], f flags[send_flags])
    59  sendmsg$NLBL_UNLABEL_C_ACCEPT(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_unlabel[NLBL_UNLABEL_C_ACCEPT]], f flags[send_flags])
    60  sendmsg$NLBL_UNLABEL_C_LIST(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_unlabel[NLBL_UNLABEL_C_LIST]], f flags[send_flags])
    61  
    62  netlbl_unlabel_genl_policy [
    63  	NLBL_UNLABEL_A_ACPTFLG	nlattr[NLBL_UNLABEL_A_ACPTFLG, bool8]
    64  	NLBL_UNLABEL_A_IPV6ADDR	nlattr[NLBL_UNLABEL_A_IPV6ADDR, ipv6_addr]
    65  	NLBL_UNLABEL_A_IPV6MASK	nlattr[NLBL_UNLABEL_A_IPV6MASK, ipv6_addr]
    66  	NLBL_UNLABEL_A_IPV4ADDR	nlattr[NLBL_UNLABEL_A_IPV4ADDR, ipv4_addr]
    67  	NLBL_UNLABEL_A_IPV4MASK	nlattr[NLBL_UNLABEL_A_IPV4MASK, ipv4_addr]
    68  	NLBL_UNLABEL_A_IFACE	nlattr[NLBL_UNLABEL_A_IFACE, devname]
    69  	NLBL_UNLABEL_A_SECCTX	nlattr[NLBL_UNLABEL_A_SECCTX, string[selinux_security_context]]
    70  ] [varlen]
    71  
    72  # CIPSO v4
    73  
    74  resource netlbl_cipsov4_family_id[int16]
    75  type msghdr_netlbl_cipsov4[CMD] msghdr_netlink[netlink_msg_t[netlbl_cipsov4_family_id, genlmsghdr_t[CMD], netlbl_cipsov4_genl_policy]]
    76  
    77  syz_genetlink_get_family_id$netlbl_cipso(name ptr[in, string["NLBL_CIPSOv4"]], fd sock_nl_generic_init) netlbl_cipsov4_family_id
    78  
    79  sendmsg$NLBL_CIPSOV4_C_ADD(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_cipsov4[NLBL_CIPSOV4_C_ADD]], f flags[send_flags])
    80  sendmsg$NLBL_CIPSOV4_C_REMOVE(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_cipsov4[NLBL_CIPSOV4_C_REMOVE]], f flags[send_flags])
    81  sendmsg$NLBL_CIPSOV4_C_LIST(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_cipsov4[NLBL_CIPSOV4_C_LIST]], f flags[send_flags])
    82  sendmsg$NLBL_CIPSOV4_C_LISTALL(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_cipsov4[NLBL_CIPSOV4_C_LISTALL]], f flags[send_flags])
    83  
    84  netlbl_cipsov4_genl_policy [
    85  	NLBL_CIPSOV4_A_DOI		nlattr[NLBL_CIPSOV4_A_DOI, flags[cipso_doi, int32]]
    86  	NLBL_CIPSOV4_A_MTYPE		nlattr[NLBL_CIPSOV4_A_MTYPE, flags[cipsov4_type, int32]]
    87  	NLBL_CIPSOV4_A_TAGLST		nlnest[NLBL_CIPSOV4_A_TAGLST, array[nlattr[NLBL_CIPSOV4_A_TAG, flags[cipsov4_tags, int8]]]]
    88  	NLBL_CIPSOV4_A_MLSLVLLST	nlnest[NLBL_CIPSOV4_A_MLSLVLLST, array[nlnest[NLBL_CIPSOV4_A_MLSLVL, array[netlbl_cipsov4_genl_policy$mlslvl]]]]
    89  	NLBL_CIPSOV4_A_MLSCATLST	nlnest[NLBL_CIPSOV4_A_MLSCATLST, array[nlnest[NLBL_CIPSOV4_A_MLSCAT, array[netlbl_cipsov4_genl_policy$mlscat]]]]
    90  ] [varlen]
    91  
    92  netlbl_cipsov4_genl_policy$mlslvl [
    93  	NLBL_CIPSOV4_A_MLSLVLLOC	nlattr[NLBL_CIPSOV4_A_MLSLVLLOC, int32[0:CIPSO_V4_MAX_LOC_LVLS]]
    94  	NLBL_CIPSOV4_A_MLSLVLREM	nlattr[NLBL_CIPSOV4_A_MLSLVLREM, int32[0:CIPSO_V4_MAX_REM_LVLS]]
    95  ] [varlen]
    96  
    97  netlbl_cipsov4_genl_policy$mlscat [
    98  	NLBL_CIPSOV4_A_MLSCATLOC	nlattr[NLBL_CIPSOV4_A_MLSCATLOC, int32[0:CIPSO_V4_MAX_LOC_CATS]]
    99  	NLBL_CIPSOV4_A_MLSCATREM	nlattr[NLBL_CIPSOV4_A_MLSCATREM, int32[0:CIPSO_V4_MAX_REM_CATS]]
   100  ] [varlen]
   101  
   102  cipsov4_type = CIPSO_V4_MAP_TRANS, CIPSO_V4_MAP_PASS, CIPSO_V4_MAP_LOCAL
   103  cipsov4_tags = CIPSO_V4_TAG_INVALID, CIPSO_V4_TAG_RBITMAP, CIPSO_V4_TAG_ENUM, CIPSO_V4_TAG_RANGE, CIPSO_V4_TAG_PBITMAP, CIPSO_V4_TAG_FREEFORM
   104  
   105  # CALIPSO
   106  
   107  resource netlbl_calipso_family_id[int16]
   108  type msghdr_netlbl_calipso[CMD] msghdr_netlink[netlink_msg_t[netlbl_calipso_family_id, genlmsghdr_t[CMD], calipso_genl_policy]]
   109  
   110  syz_genetlink_get_family_id$netlbl_calipso(name ptr[in, string["NLBL_CALIPSO"]], fd sock_nl_generic_init) netlbl_calipso_family_id
   111  
   112  sendmsg$NLBL_CALIPSO_C_ADD(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_calipso[NLBL_CALIPSO_C_ADD]], f flags[send_flags])
   113  sendmsg$NLBL_CALIPSO_C_REMOVE(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_calipso[NLBL_CALIPSO_C_REMOVE]], f flags[send_flags])
   114  sendmsg$NLBL_CALIPSO_C_LIST(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_calipso[NLBL_CALIPSO_C_LIST]], f flags[send_flags])
   115  sendmsg$NLBL_CALIPSO_C_LISTALL(fd sock_nl_generic_init, msg ptr[in, msghdr_netlbl_calipso[NLBL_CALIPSO_C_LISTALL]], f flags[send_flags])
   116  
   117  calipso_genl_policy [
   118  	NLBL_CALIPSO_A_DOI	nlattr[NLBL_CALIPSO_A_DOI, flags[calipso_doi, int32]]
   119  	NLBL_CALIPSO_A_MTYPE	nlattr[NLBL_CALIPSO_A_MTYPE, const[CALIPSO_MAP_PASS, int32]]
   120  ] [varlen]