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+tcoC6r=ow4nfjDvv6tDEKgPVOf-c3aHD56_AXmqUrQMyCMg@mail.gmail.com>
Date: Thu, 13 Feb 2025 18:48:42 +0800
From: Jason Xing <kerneljasonxing@...il.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, ilias.apalodimas@...aro.org, 
	edumazet@...gle.com, kuba@...nel.org, horms@...nel.org, hawk@...nel.org, 
	almasrymina@...gle.com
Subject: Re: [PATCH v2 net-next] page_pool: avoid infinite loop to schedule
 delayed worker

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;

Thanks,
Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ