Skip to content

Commit 0891c89

Browse files
vsridhar86anguy11
authored andcommitted
ice: warn about potentially malicious VFs
Attempt to detect malicious VFs and, if suspected, log the information but keep going to allow the user to take any desired actions. Potentially malicious VFs are identified by checking if the VFs are transmitting too many messages via the PF-VF mailbox which could cause an overflow of this channel resulting in denial of service. This is done by creating a snapshot or static capture of the mailbox buffer which can be traversed and in which the messages sent by VFs are tracked. Co-developed-by: Yashaswini Raghuram Prathivadi Bhayankaram <[email protected]> Signed-off-by: Yashaswini Raghuram Prathivadi Bhayankaram <[email protected]> Co-developed-by: Paul M Stillwell Jr <[email protected]> Signed-off-by: Paul M Stillwell Jr <[email protected]> Co-developed-by: Brett Creeley <[email protected]> Signed-off-by: Brett Creeley <[email protected]> Signed-off-by: Vignesh Sridhar <[email protected]> Tested-by: Konrad Jankowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 5d86907 commit 0891c89

File tree

7 files changed

+605
-4
lines changed

7 files changed

+605
-4
lines changed

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ struct ice_pf {
426426
u16 num_msix_per_vf;
427427
/* used to ratelimit the MDD event logging */
428428
unsigned long last_printed_mdd_jiffies;
429+
DECLARE_BITMAP(malvfs, ICE_MAX_VF_COUNT);
429430
DECLARE_BITMAP(state, ICE_STATE_NBITS);
430431
DECLARE_BITMAP(flags, ICE_PF_FLAGS_NBITS);
431432
unsigned long *avail_txqs; /* bitmap to track PF Tx queue usage */

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1193,6 +1193,10 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type)
11931193
case ICE_CTL_Q_MAILBOX:
11941194
cq = &hw->mailboxq;
11951195
qtype = "Mailbox";
1196+
/* we are going to try to detect a malicious VF, so set the
1197+
* state to begin detection
1198+
*/
1199+
hw->mbx_snapshot.mbx_buf.state = ICE_MAL_VF_DETECT_STATE_NEW_SNAPSHOT;
11961200
break;
11971201
default:
11981202
dev_warn(dev, "Unknown control queue type 0x%x\n", q_type);
@@ -1274,7 +1278,8 @@ static int __ice_clean_ctrlq(struct ice_pf *pf, enum ice_ctl_q q_type)
12741278
ice_vf_lan_overflow_event(pf, &event);
12751279
break;
12761280
case ice_mbx_opc_send_msg_to_pf:
1277-
ice_vc_process_vf_msg(pf, &event);
1281+
if (!ice_is_malicious_vf(pf, &event, i, pending))
1282+
ice_vc_process_vf_msg(pf, &event);
12781283
break;
12791284
case ice_aqc_opc_fw_logging:
12801285
ice_output_fw_log(hw, &event.desc, event.msg_buf);

0 commit comments

Comments
 (0)