linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf script: avoid null dereference on symbol
@ 2020-04-21  0:43 Ian Rogers
  2020-04-22  8:20 ` Jiri Olsa
  2020-05-08 13:05 ` [tip: perf/core] perf script: Avoid NULL " tip-bot2 for Ian Rogers
  0 siblings, 2 replies; 5+ messages in thread
From: Ian Rogers @ 2020-04-21  0:43 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-kernel
  Cc: Stephane Eranian, Ian Rogers

al->sym may be null given current if conditions and may cause a segv.

Fixes: cd2bedb7863e9 (perf script: Allow --symbol to accept hexadecimal addresses)
Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/util/event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index dc0e11214ae1..f581550a3015 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -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,
-- 
2.26.1.301.g55bc3eb7cb9-goog


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

* Re: [PATCH] perf script: avoid null dereference on symbol
  2020-04-21  0:43 [PATCH] perf script: avoid null dereference on symbol Ian Rogers
@ 2020-04-22  8:20 ` Jiri Olsa
  2020-04-22 13:59   ` Arnaldo Carvalho de Melo
  2020-05-08 13:05 ` [tip: perf/core] perf script: Avoid NULL " tip-bot2 for Ian Rogers
  1 sibling, 1 reply; 5+ messages in thread
From: Jiri Olsa @ 2020-04-22  8:20 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Namhyung Kim, linux-kernel,
	Stephane Eranian

On Mon, Apr 20, 2020 at 05:43:29PM -0700, Ian Rogers wrote:
> al->sym may 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


> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  tools/perf/util/event.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> index dc0e11214ae1..f581550a3015 100644
> --- a/tools/perf/util/event.c
> +++ b/tools/perf/util/event.c
> @@ -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 <jolsa@redhat.com>

thanks,
jirka

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


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

* Re: [PATCH] perf script: avoid null dereference on symbol
  2020-04-22  8:20 ` Jiri Olsa
@ 2020-04-22 13:59   ` Arnaldo Carvalho de Melo
  2020-04-22 15:35     ` Ian Rogers
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-04-22 13:59 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Ian Rogers, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Namhyung Kim, linux-kernel, Stephane Eranian

Em Wed, Apr 22, 2020 at 10:20:16AM +0200, Jiri Olsa escreveu:
> On Mon, Apr 20, 2020 at 05:43:29PM -0700, Ian Rogers wrote:
> > al->sym may 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
 
> 
> > Signed-off-by: Ian Rogers <irogers@google.com>
> > ---
> >  tools/perf/util/event.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> > index dc0e11214ae1..f581550a3015 100644
> > --- a/tools/perf/util/event.c
> > +++ b/tools/perf/util/event.c
> > @@ -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 <jolsa@redhat.com>
> 
> thanks,
> jirka
> 
> >  			snprintf(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

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

* Re: [PATCH] perf script: avoid null dereference on symbol
  2020-04-22 13:59   ` Arnaldo Carvalho de Melo
@ 2020-04-22 15:35     ` Ian Rogers
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Rogers @ 2020-04-22 15:35 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Namhyung Kim, LKML, Stephane Eranian

On Wed, Apr 22, 2020 at 6:59 AM Arnaldo Carvalho de Melo
<arnaldo.melo@gmail.com> wrote:
>
> Em Wed, Apr 22, 2020 at 10:20:16AM +0200, Jiri Olsa escreveu:
> > On Mon, Apr 20, 2020 at 05:43:29PM -0700, Ian Rogers wrote:
> > > al->sym may 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.

Thanks for fixing the commit number, I'll try to figure out why I'm
calculating these incorrectly.

Ian

> - Arnaldo
>
> >
> > > Signed-off-by: Ian Rogers <irogers@google.com>
> > > ---
> > >  tools/perf/util/event.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> > > index dc0e11214ae1..f581550a3015 100644
> > > --- a/tools/perf/util/event.c
> > > +++ b/tools/perf/util/event.c
> > > @@ -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 <jolsa@redhat.com>
> >
> > thanks,
> > jirka
> >
> > >                     snprintf(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

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

* [tip: perf/core] perf script: Avoid NULL dereference on symbol
  2020-04-21  0:43 [PATCH] perf script: avoid null dereference on symbol Ian Rogers
  2020-04-22  8:20 ` Jiri Olsa
@ 2020-05-08 13:05 ` tip-bot2 for Ian Rogers
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot2 for Ian Rogers @ 2020-05-08 13:05 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Ian Rogers, Jiri Olsa, Alexander Shishkin, Mark Rutland,
	Namhyung Kim, Peter Zijlstra, Stephane Eranian,
	Arnaldo Carvalho de Melo, x86, LKML

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 <irogers@google.com>
AuthorDate:    Mon, 20 Apr 2020 17:43:29 -07:00
Committer:     Arnaldo Carvalho de Melo <acme@redhat.com>
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.

Fixes: d2bedb7863e9 ("perf script: Allow --symbol to accept hexadecimal addresses")
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20200421004329.43109-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index dc0e112..f581550 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -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,

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

end of thread, other threads:[~2020-05-08 13:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21  0:43 [PATCH] perf script: avoid null dereference on symbol Ian Rogers
2020-04-22  8:20 ` Jiri Olsa
2020-04-22 13:59   ` Arnaldo Carvalho de Melo
2020-04-22 15:35     ` Ian Rogers
2020-05-08 13:05 ` [tip: perf/core] perf script: Avoid NULL " tip-bot2 for Ian Rogers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).