perf disasm: Fix off-by-one bug in outside check
PATCH 1/1 perf disasm: Fix off-by-one bug in outside check
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.
--- tools/perf/util/disasm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/disasm.c +1 -1
@@ -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):
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Quoted 8 lines · Peter Collingbourne
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.
with the call arrow")
Thanks!
Ian
Quoted 20 lines
--- tools/perf/util/disasm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/disasm.c +1
-2@@ -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
Quoted 7 lines · Ian Rogers
Quoted 6 lines · Peter Collingbourne
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.
Quoted 6 lines
Quoted 2 lines
Fixes 751b1783da78 ("perf annotate: Mark jumps to outher functionswith the call arrow")
Reviewed-by Ian Rogers <[email protected]>
Thanks, applied to perf-tools, for v7.0.
- Arnaldo
Quoted 23 lines
Thanks!
IanQuoted 20 lines
--- tools/perf/util/disasm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/disasm.c +1
-2@@ -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
Ian Rogers
reviewerPATCH 1/1 perf annotate loongarch: Fix off-by-one bug in outside check
In reply to Peter CollingbourneA copy-paste of an issue fixed by Peter Collingbourne in:
https://lore.kernel.org/linux-perf-users/[email protected]/
--- tools/perf/util/annotate-arch/annotate-loongarch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/annotate-arch/annotate-loongarch.c +1 -1
@@ -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)
Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Re: [PATCH v1] perf annotate loongarch: Fix off-by-one bug in outside check
Quoted 2 lines · Ian Rogers
A copy-paste of an issue fixed by Peter Collingbourne in:
https://lore.kernel.org/linux-perf-users/[email protected]/
Thanks, applied to perf-tools, for v7.0.
- Arnaldo
Quoted 20 lines
Signed-off-by Ian Rogers <[email protected]>--- tools/perf/util/annotate-arch/annotate-loongarch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/annotate-arch/annotate-loongarch.c +1
-1@@ -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)Signature · 1 line
2.53.0.473.g4a7958ca14-goog
Re: [PATCH v1] perf annotate loongarch: Fix off-by-one bug in outside check
In reply to Ian RogersQuoted 4 lines · Ian Rogers
A copy-paste of an issue fixed by Peter Collingbourne in:
https://lore.kernel.org/linux-perf-users/[email protected]/Signed-off-by Ian Rogers <[email protected]>
Thanks, applied to perf-tools, for v7.0.
- Arnaldo
Quoted 19 lines
--- tools/perf/util/annotate-arch/annotate-loongarch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/annotate-arch/annotate-loongarch.c +1
-1@@ -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)Signature · 1 line
2.53.0.473.g4a7958ca14-goog