netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>,
	davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@google.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 00/14][pull request] ice: refactor mailbox overflow detection
Date: Wed, 15 Mar 2023 11:01:52 +0200	[thread overview]
Message-ID: <20230315090152.GS36557@unreal> (raw)
In-Reply-To: <c58fe076-3425-394f-b7da-c6df6ac45d98@intel.com>

On Tue, Mar 14, 2023 at 02:26:10PM -0700, Jacob Keller wrote:
> 
> 
> On 3/14/2023 6:57 AM, Leon Romanovsky wrote:
> > On Mon, Mar 13, 2023 at 11:21:09AM -0700, Tony Nguyen wrote:
> >> Jake Keller says:
> >>
> >> The primary motivation of this series is to cleanup and refactor the mailbox
> >> overflow detection logic such that it will work with Scalable IOV. In
> >> addition a few other minor cleanups are done while I was working on the
> >> code in the area.
> >>
> >> First, the mailbox overflow functions in ice_vf_mbx.c are refactored to
> >> store the data per-VF as an embedded structure in struct ice_vf, rather than
> >> stored separately as a fixed-size array which only works with Single Root
> >> IOV. This reduces the overall memory footprint when only a handful of VFs
> >> are used.
> >>
> >> The overflow detection functions are also cleaned up to reduce the need for
> >> multiple separate calls to determine when to report a VF as potentially
> >> malicious.
> >>
> >> Finally, the ice_is_malicious_vf function is cleaned up and moved into
> >> ice_virtchnl.c since it is not Single Root IOV specific, and thus does not
> >> belong in ice_sriov.c
> >>
> >> I could probably have done this in fewer patches, but I split pieces out to
> >> hopefully aid in reviewing the overall sequence of changes. This does cause
> >> some additional thrash as it results in intermediate versions of the
> >> refactor, but I think its worth it for making each step easier to
> >> understand.
> >>
> >> The following are changes since commit 95b744508d4d5135ae2a096ff3f0ee882bcc52b3:
> >>   qede: remove linux/version.h and linux/compiler.h
> >> and are available in the git repository at:
> >>   git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue 100GbE
> >>
> >> Jacob Keller (14):
> >>   ice: re-order ice_mbx_reset_snapshot function
> >>   ice: convert ice_mbx_clear_malvf to void and use WARN
> >>   ice: track malicious VFs in new ice_mbx_vf_info structure
> >>   ice: move VF overflow message count into struct ice_mbx_vf_info
> >>   ice: remove ice_mbx_deinit_snapshot
> >>   ice: merge ice_mbx_report_malvf with ice_mbx_vf_state_handler
> >>   ice: initialize mailbox snapshot earlier in PF init
> >>   ice: declare ice_vc_process_vf_msg in ice_virtchnl.h
> >>   ice: always report VF overflowing mailbox even without PF VSI
> >>   ice: remove unnecessary &array[0] and just use array
> >>   ice: pass mbxdata to ice_is_malicious_vf()
> >>   ice: print message if ice_mbx_vf_state_handler returns an error
> >>   ice: move ice_is_malicious_vf() to ice_virtchnl.c
> >>   ice: call ice_is_malicious_vf() from ice_vc_process_vf_msg()
> > 
> > Everything looks legit except your anti-spamming logic which IMHO
> > shouldn't happen in first place.
> > 
> 
> Without the checks there's no warning to the system administrator that a
> VM may have been misconfigured or modified to spam messages. If this
> occurs, the VM can overload the PF's mailbox queue and prevent other VFs
> from using the queue normally, and thus performing a denial of service.
> 
> My understanding (I was not involved in the original implementation or
> discussions) is that there is no hardware mechanism to prevent such
> overflow in this device. This is an oversight in the design which was
> not caught until it was too late to make such a change.
> 
> The original checks were added in 0891c89674e8 ("ice: warn about
> potentially malicious VFs"), but it seems that commit message did not
> provide much detail :(

Thanks for the explanation.

> 
> -Jake
> 
> > Thanks,
> > Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

  reply	other threads:[~2023-03-15  9:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-13 18:21 [PATCH net-next 00/14][pull request] ice: refactor mailbox overflow detection Tony Nguyen
2023-03-13 18:21 ` [PATCH net-next 01/14] ice: re-order ice_mbx_reset_snapshot function Tony Nguyen
2023-03-14 13:41   ` Leon Romanovsky
2023-03-13 18:21 ` [PATCH net-next 02/14] ice: convert ice_mbx_clear_malvf to void and use WARN Tony Nguyen
2023-03-14 13:41   ` Leon Romanovsky
2023-03-13 18:21 ` [PATCH net-next 03/14] ice: track malicious VFs in new ice_mbx_vf_info structure Tony Nguyen
2023-03-14 13:43   ` Leon Romanovsky
2023-03-14 21:20     ` Keller, Jacob E
2023-03-13 18:21 ` [PATCH net-next 04/14] ice: move VF overflow message count into struct ice_mbx_vf_info Tony Nguyen
2023-03-13 18:21 ` [PATCH net-next 05/14] ice: remove ice_mbx_deinit_snapshot Tony Nguyen
2023-03-14 13:48   ` Leon Romanovsky
2023-03-13 18:21 ` [PATCH net-next 06/14] ice: merge ice_mbx_report_malvf with ice_mbx_vf_state_handler Tony Nguyen
2023-03-13 18:21 ` [PATCH net-next 07/14] ice: initialize mailbox snapshot earlier in PF init Tony Nguyen
2023-03-14 13:50   ` Leon Romanovsky
2023-03-13 18:21 ` [PATCH net-next 08/14] ice: declare ice_vc_process_vf_msg in ice_virtchnl.h Tony Nguyen
2023-03-13 18:21 ` [PATCH net-next 09/14] ice: always report VF overflowing mailbox even without PF VSI Tony Nguyen
2023-03-13 18:21 ` [PATCH net-next 10/14] ice: remove unnecessary &array[0] and just use array Tony Nguyen
2023-03-13 18:21 ` [PATCH net-next 11/14] ice: pass mbxdata to ice_is_malicious_vf() Tony Nguyen
2023-03-13 18:21 ` [PATCH net-next 12/14] ice: print message if ice_mbx_vf_state_handler returns an error Tony Nguyen
2023-03-13 18:21 ` [PATCH net-next 13/14] ice: move ice_is_malicious_vf() to ice_virtchnl.c Tony Nguyen
2023-03-13 18:21 ` [PATCH net-next 14/14] ice: call ice_is_malicious_vf() from ice_vc_process_vf_msg() Tony Nguyen
2023-03-14 13:57 ` [PATCH net-next 00/14][pull request] ice: refactor mailbox overflow detection Leon Romanovsky
2023-03-14 21:26   ` Jacob Keller
2023-03-15  9:01     ` Leon Romanovsky [this message]
2023-03-16  4:40 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230315090152.GS36557@unreal \
    --to=leon@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).