Re: [PATCH] perf disasm: Fix off-by-one bug in outside check

From: Arnaldo Carvalho de Melo

Date: Wed Mar 04 2026 - 15:30:23 EST


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@xxxxxxxxxx> 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@xxxxxxxxxx>
>
> Fixes: 751b1783da78 ("perf annotate: Mark jumps to outher functions
> with the call arrow")
> Reviewed-by: Ian Rogers <irogers@xxxxxxxxxx>

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
> >