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: <CAC_iWjLsd-hJs1gk3CknJFXb2H4aAeEUUUskzPEugeRHjRuWLg@mail.gmail.com>
Date:   Thu, 8 Jul 2021 19:30:31 +0300
From:   Ilias Apalodimas <ilias.apalodimas@...aro.org>
To:     Networking <netdev@...r.kernel.org>,
        Alexander Duyck <alexander.duyck@...il.com>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Alexander Lobakin <alobakin@...me>,
        Jonathan Lemon <jonathan.lemon@...il.com>,
        Willem de Bruijn <willemb@...gle.com>,
        Miaohe Lin <linmiaohe@...wei.com>,
        Guillaume Nault <gnault@...hat.com>,
        Cong Wang <cong.wang@...edance.com>,
        Jesper Dangaard Brouer <brouer@...hat.com>,
        Matteo Croce <mcroce@...rosoft.com>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] skbuff: Fix a potential race while recycling page_pool packets

+cc Alexander on his gmail address since the Intel one bounced.

Alexander want me to respin it with you gmail address on the Reported-by?

Sorry for the noise
/Ilias

On Thu, 8 Jul 2021 at 19:24, Ilias Apalodimas
<ilias.apalodimas@...aro.org> wrote:
>
> As Alexander points out, when we are trying to recycle a cloned/expanded
> SKB we might trigger a race.  The recycling code relies on the
> pp_recycle bit to trigger,  which we carry that over to cloned SKBs.
> When that cloned SKB gets expanded,  we are creating 2 separate instances
> accessing the page frags.  Since the skb_release_data() will first try to
> recycle the frags,  there's a potential race between the original and
> cloned SKB.
>
> Fix this by explicitly making the cloned/expanded SKB not recyclable.
> If the original SKB is freed first the pages are released.
> If it is released after the clone/expended skb then it can still be
> recycled.
>
> Fixes: 6a5bcd84e886 ("page_pool: Allow drivers to hint on SKB recycling")
> Reported-by: Alexander Duyck <alexander.h.duyck@...ux.intel.com>
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@...aro.org>
> ---
>  net/core/skbuff.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 12aabcda6db2..0cb53c05ed76 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -1718,6 +1718,13 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
>         }
>         off = (data + nhead) - skb->head;
>
> +       /* If it's a cloned skb we expand with frags attached we must prohibit
> +        * the recycling code from running, otherwise we might trigger a race
> +        * while trying to recycle the fragments from the original and cloned
> +        * skb
> +        */
> +       if (skb_cloned(skb))
> +               skb->pp_recycle = 0;
>         skb->head     = data;
>         skb->head_frag = 0;
>         skb->data    += off;
> --
> 2.32.0.rc0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ