[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c02fa0f22fc94a8d8efb374ceb19e5c2@huawei.com>
Date: Thu, 25 Nov 2021 01:48:20 +0000
From: "chenjun (AM)" <chenjun102@...wei.com>
To: Steven Rostedt <rostedt@...dmis.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"mingo@...hat.com" <mingo@...hat.com>,
"Xiangrui (Euler)" <rui.xiang@...wei.com>
Subject: Re: [PATCH] trace: Fix a kmemleak noise
在 2021/11/24 23:16, Steven Rostedt 写道:
Hi
> On Wed, 24 Nov 2021 14:08:01 +0000
> Chen Jun <chenjun102@...wei.com> wrote:
>
>> The reason is elts->pages[i] is alloced by get_zeroed_page.
>> and kmemleak will not scan the area alloced by get_zeroed_page.
>> The address stored in elts->pages will be regarded as leaked.
>
> Why doesn't kmemleak scan get_zeroed_page? And if that's the case, how does
> all the other locations in the kernel that call get_zeroed_page handle this?
> I think in most cases, the page do not contain pointers. But I am not
sure. Maybe we should better ask Catalin.
In block/blk-mq.c
blk_mq_alloc_rqs
.
page = alloc_pages_node(node,..
.
p = page_address(page);
/*$
* Allow kmemleak to scan these pages as they contain pointers
* to additional allocations like via ops->init_request().
*/$
kmemleak_alloc(p, order_to_size(this_order), 1, GFP_NOIO);
In lib/scatterlist.c
static struct scatterlist *sg_kmalloc(unsigned int nents, gfp_t gfp_mask)
{
if (nents == SG_MAX_SINGLE_ALLOC) {
/*
* Kmemleak doesn't track page allocations as they are not
* commonly used (in a raw form) for kernel data structures.
* As we chain together a list of pages and then a normal
* kmalloc (tracked by kmemleak), in order to for that last
* allocation not to become decoupled (and thus a
* false-positive) we need to inform kmemleak of all the
* intermediate allocations.
*/
void *ptr = (void *) __get_free_page(gfp_mask);
kmemleak_alloc(ptr, PAGE_SIZE, 1, gfp_mask);
return ptr;
.
> -- Steve
>
--
Regards
Chen Jun
Powered by blists - more mailing lists