All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf test: Fix a leaked map reference in the arch dwarf unwind tests
@ 2026-09-14 12:19 Chen Pei
  2026-09-14 12:26 ` sashiko-bot
  2026-09-15 19:35 ` Ian Rogers
  0 siblings, 2 replies; 5+ messages in thread
From: Chen Pei @ 2026-09-14 12:19 UTC (permalink / raw)
  To: irogers, peterz, mingo, acme, namhyung, mark.rutland,
	alexander.shishkin, jolsa, adrian.hunter, james.clark,
	john.g.garry, will, mike.leach, leo.yan
  Cc: linux-arm-kernel, linux-perf-users, linux-kernel

maps__find() has returned a reference to the map it finds since
commit 42fd623b58db ("perf maps: Get map before returning in
maps__find"), which updated arch/x86/tests/dwarf-unwind.c but missed
the arm, arm64 and powerpc copies. Release the map after reading its
end, as x86 does. All other callers of maps__find() already release
what they get.

Fixes: 42fd623b58db ("perf maps: Get map before returning in maps__find")
Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
---
 tools/perf/arch/arm/tests/dwarf-unwind.c     | 1 +
 tools/perf/arch/arm64/tests/dwarf-unwind.c   | 1 +
 tools/perf/arch/powerpc/tests/dwarf-unwind.c | 1 +
 3 files changed, 3 insertions(+)

diff --git a/tools/perf/arch/arm/tests/dwarf-unwind.c b/tools/perf/arch/arm/tests/dwarf-unwind.c
index f421910e0709..d4707e9ffd2a 100644
--- a/tools/perf/arch/arm/tests/dwarf-unwind.c
+++ b/tools/perf/arch/arm/tests/dwarf-unwind.c
@@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample,
 	}
 
 	stack_size = map__end(map) - sp;
+	map__put(map);
 	stack_size = stack_size > STACK_SIZE ? STACK_SIZE : stack_size;
 
 	memcpy(buf, (void *) sp, stack_size);
diff --git a/tools/perf/arch/arm64/tests/dwarf-unwind.c b/tools/perf/arch/arm64/tests/dwarf-unwind.c
index 440d00f0de14..fbc161a49369 100644
--- a/tools/perf/arch/arm64/tests/dwarf-unwind.c
+++ b/tools/perf/arch/arm64/tests/dwarf-unwind.c
@@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample,
 	}
 
 	stack_size = map__end(map) - sp;
+	map__put(map);
 	stack_size = stack_size > STACK_SIZE ? STACK_SIZE : stack_size;
 
 	memcpy(buf, (void *) sp, stack_size);
diff --git a/tools/perf/arch/powerpc/tests/dwarf-unwind.c b/tools/perf/arch/powerpc/tests/dwarf-unwind.c
index 66af884baa66..b4bade5d59e2 100644
--- a/tools/perf/arch/powerpc/tests/dwarf-unwind.c
+++ b/tools/perf/arch/powerpc/tests/dwarf-unwind.c
@@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample,
 	}
 
 	stack_size = map__end(map) - sp;
+	map__put(map);
 	stack_size = stack_size > STACK_SIZE ? STACK_SIZE : stack_size;
 
 	memcpy(buf, (void *) sp, stack_size);
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf test: Fix a leaked map reference in the arch dwarf unwind tests
  2026-09-14 12:19 [PATCH] perf test: Fix a leaked map reference in the arch dwarf unwind tests Chen Pei
@ 2026-09-14 12:26 ` sashiko-bot
  2026-09-15 19:35 ` Ian Rogers
  1 sibling, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-09-14 12:26 UTC (permalink / raw)
  To: Chen Pei; +Cc: linux-perf-users

> maps__find() has returned a reference to the map it finds since
> commit 42fd623b58db ("perf maps: Get map before returning in
> maps__find"), which updated arch/x86/tests/dwarf-unwind.c but missed
> the arm, arm64 and powerpc copies. Release the map after reading its
> end, as x86 does. All other callers of maps__find() already release
> what they get.
> 
> Fixes: 42fd623b58db ("perf maps: Get map before returning in maps__find")
> Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260914121903.1212-1-cp0613@linux.alibaba.com?part=1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf test: Fix a leaked map reference in the arch dwarf unwind tests
  2026-09-14 12:19 [PATCH] perf test: Fix a leaked map reference in the arch dwarf unwind tests Chen Pei
  2026-09-14 12:26 ` sashiko-bot
@ 2026-09-15 19:35 ` Ian Rogers
  2026-09-22 12:38   ` Arnaldo Carvalho de Melo
  2026-09-22 12:39   ` Arnaldo Carvalho de Melo
  1 sibling, 2 replies; 5+ messages in thread
From: Ian Rogers @ 2026-09-15 19:35 UTC (permalink / raw)
  To: Chen Pei
  Cc: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
	jolsa, adrian.hunter, james.clark, john.g.garry, will, mike.leach,
	leo.yan, linux-arm-kernel, linux-perf-users, linux-kernel

On Mon, Sep 14, 2026 at 5:19 AM Chen Pei <cp0613@linux.alibaba.com> wrote:
>
> maps__find() has returned a reference to the map it finds since
> commit 42fd623b58db ("perf maps: Get map before returning in
> maps__find"), which updated arch/x86/tests/dwarf-unwind.c but missed
> the arm, arm64 and powerpc copies. Release the map after reading its
> end, as x86 does. All other callers of maps__find() already release
> what they get.
>
> Fixes: 42fd623b58db ("perf maps: Get map before returning in maps__find")
> Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/arch/arm/tests/dwarf-unwind.c     | 1 +
>  tools/perf/arch/arm64/tests/dwarf-unwind.c   | 1 +
>  tools/perf/arch/powerpc/tests/dwarf-unwind.c | 1 +
>  3 files changed, 3 insertions(+)
>
> diff --git a/tools/perf/arch/arm/tests/dwarf-unwind.c b/tools/perf/arch/arm/tests/dwarf-unwind.c
> index f421910e0709..d4707e9ffd2a 100644
> --- a/tools/perf/arch/arm/tests/dwarf-unwind.c
> +++ b/tools/perf/arch/arm/tests/dwarf-unwind.c
> @@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample,
>         }
>
>         stack_size = map__end(map) - sp;
> +       map__put(map);
>         stack_size = stack_size > STACK_SIZE ? STACK_SIZE : stack_size;
>
>         memcpy(buf, (void *) sp, stack_size);
> diff --git a/tools/perf/arch/arm64/tests/dwarf-unwind.c b/tools/perf/arch/arm64/tests/dwarf-unwind.c
> index 440d00f0de14..fbc161a49369 100644
> --- a/tools/perf/arch/arm64/tests/dwarf-unwind.c
> +++ b/tools/perf/arch/arm64/tests/dwarf-unwind.c
> @@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample,
>         }
>
>         stack_size = map__end(map) - sp;
> +       map__put(map);
>         stack_size = stack_size > STACK_SIZE ? STACK_SIZE : stack_size;
>
>         memcpy(buf, (void *) sp, stack_size);
> diff --git a/tools/perf/arch/powerpc/tests/dwarf-unwind.c b/tools/perf/arch/powerpc/tests/dwarf-unwind.c
> index 66af884baa66..b4bade5d59e2 100644
> --- a/tools/perf/arch/powerpc/tests/dwarf-unwind.c
> +++ b/tools/perf/arch/powerpc/tests/dwarf-unwind.c
> @@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample,
>         }
>
>         stack_size = map__end(map) - sp;
> +       map__put(map);
>         stack_size = stack_size > STACK_SIZE ? STACK_SIZE : stack_size;
>
>         memcpy(buf, (void *) sp, stack_size);
> --
> 2.50.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf test: Fix a leaked map reference in the arch dwarf unwind tests
  2026-09-15 19:35 ` Ian Rogers
@ 2026-09-22 12:38   ` Arnaldo Carvalho de Melo
  2026-09-22 12:39   ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-09-22 12:38 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Chen Pei, peterz, mingo, namhyung, mark.rutland,
	alexander.shishkin, jolsa, adrian.hunter, james.clark,
	john.g.garry, will, mike.leach, leo.yan, linux-arm-kernel,
	linux-perf-users, linux-kernel

On Tue, Sep 15, 2026 at 12:35:23PM -0700, Ian Rogers wrote:
> On Mon, Sep 14, 2026 at 5:19 AM Chen Pei <cp0613@linux.alibaba.com> wrote:
> >
> > maps__find() has returned a reference to the map it finds since
> > commit 42fd623b58db ("perf maps: Get map before returning in
> > maps__find"), which updated arch/x86/tests/dwarf-unwind.c but missed
> > the arm, arm64 and powerpc copies. Release the map after reading its
> > end, as x86 does. All other callers of maps__find() already release
> > what they get.
> >
> > Fixes: 42fd623b58db ("perf maps: Get map before returning in maps__find")
> > Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
> 
> Reviewed-by: Ian Rogers <irogers@google.com>

Thanks, applied to perf-tools-next, for v7.4.

- Arnaldo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] perf test: Fix a leaked map reference in the arch dwarf unwind tests
  2026-09-15 19:35 ` Ian Rogers
  2026-09-22 12:38   ` Arnaldo Carvalho de Melo
@ 2026-09-22 12:39   ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-09-22 12:39 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Chen Pei, peterz, mingo, namhyung, mark.rutland,
	alexander.shishkin, jolsa, adrian.hunter, james.clark,
	john.g.garry, will, mike.leach, leo.yan, linux-arm-kernel,
	linux-perf-users, linux-kernel

On Tue, Sep 15, 2026 at 12:35:23PM -0700, Ian Rogers wrote:
> On Mon, Sep 14, 2026 at 5:19 AM Chen Pei <cp0613@linux.alibaba.com> wrote:
> >
> > maps__find() has returned a reference to the map it finds since
> > commit 42fd623b58db ("perf maps: Get map before returning in
> > maps__find"), which updated arch/x86/tests/dwarf-unwind.c but missed
> > the arm, arm64 and powerpc copies. Release the map after reading its
> > end, as x86 does. All other callers of maps__find() already release
> > what they get.
> >
> > Fixes: 42fd623b58db ("perf maps: Get map before returning in maps__find")
> > Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
> 
> Reviewed-by: Ian Rogers <irogers@google.com>

Thanks, applied to perf-tools-next, for v7.4.

- Arnaldo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-22 12:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-14 12:19 [PATCH] perf test: Fix a leaked map reference in the arch dwarf unwind tests Chen Pei
2026-09-14 12:26 ` sashiko-bot
2026-09-15 19:35 ` Ian Rogers
2026-09-22 12:38   ` Arnaldo Carvalho de Melo
2026-09-22 12:39   ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.