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] [day] [month] [year] [list]
Message-ID: <CAL+tcoDcUKZygnSmVEuCsECrKY=obHH6K3B2ztHrL+K9kMSPPw@mail.gmail.com>
Date: Fri, 14 Feb 2025 14:13:45 +0800
From: Jason Xing <kerneljasonxing@...il.com>
To: Mina Almasry <almasrymina@...gle.com>
Cc: Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org, davem@...emloft.net, 
	ilias.apalodimas@...aro.org, edumazet@...gle.com, kuba@...nel.org, 
	horms@...nel.org, hawk@...nel.org
Subject: Re: [PATCH v2 net-next] page_pool: avoid infinite loop to schedule
 delayed worker

On Fri, Feb 14, 2025 at 12:10 PM Mina Almasry <almasrymina@...gle.com> wrote:
>
> On Thu, Feb 13, 2025 at 3:43 PM Jason Xing <kerneljasonxing@...il.com> wrote:
> >
> > On Fri, Feb 14, 2025 at 4:14 AM Mina Almasry <almasrymina@...gle.com> wrote:
> > >
> > > On Thu, Feb 13, 2025 at 2:49 AM Jason Xing <kerneljasonxing@...il.com> wrote:
> > > >
> > > > On Thu, Feb 13, 2025 at 4:32 PM Paolo Abeni <pabeni@...hat.com> wrote:
> > > > >
> > > > > On 2/13/25 6:21 AM, Jason Xing wrote:
> > > > > > diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> > > > > > index 1c6fec08bc43..e1f89a19a6b6 100644
> > > > > > --- a/net/core/page_pool.c
> > > > > > +++ b/net/core/page_pool.c
> > > > > > @@ -1112,13 +1112,12 @@ static void page_pool_release_retry(struct work_struct *wq)
> > > > > >       int inflight;
> > > > > >
> > > > > >       inflight = page_pool_release(pool);
> > > > > > -     if (!inflight)
> > > > > > -             return;
> > > > > >
> > > > > >       /* Periodic warning for page pools the user can't see */
> > > > > >       netdev = READ_ONCE(pool->slow.netdev);
> > > > >
> > > > > This causes UaF, as catched by the CI:
> > > > >
> > > > > https://netdev-3.bots.linux.dev/vmksft-net-dbg/results/990441/34-udpgro-bench-sh/stderr
> > > > >
> > > > > at this point 'inflight' could be 0 and 'pool' already freed.
> > > >
> > > > Oh, right, thanks for catching that.
> > > >
> > > > I'm going to use the previous approach (one-liner with a few comments):
> > > > diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> > > > index 1c6fec08bc43..209b5028abd7 100644
> > > > --- a/net/core/page_pool.c
> > > > +++ b/net/core/page_pool.c
> > > > @@ -1112,7 +1112,13 @@ static void page_pool_release_retry(struct
> > > > work_struct *wq)
> > > >         int inflight;
> > > >
> > > >         inflight = page_pool_release(pool);
> > > > -       if (!inflight)
> > > > +       /* In rare cases, a driver bug may cause inflight to go negative.
> > > > +        * Don't reschedule release if inflight is 0 or negative.
> > > > +        * - If 0, the page_pool has been destroyed
> > > > +        * - if negative, we will never recover
> > > > +        *   in both cases no reschedule is necessary.
> > > > +        */
> > > > +       if (inflight <= 0)
> > > >                 return;
> > > >
> > >
> > > I think it could still be good to have us warn once so that this bug
> > > is not silent.
> >
> > Allow me to double-check what you meant here. Applying the above
> > patch, we do at least see the warning once in
> > page_pool_release_retry()->page_pool_release()->page_pool_inflight()->WARN()
> > before stopping the reschedule.
> >
>
> Ah, I see. I had missed indeed that we warn in page_pool_inflight() if
> we see anything negative there anyway. Nevermind then. Thanks!

Okay, then a one-liner patch is enough :)

Thanks for the review.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ