[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y+VBrpGfwFD82PVF@arm.com>
Date: Thu, 9 Feb 2023 18:55:42 +0000
From: Catalin Marinas <catalin.marinas@....com>
To: "Isaac J. Manjarres" <isaacmanjarres@...gle.com>
Cc: Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
"Russell King (Oracle)" <rmk+kernel@...linux.org.uk>,
Mike Rapoport <rppt@...nel.org>,
"Kirill A. Shutemov" <kirill.shtuemov@...ux.intel.com>,
Nick Kossifidis <mick@....forth.gr>,
Andrew Morton <akpm@...ux-foundation.org>,
Saravana Kannan <saravanak@...gle.com>, linux-mm@...ck.org,
kernel-team@...roid.com,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org, Rob Herring <robh@...nel.org>
Subject: Re: [PATCH v2 1/1] of: reserved_mem: Have kmemleak ignore
dynamically allocated reserved mem
On Wed, Feb 08, 2023 at 03:20:00PM -0800, Isaac J. Manjarres wrote:
> Currently, kmemleak ignores dynamically allocated reserved memory
> regions that don't have a kernel mapping. However, regions that do
> retain a kernel mapping (e.g. CMA regions) do get scanned by kmemleak.
>
> This is not ideal for two reasons:
>
> 1. kmemleak works by scanning memory regions for pointers to
> allocated objects to determine if those objects have been leaked
> or not. However, reserved memory regions can be used between drivers
> and peripherals for DMA transfers, and thus, would not contain pointers
> to allocated objects, making it unnecessary for kmemleak to scan
> these reserved memory regions.
>
> 2. When CONFIG_DEBUG_PAGEALLOC is enabled, along with kmemleak, the
> CMA reserved memory regions are unmapped from the kernel's address
> space when they are freed to buddy at boot. These CMA reserved regions
> are still tracked by kmemleak, however, and when kmemleak attempts to
> scan them, a crash will happen, as accessing the CMA region will result
> in a page-fault, since the regions are unmapped.
>
> Thus, use kmemleak_ignore_phys() for all dynamically allocated reserved
> memory regions, instead of those that do not have a kernel mapping
> associated with them.
>
> Cc: <stable@...r.kernel.org> # 5.15+
> Fixes: a7259df76702 ("memblock: make memblock_find_in_range method private")
> Signed-off-by: Isaac J. Manjarres <isaacmanjarres@...gle.com>
Acked-by: Catalin Marinas <catalin.marinas@....com>
Powered by blists - more mailing lists