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: <468d3200-159c-f4ad-5907-48331cd7edd8@huawei.com>
Date:   Thu, 15 Jun 2023 17:06:41 +0800
From:   Yunsheng Lin <linyunsheng@...wei.com>
To:     Liang Chen <liangchen.linux@...il.com>, <hawk@...nel.org>,
        <ilias.apalodimas@...aro.org>
CC:     <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
        <pabeni@...hat.com>
Subject: Re: [PATCH net-next] page pool: not return page to alloc cache during
 pool destruction

On 2023/6/15 17:01, Yunsheng Lin wrote:
> On 2023/6/15 9:36, Liang Chen wrote:
>> When destroying a page pool, the alloc cache and recycle ring are emptied.
>> If there are inflight pages, the retry process will periodically check the
>> recycle ring for recently returned pages, but not the alloc cache (alloc
>> cache is only emptied once). As a result, any pages returned to the alloc
>> cache after the page pool destruction will be stuck there and cause the
>> retry process to continuously look for inflight pages and report warnings.
> 
> It seems there is still page_pool_put[_full]_page() called with
> allow_direct being true after page_pool_destroy() is call, which
> is not allowed.
> 
> Normally the driver will call napi_disable() before
> page_pool_destroy() to ensure there is no such page_pool_destroy()

no such page_pool_put[_full]_page()

> calling with allow_direct being true after page_pool_destroy() is
> called.
> 
>>
>> To safeguard against this situation, any pages returning to the alloc cache
>> after pool destruction should be prevented.
>>
>> Signed-off-by: Liang Chen <liangchen.linux@...il.com>
>> ---
>>  net/core/page_pool.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/core/page_pool.c b/net/core/page_pool.c
>> index a3e12a61d456..76255313d349 100644
>> --- a/net/core/page_pool.c
>> +++ b/net/core/page_pool.c
>> @@ -595,7 +595,7 @@ __page_pool_put_page(struct page_pool *pool, struct page *page,
>>  			page_pool_dma_sync_for_device(pool, page,
>>  						      dma_sync_size);
>>  
>> -		if (allow_direct && in_softirq() &&
>> +		if (allow_direct && in_softirq() && !pool->destroy_cnt &&
> 
> The checking seems racy when  __page_pool_put_page() and
> page_pool_destroy() are called concurently.
> 
>>  		    page_pool_recycle_in_cache(page, pool))
>>  			return NULL;
>>  
>>
> 
> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ