mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <yee.lee@mediatek.com>
To: <linux-kernel@vger.kernel.org>
Cc: <catalin.marinas@arm.com>, Yee Lee <yee.lee@mediatek.com>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"moderated list:ARM/Mediatek SoC support" 
	<linux-arm-kernel@lists.infradead.org>,
	"moderated list:ARM/Mediatek SoC support" 
	<linux-mediatek@lists.infradead.org>
Subject: [PATCH v2 0/1] mm: kfence: fix unexpected leak scan on kfence pool
Date: Tue, 28 Jun 2022 19:37:10 +0800	[thread overview]
Message-ID: <20220628113714.7792-1-yee.lee@mediatek.com> (raw)

From: Yee Lee <yee.lee@mediatek.com>

Since the latest patches of kmemleak separated its address management 
to two rb-trees, phys and virt, the kmemleak_free failed to free kfence_pool
from the virt tree. It caused unexpected scan the blocks and triggered
kfence faults.

Reference: 
https://lore.kernel.org/linux-mm/20220611035551.1823303-1-patrick.wang.shcn@gmail.com/

 ==================================================================
 BUG: KFENCE: invalid read in scan_block+0x13c/0x838

  Invalid read at 0x000000003dc26873:
  scan_block+0x13c/0x838
  scan_gray_list+0x1f0/0x478
  kmemleak_scan+0x63c/0xd64
  kmemleak_write+0x618/0x8cc
  full_proxy_write+0x70/0x138
  vfs_write+0x108/0x314
  ksys_write+0x7c/0x14c
  __arm64_sys_write+0x20/0x30
  el0_svc_common+0xa8/0x144
  do_el0_svc+0x30/0xd4
  el0_svc+0x38/0x15c
  el0t_64_sync_handler+0x88/0xf8
  el0t_64_sync+0x1a0/0x1a4

 CPU: 0 PID: 128 Comm: sh Not tainted 5.18.0-mainline-40996-g7d83a175ff4a-dirty #1
 Hardware name: linux,dummy-virt (DT)
 ==================================================================

This patch applies kmemleak_ignore_phys() to replace the original kmemleak_free and
adapts it to the late enabling case. 

v1->v2:
 - use kmemleak_ignore_phys() to bypass the scanning.
 - move out the freeing opeartion from late enabling as it's trivial.

Yee Lee (1):
  mm: kfence: apply kmemleak_ignore_phys on early allocated pool

 mm/kfence/core.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

-- 
2.18.0


             reply	other threads:[~2022-06-28 11:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 11:37 yee.lee [this message]
2022-06-28 11:37 ` [PATCH v2 1/1] mm: kfence: apply kmemleak_ignore_phys on early allocated pool yee.lee
2022-06-28 12:10   ` Marco Elver
2022-06-29 21:39   ` Catalin Marinas
2022-07-15  8:17   ` Geert Uytterhoeven
2022-07-15 23:33     ` Andrew Morton
2022-07-16 18:43       ` Geert Uytterhoeven
2022-07-18 14:26         ` Marco Elver
2022-07-19 23:13           ` Andrew Morton
2022-07-19 23:22             ` Dave Hansen
2022-08-01 14:05               ` Marco Elver
2022-07-19 11:50         ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220628113714.7792-1-yee.lee@mediatek.com \
    --to=yee.lee@mediatek.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®