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: <CAHS8izPDTNUV5vZ-JebU6nio3x+w-22VHz9r0gpRfdRfr6-vVA@mail.gmail.com>
Date: Mon, 27 Jan 2025 11:41:42 -0800
From: Mina Almasry <almasrymina@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Toke Høiland-Jørgensen <toke@...hat.com>, 
	davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com, 
	pabeni@...hat.com, andrew+netdev@...n.ch, horms@...nel.org, hawk@...nel.org, 
	ilias.apalodimas@...aro.org, asml.silence@...il.com, kaiyuanz@...gle.com, 
	willemb@...gle.com, mkarsten@...terloo.ca, jdamato@...tly.com
Subject: Re: [PATCH net] net: page_pool: don't try to stash the napi id

On Mon, Jan 27, 2025 at 11:37 AM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Mon, 27 Jan 2025 14:31:10 +0100 Toke Høiland-Jørgensen wrote:
> > > +
> > > +/* page_pool_destroy or page_pool_disable_direct_recycling must be
> > > called before
> > > + * netif_napi_del if pool->p.napi is set.
> > > + */
>
> FWIW the comment is better placed on the warning, that's where people
> will look when they hit it ;)
>
> > >  void page_pool_destroy(struct page_pool *pool);
> > >  void page_pool_use_xdp_mem(struct page_pool *pool, void (*disconnect)(void *),
> > >                            const struct xdp_mem_info *mem);
> > >
> > > diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> > > index 5c4b788b811b..dc82767b2516 100644
> > > --- a/net/core/page_pool.c
> > > +++ b/net/core/page_pool.c
> > > @@ -1161,6 +1161,8 @@ void page_pool_destroy(struct page_pool *pool)
> > >         if (!page_pool_put(pool))
> > >                 return;
> > >
> > > +       DEBUG_NET_WARN_ON(pool->p.napi && !napi_is_valid(pool->p.napi));
>
> IDK what "napi_is_valid()" is. I think like this:
>

Yeah, napi_is_valid() was just pseudo code because I wasn't sure how
to actually check yet, but thanks for the diff below.

> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> index a3de752c5178..837ed36472db 100644
> --- a/net/core/page_pool.c
> +++ b/net/core/page_pool.c
> @@ -1145,6 +1145,7 @@ void page_pool_disable_direct_recycling(struct page_pool *pool)
>          * pool and NAPI are unlinked when NAPI is disabled.
>          */
>         WARN_ON(!test_bit(NAPI_STATE_SCHED, &pool->p.napi->state));
> +       WARN_ON(!test_bit(NAPI_STATE_LISTED, &pool->p.napi->state));
>         WARN_ON(READ_ONCE(pool->p.napi->list_owner) != -1);
>
>         WRITE_ONCE(pool->p.napi, NULL);
>
> Because page_pool_disable_direct_recycling() must also be called while
> NAPI is listed. Technically we should also sync rcu if the driver calls
> this directly, because NAPI may be reused :(
>
> > >         page_pool_disable_direct_recycling(pool);
> > >         page_pool_free_frag(pool);
> >
> > Yeah, good idea; care to send a proper patch? :)
>
> ...for net-next ? :)

Will put it on my TODO list for when the tree reopens, thanks.

-- 
Thanks,
Mina

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ