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

     1  # Create NCI NFC device.
     2  
     3  r0 = openat$nci(AUTO, &AUTO, AUTO, AUTO)
     4  ioctl$IOCTL_GET_NCIDEV_IDX(r0, AUTO, &AUTO=<r1=>0x0)
     5  
     6  # Up the device.
     7  
     8  r2 = syz_init_net_socket$nl_generic(AUTO, AUTO, AUTO)
     9  r3 = syz_genetlink_get_family_id$nfc(&AUTO, r2)
    10  sendmsg$NFC_CMD_DEV_UP(r2, &AUTO={0x0, 0x0, &AUTO={&AUTO={AUTO, r3, 0x1, 0x123, 0x234, {AUTO, 0x0, 0x0}, [@NFC_ATTR_DEVICE_INDEX={AUTO, AUTO, r1, nil}]}, AUTO}, 0x1, 0x0, 0x0, 0x0}, 0x0)
    11  
    12  # Mock communication with the device.
    13  # NCI core should send reset, init and discover commands.
    14  
    15  read$nci(r0, &AUTO=""/100, AUTO)
    16  write$nci(r0, &AUTO=@NCI_OP_CORE_RESET_RSP={AUTO, 0x0, AUTO, AUTO, 0x0, {0x0, 0x0, 0x0}}, AUTO)
    17  read$nci(r0, &AUTO=""/100, AUTO)
    18  write$nci(r0, &AUTO=@NCI_OP_CORE_INIT_RSP={AUTO, 0x0, AUTO, AUTO, 0x0, {{0x0, 0x0, 0x0, ""}, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}}, AUTO)
    19  read$nci(r0, &AUTO=""/100, AUTO)
    20  write$nci(r0, &AUTO=@NCI_OP_RF_DISCOVER_MAP_RSP={AUTO, 0x0, AUTO, AUTO, 0x0, 0x0}, AUTO)
    21  
    22  # Enable polling.
    23  
    24  sendmsg$NFC_CMD_START_POLL(r2, &AUTO={0x0, 0x0, &AUTO={&AUTO={AUTO, r3, 0x1, 0x123, 0x234, {AUTO, 0x0, 0x0}, [@NFC_ATTR_DEVICE_INDEX={AUTO, AUTO, r1, nil}, @NFC_ATTR_PROTOCOLS={AUTO, AUTO, 0xffffffff, nil}]}, AUTO}, 0x1, 0x0, 0x0, 0x0}, 0x0)
    25  
    26  read$nci(r0, &AUTO=""/100, AUTO)
    27  write$nci(r0, &AUTO=@NCI_OP_CORE_SET_CONFIG_RSP={AUTO, 0x0, AUTO, AUTO, 0x0, {0x0, 0x0, ""}}, AUTO)
    28  read$nci(r0, &AUTO=""/100, AUTO)
    29  write$nci(r0, &AUTO=@NCI_OP_CORE_SET_CONFIG_RSP={AUTO, 0x0, AUTO, AUTO, 0x0, {0x0, 0x0, ""}}, AUTO)
    30  read$nci(r0, &AUTO=""/100, AUTO)
    31  write$nci(r0, &AUTO=@NCI_OP_RF_DISCOVER_RSP={AUTO, 0x0, AUTO, AUTO, 0x0, 0x0}, AUTO)
    32  
    33  # Pretend we discovered target 0.
    34  
    35  write$nci(r0, &AUTO=@NCI_OP_RF_DISCOVER_NTF={AUTO, 0x0, AUTO, AUTO, 0x0, @b={0x0, 0x1, AUTO, 0x1, {0x1, "aa"}, 0x0}}, AUTO)
    36  
    37  # Activate target 0.
    38  
    39  sendmsg$NFC_CMD_ACTIVATE_TARGET(r2, &AUTO={0x0, 0x0, &AUTO={&AUTO={AUTO, r3, 0x1, 0x123, 0x234, {AUTO, 0x0, 0x0}, [@NFC_ATTR_DEVICE_INDEX={AUTO, AUTO, r1, nil}, @NFC_ATTR_TARGET_INDEX={AUTO, AUTO, 0x0, nil}, @NFC_ATTR_PROTOCOLS={AUTO, AUTO, 0x1, nil}]}, AUTO}, 0x1, 0x0, 0x0, 0x0}, 0x0)
    40  
    41  read$nci(r0, &AUTO=""/100, AUTO)
    42  write$nci(r0, &AUTO=@NCI_OP_CORE_CONN_CREATE_RSP={AUTO, 0x0, AUTO, AUTO, 0x0, {0x0, 0x0, 0x0, 0x1}}, AUTO)
    43