public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf disasm: Fix off-by-one bug in outside check
@ 2026-03-04 19:06 Peter Collingbourne
  2026-03-04 19:49 ` Ian Rogers
  2026-03-06 18:53 ` [PATCH v1] perf annotate loongarch: " Ian Rogers
  0 siblings, 2 replies; 6+ messages in thread
From: Peter Collingbourne @ 2026-03-04 19:06 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Collingbourne, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, James Clark,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	linux-perf-users, linux-kernel, llvm

If a branch target points to one past the end of a function, the branch
should be treated as a branch to another function. This can happen
e.g. with a tail call to a function that is laid out immediately after
the caller.

Link: https://linux-review.googlesource.com/id/Ide471112e82d68177e0faf08ca411d9fcf0a7bdf
Signed-off-by: Peter Collingbourne <pcc@google.com>
---
 tools/perf/util/disasm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c
index ddcc488f2e5f0..9e0420e14be19 100644
--- a/tools/perf/util/disasm.c
+++ b/tools/perf/util/disasm.c
@@ -384,7 +384,7 @@ static int jump__parse(const struct arch *arch, struct ins_operands *ops, struct
 	start = map__unmap_ip(map, sym->start);
 	end = map__unmap_ip(map, sym->end);
 
-	ops->target.outside = target.addr < start || target.addr > end;
+	ops->target.outside = target.addr < start || target.addr >= end;
 
 	/*
 	 * FIXME: things like this in _cpp_lex_token (gcc's cc1 program):
-- 
2.53.0.473.g4a7958ca14-goog


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

* Re: [PATCH] perf disasm: Fix off-by-one bug in outside check
  2026-03-04 19:06 [PATCH] perf disasm: Fix off-by-one bug in outside check Peter Collingbourne
@ 2026-03-04 19:49 ` Ian Rogers
  2026-03-04 20:30   ` Arnaldo Carvalho de Melo
  2026-03-06 18:53 ` [PATCH v1] perf annotate loongarch: " Ian Rogers
  1 sibling, 1 reply; 6+ messages in thread
From: Ian Rogers @ 2026-03-04 19:49 UTC (permalink / raw)
  To: Peter Collingbourne
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Adrian Hunter, James Clark, Nathan Chancellor, Nick Desaulniers,
	Bill Wendling, Justin Stitt, linux-perf-users, linux-kernel, llvm

On Wed, Mar 4, 2026 at 11:06 AM Peter Collingbourne <pcc@google.com> wrote:
>
> If a branch target points to one past the end of a function, the branch
> should be treated as a branch to another function. This can happen
> e.g. with a tail call to a function that is laid out immediately after
> the caller.
>
> Link: https://linux-review.googlesource.com/id/Ide471112e82d68177e0faf08ca411d9fcf0a7bdf
> Signed-off-by: Peter Collingbourne <pcc@google.com>

Fixes:  751b1783da78 ("perf annotate: Mark jumps to outher functions
with the call arrow")
Reviewed-by: Ian Rogers <irogers@google.com>

Thanks!
Ian

> ---
>  tools/perf/util/disasm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c
> index ddcc488f2e5f0..9e0420e14be19 100644
> --- a/tools/perf/util/disasm.c
> +++ b/tools/perf/util/disasm.c
> @@ -384,7 +384,7 @@ static int jump__parse(const struct arch *arch, struct ins_operands *ops, struct
>         start = map__unmap_ip(map, sym->start);
>         end = map__unmap_ip(map, sym->end);
>
> -       ops->target.outside = target.addr < start || target.addr > end;
> +       ops->target.outside = target.addr < start || target.addr >= end;
>
>         /*
>          * FIXME: things like this in _cpp_lex_token (gcc's cc1 program):
> --
> 2.53.0.473.g4a7958ca14-goog
>

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

* Re: [PATCH] perf disasm: Fix off-by-one bug in outside check
  2026-03-04 19:49 ` Ian Rogers
@ 2026-03-04 20:30   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-03-04 20:30 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Collingbourne, Peter Zijlstra, Ingo Molnar, Namhyung Kim,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Adrian Hunter,
	James Clark, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
	Justin Stitt, linux-perf-users, linux-kernel, llvm

On Wed, Mar 04, 2026 at 11:49:02AM -0800, Ian Rogers wrote:
> On Wed, Mar 4, 2026 at 11:06 AM Peter Collingbourne <pcc@google.com> wrote:
> >
> > If a branch target points to one past the end of a function, the branch
> > should be treated as a branch to another function. This can happen
> > e.g. with a tail call to a function that is laid out immediately after
> > the caller.
> >
> > Link: https://linux-review.googlesource.com/id/Ide471112e82d68177e0faf08ca411d9fcf0a7bdf
> > Signed-off-by: Peter Collingbourne <pcc@google.com>
> 
> Fixes:  751b1783da78 ("perf annotate: Mark jumps to outher functions
> with the call arrow")
> Reviewed-by: Ian Rogers <irogers@google.com>

Thanks, applied to perf-tools, for v7.0.

- Arnaldo
 
> Thanks!
> Ian
> 
> > ---
> >  tools/perf/util/disasm.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/disasm.c b/tools/perf/util/disasm.c
> > index ddcc488f2e5f0..9e0420e14be19 100644
> > --- a/tools/perf/util/disasm.c
> > +++ b/tools/perf/util/disasm.c
> > @@ -384,7 +384,7 @@ static int jump__parse(const struct arch *arch, struct ins_operands *ops, struct
> >         start = map__unmap_ip(map, sym->start);
> >         end = map__unmap_ip(map, sym->end);
> >
> > -       ops->target.outside = target.addr < start || target.addr > end;
> > +       ops->target.outside = target.addr < start || target.addr >= end;
> >
> >         /*
> >          * FIXME: things like this in _cpp_lex_token (gcc's cc1 program):
> > --
> > 2.53.0.473.g4a7958ca14-goog
> >

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

* [PATCH v1] perf annotate loongarch: Fix off-by-one bug in outside check
  2026-03-04 19:06 [PATCH] perf disasm: Fix off-by-one bug in outside check Peter Collingbourne
  2026-03-04 19:49 ` Ian Rogers
@ 2026-03-06 18:53 ` Ian Rogers
  2026-03-10 15:07   ` Arnaldo Carvalho de Melo
  2026-03-10 15:09   ` Arnaldo Carvalho de Melo
  1 sibling, 2 replies; 6+ messages in thread
From: Ian Rogers @ 2026-03-06 18:53 UTC (permalink / raw)
  To: pcc, acme, namhyung
  Cc: adrian.hunter, alexander.shishkin, irogers, james.clark, jolsa,
	justinstitt, linux-kernel, linux-perf-users, llvm, mark.rutland,
	mingo, morbo, nathan, nick.desaulniers+lkml, peterz

A copy-paste of an issue fixed by Peter Collingbourne in:
https://lore.kernel.org/linux-perf-users/20260304190613.2507582-1-pcc@google.com/

Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/annotate-arch/annotate-loongarch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/annotate-arch/annotate-loongarch.c b/tools/perf/util/annotate-arch/annotate-loongarch.c
index 3aeab453a059..950f34e59e5c 100644
--- a/tools/perf/util/annotate-arch/annotate-loongarch.c
+++ b/tools/perf/util/annotate-arch/annotate-loongarch.c
@@ -93,7 +93,7 @@ static int loongarch_jump__parse(const struct arch *arch, struct ins_operands *o
 	start = map__unmap_ip(map, sym->start);
 	end = map__unmap_ip(map, sym->end);
 
-	ops->target.outside = target.addr < start || target.addr > end;
+	ops->target.outside = target.addr < start || target.addr >= end;
 
 	if (maps__find_ams(thread__maps(ms->thread), &target) == 0 &&
 	    map__rip_2objdump(target.ms.map, map__map_ip(target.ms.map, target.addr)) == ops->target.addr)
-- 
2.53.0.473.g4a7958ca14-goog


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

* Re: [PATCH v1] perf annotate loongarch: Fix off-by-one bug in outside check
  2026-03-06 18:53 ` [PATCH v1] perf annotate loongarch: " Ian Rogers
@ 2026-03-10 15:07   ` Arnaldo Carvalho de Melo
  2026-03-10 15:09   ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-03-10 15:07 UTC (permalink / raw)
  To: Ian Rogers
  Cc: pcc, namhyung, adrian.hunter, alexander.shishkin, james.clark,
	jolsa, justinstitt, linux-kernel, linux-perf-users, llvm,
	mark.rutland, mingo, morbo, nathan, nick.desaulniers+lkml, peterz

On Fri, Mar 06, 2026 at 10:53:06AM -0800, Ian Rogers wrote:
> A copy-paste of an issue fixed by Peter Collingbourne in:
> https://lore.kernel.org/linux-perf-users/20260304190613.2507582-1-pcc@google.com/

Thanks, applied to perf-tools, for v7.0.

- Arnaldo
 
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/util/annotate-arch/annotate-loongarch.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/annotate-arch/annotate-loongarch.c b/tools/perf/util/annotate-arch/annotate-loongarch.c
> index 3aeab453a059..950f34e59e5c 100644
> --- a/tools/perf/util/annotate-arch/annotate-loongarch.c
> +++ b/tools/perf/util/annotate-arch/annotate-loongarch.c
> @@ -93,7 +93,7 @@ static int loongarch_jump__parse(const struct arch *arch, struct ins_operands *o
>  	start = map__unmap_ip(map, sym->start);
>  	end = map__unmap_ip(map, sym->end);
>  
> -	ops->target.outside = target.addr < start || target.addr > end;
> +	ops->target.outside = target.addr < start || target.addr >= end;
>  
>  	if (maps__find_ams(thread__maps(ms->thread), &target) == 0 &&
>  	    map__rip_2objdump(target.ms.map, map__map_ip(target.ms.map, target.addr)) == ops->target.addr)
> -- 
> 2.53.0.473.g4a7958ca14-goog

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

* Re: [PATCH v1] perf annotate loongarch: Fix off-by-one bug in outside check
  2026-03-06 18:53 ` [PATCH v1] perf annotate loongarch: " Ian Rogers
  2026-03-10 15:07   ` Arnaldo Carvalho de Melo
@ 2026-03-10 15:09   ` Arnaldo Carvalho de Melo
  1 sibling, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-03-10 15:09 UTC (permalink / raw)
  To: Ian Rogers
  Cc: pcc, namhyung, adrian.hunter, alexander.shishkin, james.clark,
	jolsa, justinstitt, linux-kernel, linux-perf-users, llvm,
	mark.rutland, mingo, morbo, nathan, nick.desaulniers+lkml, peterz

On Fri, Mar 06, 2026 at 10:53:06AM -0800, Ian Rogers wrote:
> A copy-paste of an issue fixed by Peter Collingbourne in:
> https://lore.kernel.org/linux-perf-users/20260304190613.2507582-1-pcc@google.com/
> 
> Signed-off-by: Ian Rogers <irogers@google.com>

Thanks, applied to perf-tools, for v7.0.

- Arnaldo

> ---
>  tools/perf/util/annotate-arch/annotate-loongarch.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/annotate-arch/annotate-loongarch.c b/tools/perf/util/annotate-arch/annotate-loongarch.c
> index 3aeab453a059..950f34e59e5c 100644
> --- a/tools/perf/util/annotate-arch/annotate-loongarch.c
> +++ b/tools/perf/util/annotate-arch/annotate-loongarch.c
> @@ -93,7 +93,7 @@ static int loongarch_jump__parse(const struct arch *arch, struct ins_operands *o
>  	start = map__unmap_ip(map, sym->start);
>  	end = map__unmap_ip(map, sym->end);
>  
> -	ops->target.outside = target.addr < start || target.addr > end;
> +	ops->target.outside = target.addr < start || target.addr >= end;
>  
>  	if (maps__find_ams(thread__maps(ms->thread), &target) == 0 &&
>  	    map__rip_2objdump(target.ms.map, map__map_ip(target.ms.map, target.addr)) == ops->target.addr)
> -- 
> 2.53.0.473.g4a7958ca14-goog

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

end of thread, other threads:[~2026-03-10 15:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 19:06 [PATCH] perf disasm: Fix off-by-one bug in outside check Peter Collingbourne
2026-03-04 19:49 ` Ian Rogers
2026-03-04 20:30   ` Arnaldo Carvalho de Melo
2026-03-06 18:53 ` [PATCH v1] perf annotate loongarch: " Ian Rogers
2026-03-10 15:07   ` Arnaldo Carvalho de Melo
2026-03-10 15:09   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox