[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230208232001.2052777-1-isaacmanjarres@google.com>
Date: Wed, 8 Feb 2023 15:19:59 -0800
From: "Isaac J. Manjarres" <isaacmanjarres@...gle.com>
To: 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>,
Catalin Marinas <catalin.marinas@....com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Saravana Kannan <saravanak@...gle.com>, linux-mm@...ck.org,
"Isaac J. Manjarres" <isaacmanjarres@...gle.com>,
kernel-team@...roid.com,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH v2 0/1] Fix kmemleak crashes when scanning CMA regions
When trying to boot a device with an ARM64 kernel with the following
config options enabled:
CONFIG_DEBUG_PAGEALLOC=y
CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT=y
CONFIG_DEBUG_KMEMLEAK=y
a crash is encountered when kmemleak starts to scan the list of gray
or allocated objects that it maintains. Upon closer inspection, it was
observed that these page-faults always occurred when kmemleak attempted
to scan a CMA region.
At the moment, kmemleak is made aware of CMA regions that are specified
through the devicetree to be dynamically allocated within a range of
addresses. However, kmemleak should not need to scan CMA regions or any
reserved memory region, as those regions can be used for DMA transfers
between drivers and peripherals, and thus wouldn't contain anything
useful for kmemleak.
Additionally, since CMA regions are unmapped from the kernel's address
space when they are freed to the buddy allocator at boot when
CONFIG_DEBUG_PAGEALLOC is enabled, kmemleak shouldn't attempt to access
those memory regions, as that will trigger a crash. Thus, kmemleak
should ignore all dynamically allocated reserved memory regions.
v1 ==> v2:
- Simplified the original approach of informing kmemleak about all CMA
regions in the system to just having kmemleak ignore CMA regions it is
currently aware of.
Isaac J. Manjarres (1):
of: reserved_mem: Have kmemleak ignore dynamically allocated reserved
mem
drivers/of/of_reserved_mem.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--
2.39.1.581.gbfd45094c4-goog
Powered by blists - more mailing lists