Re: [PATCH v2 1/1] mm: kfence: apply kmemleak_ignore_phys on early allocated pool
From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2022-07-19 11:50:47
Also in:
linux-mediatek, linux-mm, lkml
On Sat, Jul 16, 2022 at 08:43:06PM +0200, Geert Uytterhoeven wrote:
On Sat, Jul 16, 2022 at 1:33 AM Andrew Morton [off-list ref] wrote:quoted
On Fri, 15 Jul 2022 10:17:43 +0200 Geert Uytterhoeven [off-list ref] wrote:quoted
On Tue, Jun 28, 2022 at 1:42 PM [off-list ref] wrote:quoted
From: Yee Lee <redacted> This patch solves two issues. (1) The pool allocated by memblock needs to unregister from kmemleak scanning. Apply kmemleak_ignore_phys to replace the original kmemleak_free as its address now is stored in the phys tree. (2) The pool late allocated by page-alloc doesn't need to unregister. Move out the freeing operation from its call path. Suggested-by: Catalin Marinas <catalin.marinas@arm.com> Suggested-by: Marco Elver <elver@google.com> Signed-off-by: Yee Lee <redacted>Thank you, this fixes the storm of BUG: KFENCE: invalid read in scan_block+0x78/0x130 BUG: KFENCE: use-after-free read in scan_block+0x78/0x130 BUG: KFENCE: out-of-bounds read in scan_block+0x78/0x130 messages I was seeing on arm64.Thanks, but... - It would be great if we could identify a Fixes: for this.IIRC, I started seeing the issue with "[PATCH v4 3/4] mm: kmemleak: add rbtree and store physical address for objects allocated with PA" (i.e. commit 0c24e061196c21d5 ("mm: kmemleak: add rbtree and store physical address for objects allocated with PA")) of series "[PATCH v4 0/4] mm: kmemleak: store objects allocated with physical address separately and check when scan" (https://lore.kernel.org/all/20220611035551.1823303-1-patrick.wang.shcn@gmail.com (local)), in an arm64 config that had enabled kfence.
Yes, I think it fixes 0c24e061196c21d5 since after that commit, the kmemleak_free() no longer worked as expected on physically allocated objects. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel