lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACKFLikZfjMnK3gwJ=xP8Hb3Bfu8CYa1NMGqHJj7ChcJTWwjmg@mail.gmail.com>
Date: Thu, 27 Jul 2023 11:52:10 -0700
From: Michael Chan <michael.chan@...adcom.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com, 
	pabeni@...hat.com, gospo@...adcom.com
Subject: Re: [PATCH net] bnxt: don't handle XDP in netpoll

On Thu, Jul 27, 2023 at 10:05 AM Jakub Kicinski <kuba@...nel.org> wrote:
>
> Similarly to other recently fixed drivers make sure we don't
> try to access XDP or page pool APIs when NAPI budget is 0.
> NAPI budget of 0 may mean that we are in netpoll.
>
> This may result in running software IRQs in hard IRQ context,
> leading to deadlocks or crashes.
>
> Fixes: 322b87ca55f2 ("bnxt_en: add page_pool support")
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> CC: michael.chan@...adcom.com
> CC: gospo@...adcom.com
>
> Side note - having to plumb the "budget" everywhere really makes
> me wonder if we shouldn't have had those APIs accept a pointer
> to napi_struct instead :S
> ---
>  drivers/net/ethernet/broadcom/bnxt/bnxt.c     | 19 +++++++++++--------
>  drivers/net/ethernet/broadcom/bnxt/bnxt.h     |  2 +-
>  drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c |  6 +++++-
>  drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h |  3 ++-
>  4 files changed, 19 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c
> index 5b6fbdc4dc40..33b7eddfbf41 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c
> @@ -125,7 +125,8 @@ static void __bnxt_xmit_xdp_redirect(struct bnxt *bp,
>         dma_unmap_len_set(tx_buf, len, 0);
>  }
>
> -void bnxt_tx_int_xdp(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)
> +void bnxt_tx_int_xdp(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts,
> +                    int budget)
>  {
>         struct bnxt_tx_ring_info *txr = bnapi->tx_ring;
>         struct bnxt_rx_ring_info *rxr = bnapi->rx_ring;
> @@ -135,6 +136,9 @@ void bnxt_tx_int_xdp(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)
>         u16 last_tx_cons = tx_cons;
>         int i, j, frags;
>
> +       if (!budget)
> +               return;
> +

These TX packet completions have already been counted in
__bnxt_poll_work().  If we do nothing here, I think the TX ring will
forever be out-of-sync with the completion ring.

Download attachment "smime.p7s" of type "application/pkcs7-signature" (4209 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ