perf script: avoid null dereference on symbol
Ian Rogers
reviewerPATCH 1/1 perf script: avoid null dereference on symbol
al->sym may be null given current if conditions and may cause a segv.
--- tools/perf/util/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/event.c +1 -1
@@ -626,7 +626,7 @@ int machine__resolve(struct machine *machine, struct addr_location *al, ret =strlist__has_entry (symbol_conf.sym_list, al->sym->name); } -if (!(ret && al->sym)) { +if (!ret && al->sym) {snprintf (al_addr_str, sz,"0x%" PRIx64, al->map->unmap_ip (al->map, al->sym->start)); ret = strlist__has_entry(symbol_conf.sym_list,
Signature · 1 line
2.26.1.301.g55bc3eb7cb9-goog
Quoted 3 lines · Ian Rogers
al->symmay be null given current if conditions and may cause a segv.Fixes cd2bedb7863e9 (perf script: Allow --symbol to accept hexadecimal addresses)
seems it's wrong commit number, I see it under d2bedb7863e9
Quoted 10 lines
Signed-off-by Ian Rogers <[email protected]>--- tools/perf/util/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/event.c +0
-0
tools/perf/util/event.c int machine__resolve(struct machine *machine, struct addr_location *al, · line 629
Quoted 5 lines
tools/perf/util/event.c +1
-1@@ -626,7 +626,7 @@ int machine__resolve(struct machine *machine, struct addr_location *al, ret =strlist__has_entry (symbol_conf.sym_list, al->sym->name); } -if (!(ret && al->sym)) { +if (!ret && al->sym) {
thanks,
jirka
Quoted 6 lines
tools/perf/util/event.c +0
-0snprintf (al_addr_str, sz,"0x%" PRIx64, al->map->unmap_ip (al->map, al->sym->start)); ret = strlist__has_entry(symbol_conf.sym_list,Signature · 1 line
2.26.1.301.g55bc3eb7cb9-goog
Em Wed, Apr 22, 2020 at 10:20:16AM +0200, Jiri Olsa escreveu:
Quoted 6 lines · Ian Rogers
Quoted 3 lines
al->symmay be null given current if conditions and may cause a segv.Fixes cd2bedb7863e9 (perf script: Allow --symbol to accept hexadecimal addresses)seems it's wrong commit number, I see it under
d2bedb7863e9
Thanks, added your Acked-by, I noticed the wrong commit number, fixed it up to the same you point above.
- Arnaldo
Quoted 29 lines
Quoted 11 lines
Signed-off-by Ian Rogers <[email protected]>--- tools/perf/util/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/event.c +0
-0tools/perf/util/event.c int machine__resolve(struct machine *machine, struct addr_location *al, · line 629
Quoted 5 lines
tools/perf/util/event.c +1
-1@@ -626,7 +626,7 @@ int machine__resolve(struct machine *machine, struct addr_location *al, ret =strlist__has_entry (symbol_conf.sym_list, al->sym->name); } -if (!(ret && al->sym)) { +if (!ret && al->sym) {Acked-by Jiri Olsa <[email protected]>thanks,
jirkaQuoted 6 lines
tools/perf/util/event.c +0
-0snprintf (al_addr_str, sz,"0x%" PRIx64, al->map->unmap_ip (al->map, al->sym->start)); ret = strlist__has_entry(symbol_conf.sym_list,Signature · 1 line
2.26.1.301.g55bc3eb7cb9-goog
Signature · 1 line
- Arnaldo
Ian Rogers
reviewerQuoted 11 lines · Arnaldo Carvalho de Melo
Em Wed, Apr 22, 2020 at 10:20:16AM +0200, Jiri Olsa escreveu:
Quoted 6 lines · Ian Rogers
Quoted 3 lines
al->symmay be null given current if conditions and may cause a segv.Fixes cd2bedb7863e9 (perf script: Allow --symbol to accept hexadecimal addresses)seems it's wrong commit number, I see it under
d2bedb7863e9Thanks, added your Acked-by, I noticed the wrong commit number, fixed it up to the same you point above.
Thanks for fixing the commit number, I'll try to figure out why I'm calculating these incorrectly.
Ian
Quoted 35 lines
- Arnaldo
Quoted 19 lines
Quoted 11 lines
Signed-off-by Ian Rogers <[email protected]>--- tools/perf/util/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/util/event.c +0
-0tools/perf/util/event.c int machine__resolve(struct machine *machine, struct addr_location *al, · line 629
Quoted 5 lines
tools/perf/util/event.c +1
-1@@ -626,7 +626,7 @@ int machine__resolve(struct machine *machine, struct addr_location *al, ret =strlist__has_entry (symbol_conf.sym_list, al->sym->name); } -if (!(ret && al->sym)) { +if (!ret && al->sym) {Acked-by Jiri Olsa <[email protected]>Quoted 10 lines
thanks,
jirkaQuoted 6 lines
tools/perf/util/event.c +0
-1snprintf (al_addr_str, sz,"0x%" PRIx64, al->map->unmap_ip (al->map, al->sym->start)); ret = strlist__has_entry(symbol_conf.sym_list, --2.26.1.301.g55bc3eb7cb9-goog
--
- Arnaldo
[tip: perf/core] perf script: Avoid NULL dereference on symbol
In reply to Ian RogersThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 1e76b171b71565b96117c2670c64ba54e36a9c2e Gitweb: https://git.kernel.org/tip/1e76b171b71565b96117c2670c64ba54e36a9c2e Author: Ian Rogers <[email protected]> AuthorDate: Mon, 20 Apr 2020 17:43:29 -07:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Wed, 22 Apr 2020 10:59:02 -03:00
perf script: Avoid NULL dereference on symbol
al->sym may be NULL given current if conditions and may cause a segv.
--- tools/perf/util/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/event.c +1 -1
@@ -626,7 +626,7 @@ int machine__resolve(struct machine *machine, struct addr_location *al, ret =strlist__has_entry (symbol_conf.sym_list, al->sym->name); } -if (!(ret && al->sym)) { +if (!ret && al->sym) {snprintf (al_addr_str, sz,"0x%" PRIx64, al->map->unmap_ip (al->map, al->sym->start)); ret = strlist__has_entry(symbol_conf.sym_list,