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]
Date: Fri, 21 Jul 2023 08:02:15 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Yunsheng Lin <linyunsheng@...wei.com>
Cc: <davem@...emloft.net>, <netdev@...r.kernel.org>, <edumazet@...gle.com>,
 <pabeni@...hat.com>, <peterz@...radead.org>, <mingo@...hat.com>,
 <will@...nel.org>, <longman@...hat.com>, <boqun.feng@...il.com>,
 <hawk@...nel.org>, <ilias.apalodimas@...aro.org>
Subject: Re: [PATCH net-next] page_pool: add a lockdep check for recycling
 in hardirq

On Fri, 21 Jul 2023 19:53:30 +0800 Yunsheng Lin wrote:
> > diff --git a/net/core/page_pool.c b/net/core/page_pool.c
> > index a3e12a61d456..3ac760fcdc22 100644
> > --- a/net/core/page_pool.c
> > +++ b/net/core/page_pool.c
> > @@ -536,6 +536,8 @@ static void page_pool_return_page(struct page_pool *pool, struct page *page)
> >  static bool page_pool_recycle_in_ring(struct page_pool *pool, struct page *page)
> >  {
> >  	int ret;
> > +
> > +	lockdep_assert_no_hardirq();  
> 
> Is there any reason not to put it in page_pool_put_defragged_page() to
> catch the case with allow_direct being true when page_pool_recycle_in_ring()
> may not be called?

I was trying to stick it into places which make an assumption about
the calling context, rather than cover the full API.
I don't have a strong preference either way, but I hope it's good
enough. The benefit I see is that it should be fairly obvious to
a seasoned kernel code reader why this warning is here.
A warning that fires from page_pool_put_defragged_page() would need
a comment to explain the reason and may go stale.

> >  	/* BH protection not needed if current is softirq */
> >  	if (in_softirq())

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ