linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Suren Baghdasaryan <surenb@google.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Hao Ge <hao.ge@linux.dev>,
	Kent Overstreet <kent.overstreet@linux.dev>,
	 Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,  linux-mm@kvack.org,
	Hao Ge <gehao@kylinos.cn>
Subject: Re: [PATCH v3] mm/alloc_tag: Fix the kmemleak false positive issue in the allocation of the percpu variable tag->counters
Date: Sun, 22 Jun 2025 15:40:29 -0700	[thread overview]
Message-ID: <CAJuCfpELs1Y_YaT3-f8-dnsPqkwgGShEVU9tqJe=3RJU3BK_6w@mail.gmail.com> (raw)
In-Reply-To: <aFU7f5fcD9RJ3Mpa@arm.com>

On Fri, Jun 20, 2025 at 3:44 AM Catalin Marinas <catalin.marinas@arm.com> wrote:
>
> On Fri, Jun 20, 2025 at 05:31:02PM +0800, Hao Ge wrote:
> > From: Hao Ge <gehao@kylinos.cn>
> >
> > When loading a module, as long as the module has memory
> > allocation operations, kmemleak produces a false positive
> > report that resembles the following:
> >
> > unreferenced object (percpu) 0x7dfd232a1650 (size 16):
> >   comm "modprobe", pid 1301, jiffies 4294940249
> >   hex dump (first 16 bytes on cpu 2):
> >     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
> >   backtrace (crc 0):
> >     kmemleak_alloc_percpu+0xb4/0xd0
> >     pcpu_alloc_noprof+0x700/0x1098
> >     load_module+0xd4/0x348
> >     codetag_module_init+0x20c/0x450
> >     codetag_load_module+0x70/0xb8
> >     load_module+0xef8/0x1608
> >     init_module_from_file+0xec/0x158
> >     idempotent_init_module+0x354/0x608
> >     __arm64_sys_finit_module+0xbc/0x150
> >     invoke_syscall+0xd4/0x258
> >     el0_svc_common.constprop.0+0xb4/0x240
> >     do_el0_svc+0x48/0x68
> >     el0_svc+0x40/0xf8
> >     el0t_64_sync_handler+0x10c/0x138
> >     el0t_64_sync+0x1ac/0x1b0
> >
> > This is because the module can only indirectly reference alloc_tag_counters
> > through the alloc_tag section, which misleads kmemleak.
> >
> > However, we don't have a kmemleak ignore interface for percpu
> > allocations yet. So let's create one and invoke it for tag->counters.
> >
> > Fixes: 12ca42c23775 ("alloc_tag: allocate percpu counters for module tags dynamically")
> > Signed-off-by: Hao Ge <gehao@kylinos.cn>
>
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

Thanks!
For lib/alloc_tag.c:

Acked-by: Suren Baghdasaryan <surenb@google.com>


      reply	other threads:[~2025-06-22 22:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-20  9:31 Hao Ge
2025-06-20 10:44 ` Catalin Marinas
2025-06-22 22:40   ` Suren Baghdasaryan [this message]

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='CAJuCfpELs1Y_YaT3-f8-dnsPqkwgGShEVU9tqJe=3RJU3BK_6w@mail.gmail.com' \
    --to=surenb@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=gehao@kylinos.cn \
    --cc=hao.ge@linux.dev \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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