All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] perf data convert: Include config.h header
@ 2016-06-24 12:40 Jiri Olsa
  2016-06-24 12:40 ` [PATCH 2/2] perf tools: Use proper dso name for is_regular_file Jiri Olsa
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jiri Olsa @ 2016-06-24 12:40 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
	Marc Kleine-Budde, Wang Nan

otherwise some compiler might scream:

  $ make LIBBABELTRACE_DIR=/opt/libbabeltrace/ LIBBABELTRACE=1
    BUILD:   Doing 'make -j4' parallel build
    CC       util/data-convert-bt.o
  util/data-convert-bt.c: In function ‘convert__config’:
  util/data-convert-bt.c:1299:19: error: implicit declaration of function ‘perf_config_u64’ [-Werror=implicit-function-declaration]
     c->queue_size = perf_config_u64(var, value);
  ...

Link: http://lkml.kernel.org/n/tip-t9dyx71w49dy5tacpdzr5b2p@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/data-convert-bt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
index 9f53020c3269..5186bb1168af 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -26,6 +26,7 @@
 #include "evlist.h"
 #include "evsel.h"
 #include "machine.h"
+#include "config.h"
 
 #define pr_N(n, fmt, ...) \
 	eprintf(n, debug_data_convert, fmt, ##__VA_ARGS__)
-- 
2.4.11

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

* [PATCH 2/2] perf tools: Use proper dso name for is_regular_file
  2016-06-24 12:40 [PATCH 1/2] perf data convert: Include config.h header Jiri Olsa
@ 2016-06-24 12:40 ` Jiri Olsa
  2016-06-29  9:44   ` [tip:perf/core] perf symbols: " tip-bot for Jiri Olsa
  2016-06-25  1:29 ` [PATCH 1/2] perf data convert: Include config.h header Wangnan (F)
  2016-06-29  9:42 ` [tip:perf/core] " tip-bot for Jiri Olsa
  2 siblings, 1 reply; 6+ messages in thread
From: Jiri Olsa @ 2016-06-24 12:40 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
	Marc Kleine-Budde, Wang Nan

From: Jiri Olsa <jolsa@redhat.com>

Marc reported use of uninitialized memory:

> In commit "403567217d3f perf symbols: Do not read symbols/data from
> device files" a check to uninitialzied memory was added. This leads to
> the following valgrind output:
>
>  ==24515== Syscall param stat(file_name) points to uninitialised byte(s)
>  ==24515==    at 0x75B26D5: _xstat (in /lib/x86_64-linux-gnu/libc-2.22.so)
>  ==24515==    by 0x4E548D: stat (stat.h:454)
>  ==24515==    by 0x4E548D: is_regular_file (util.c:687)
>  ==24515==    by 0x4A5BEE: dso__load (symbol.c:1435)
>  ==24515==    by 0x4BB1AE: map__load (map.c:289)
>  ==24515==    by 0x4BB1AE: map__find_symbol (map.c:333)
>  ==24515==    by 0x4835B3: thread__find_addr_location (event.c:1300)
>  ==24515==    by 0x4B5342: add_callchain_ip (machine.c:1652)
>  ==24515==    by 0x4B5342: thread__resolve_callchain_sample (machine.c:1906)
>  ==24515==    by 0x4B9E7D: thread__resolve_callchain (machine.c:1958)
>  ==24515==    by 0x441B3E: process_event (builtin-script.c:795)
>  ==24515==    by 0x441B3E: process_sample_event (builtin-script.c:920)
>  ==24515==    by 0x4BEE29: perf_evlist__deliver_sample (session.c:1192)
>  ==24515==    by 0x4BEE29: machines__deliver_event (session.c:1229)
>  ==24515==    by 0x4BF770: perf_session__deliver_event (session.c:1286)
>  ==24515==    by 0x4BF770: ordered_events__deliver_event (session.c:114)
>  ==24515==    by 0x4C1D17: __ordered_events__flush (ordered-events.c:207)
>  ==24515==    by 0x4C1D17: ordered_events__flush.part.3 (ordered-events.c:274)
>  ==24515==    by 0x4BF44C: perf_session__process_user_event (session.c:1325)
>  ==24515==    by 0x4BF44C: perf_session__process_event (session.c:1451)
>  ==24515==  Address 0x807c6a0 is 0 bytes inside a block of size 4,096 alloc'd
>  ==24515==    at 0x4C29C0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
>  ==24515==    by 0x4A5BCB: dso__load (symbol.c:1421)
>  ==24515==    by 0x4BB1AE: map__load (map.c:289)
>  ==24515==    by 0x4BB1AE: map__find_symbol (map.c:333)
>  ==24515==    by 0x4835B3: thread__find_addr_location (event.c:1300)
>  ==24515==    by 0x4B5342: add_callchain_ip (machine.c:1652)
>  ==24515==    by 0x4B5342: thread__resolve_callchain_sample (machine.c:1906)
>  ==24515==    by 0x4B9E7D: thread__resolve_callchain (machine.c:1958)
>  ==24515==    by 0x441B3E: process_event (builtin-script.c:795)
>  ==24515==    by 0x441B3E: process_sample_event (builtin-script.c:920)
>  ==24515==    by 0x4BEE29: perf_evlist__deliver_sample (session.c:1192)
>  ==24515==    by 0x4BEE29: machines__deliver_event (session.c:1229)
>  ==24515==    by 0x4BF770: perf_session__deliver_event (session.c:1286)
>  ==24515==    by 0x4BF770: ordered_events__deliver_event (session.c:114)
>  ==24515==    by 0x4C1D17: __ordered_events__flush (ordered-events.c:207)
>  ==24515==    by 0x4C1D17: ordered_events__flush.part.3 (ordered-events.c:274)
>  ==24515==    by 0x4BF44C: perf_session__process_user_event (session.c:1325)
>  ==24515==    by 0x4BF44C: perf_session__process_event (session.c:1451)
>  ==24515==    by 0x4C0EAC: __perf_session__process_events (session.c:1804)
>  ==24515==    by 0x4C0EAC: perf_session__process_events (session.c:1858)

The reason was a typo that passed global 'name' variable
as is_regular_file argument instead dso->long_name.

Fixes: 403567217d3f perf symbols: Do not read symbols/data from device files
Reported-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Link: http://lkml.kernel.org/n/tip-efg7784zdt6xb2ivq17yujm1@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/symbol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 09c5c34ae38d..c48abc721b6b 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1430,7 +1430,7 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
 	 * Read the build id if possible. This is required for
 	 * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
 	 */
-	if (is_regular_file(name) &&
+	if (is_regular_file(dso->long_name) &&
 	    filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0)
 		dso__set_build_id(dso, build_id);
 
-- 
2.4.11

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

* Re: [PATCH 1/2] perf data convert: Include config.h header
  2016-06-24 12:40 [PATCH 1/2] perf data convert: Include config.h header Jiri Olsa
  2016-06-24 12:40 ` [PATCH 2/2] perf tools: Use proper dso name for is_regular_file Jiri Olsa
@ 2016-06-25  1:29 ` Wangnan (F)
  2016-06-26 17:06   ` Arnaldo Carvalho de Melo
  2016-06-29  9:42 ` [tip:perf/core] " tip-bot for Jiri Olsa
  2 siblings, 1 reply; 6+ messages in thread
From: Wangnan (F) @ 2016-06-25  1:29 UTC (permalink / raw)
  To: Jiri Olsa, Arnaldo Carvalho de Melo
  Cc: lkml, David Ahern, Ingo Molnar, Namhyung Kim, Peter Zijlstra,
	Marc Kleine-Budde

You can add:

Fixes: 41840d211c51 ("perf config: Move config declarations from 
util/cache.h to util/config.h")

Thank you.

On 2016/6/24 20:40, Jiri Olsa wrote:
> otherwise some compiler might scream:
>
>    $ make LIBBABELTRACE_DIR=/opt/libbabeltrace/ LIBBABELTRACE=1
>      BUILD:   Doing 'make -j4' parallel build
>      CC       util/data-convert-bt.o
>    util/data-convert-bt.c: In function ‘convert__config’:
>    util/data-convert-bt.c:1299:19: error: implicit declaration of function ‘perf_config_u64’ [-Werror=implicit-function-declaration]
>       c->queue_size = perf_config_u64(var, value);
>    ...
>
> Link: http://lkml.kernel.org/n/tip-t9dyx71w49dy5tacpdzr5b2p@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>   tools/perf/util/data-convert-bt.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
> index 9f53020c3269..5186bb1168af 100644
> --- a/tools/perf/util/data-convert-bt.c
> +++ b/tools/perf/util/data-convert-bt.c
> @@ -26,6 +26,7 @@
>   #include "evlist.h"
>   #include "evsel.h"
>   #include "machine.h"
> +#include "config.h"
>   
>   #define pr_N(n, fmt, ...) \
>   	eprintf(n, debug_data_convert, fmt, ##__VA_ARGS__)

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

* Re: [PATCH 1/2] perf data convert: Include config.h header
  2016-06-25  1:29 ` [PATCH 1/2] perf data convert: Include config.h header Wangnan (F)
@ 2016-06-26 17:06   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-06-26 17:06 UTC (permalink / raw)
  To: Wangnan (F)
  Cc: Jiri Olsa, lkml, David Ahern, Ingo Molnar, Namhyung Kim,
	Peter Zijlstra, Marc Kleine-Budde

Em Sat, Jun 25, 2016 at 09:29:04AM +0800, Wangnan (F) escreveu:
> You can add:
> 
> Fixes: 41840d211c51 ("perf config: Move config declarations from
> util/cache.h to util/config.h")

Yeah, I'll do that, thanks for pointing it out!

- Arnaldo
 
> Thank you.
> 
> On 2016/6/24 20:40, Jiri Olsa wrote:
> > otherwise some compiler might scream:
> > 
> >    $ make LIBBABELTRACE_DIR=/opt/libbabeltrace/ LIBBABELTRACE=1
> >      BUILD:   Doing 'make -j4' parallel build
> >      CC       util/data-convert-bt.o
> >    util/data-convert-bt.c: In function ‘convert__config’:
> >    util/data-convert-bt.c:1299:19: error: implicit declaration of function ‘perf_config_u64’ [-Werror=implicit-function-declaration]
> >       c->queue_size = perf_config_u64(var, value);
> >    ...
> > 
> > Link: http://lkml.kernel.org/n/tip-t9dyx71w49dy5tacpdzr5b2p@git.kernel.org
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> >   tools/perf/util/data-convert-bt.c | 1 +
> >   1 file changed, 1 insertion(+)
> > 
> > diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
> > index 9f53020c3269..5186bb1168af 100644
> > --- a/tools/perf/util/data-convert-bt.c
> > +++ b/tools/perf/util/data-convert-bt.c
> > @@ -26,6 +26,7 @@
> >   #include "evlist.h"
> >   #include "evsel.h"
> >   #include "machine.h"
> > +#include "config.h"
> >   #define pr_N(n, fmt, ...) \
> >   	eprintf(n, debug_data_convert, fmt, ##__VA_ARGS__)
> 

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

* [tip:perf/core] perf data convert: Include config.h header
  2016-06-24 12:40 [PATCH 1/2] perf data convert: Include config.h header Jiri Olsa
  2016-06-24 12:40 ` [PATCH 2/2] perf tools: Use proper dso name for is_regular_file Jiri Olsa
  2016-06-25  1:29 ` [PATCH 1/2] perf data convert: Include config.h header Wangnan (F)
@ 2016-06-29  9:42 ` tip-bot for Jiri Olsa
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-06-29  9:42 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hekuang, mingo, jolsa, wangnan0, treeze.taeung, hpa,
	tglx, namhyung, mkl, a.p.zijlstra, acme, dsahern

Commit-ID:  f6c12a004c149a7b0ea1332fa715979888dd4695
Gitweb:     http://git.kernel.org/tip/f6c12a004c149a7b0ea1332fa715979888dd4695
Author:     Jiri Olsa <jolsa@kernel.org>
AuthorDate: Fri, 24 Jun 2016 14:40:24 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 28 Jun 2016 10:54:52 -0300

perf data convert: Include config.h header

Otherwise some compiler might scream:

  $ make LIBBABELTRACE_DIR=/opt/libbabeltrace/ LIBBABELTRACE=1
    BUILD:   Doing 'make -j4' parallel build
    CC       util/data-convert-bt.o
  util/data-convert-bt.c: In function ‘convert__config’:
  util/data-convert-bt.c:1299:19: error: implicit declaration of function ‘perf_config_u64’ [-Werror=implicit-function-declaration]
     c->queue_size = perf_config_u64(var, value);
  ...

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Taeung Song <treeze.taeung@gmail.com>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 41840d211c51 ("perf config: Move config declarations from util/cache.h to util/config.h")
Link: http://lkml.kernel.org/r/1466772025-17471-1-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/data-convert-bt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c
index 4b59879..7b1bc24 100644
--- a/tools/perf/util/data-convert-bt.c
+++ b/tools/perf/util/data-convert-bt.c
@@ -26,6 +26,7 @@
 #include "evlist.h"
 #include "evsel.h"
 #include "machine.h"
+#include "config.h"
 
 #define pr_N(n, fmt, ...) \
 	eprintf(n, debug_data_convert, fmt, ##__VA_ARGS__)

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

* [tip:perf/core] perf symbols: Use proper dso name for is_regular_file
  2016-06-24 12:40 ` [PATCH 2/2] perf tools: Use proper dso name for is_regular_file Jiri Olsa
@ 2016-06-29  9:44   ` tip-bot for Jiri Olsa
  0 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Jiri Olsa @ 2016-06-29  9:44 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, jolsa, a.p.zijlstra, tglx, hpa, mkl, jolsa, acme,
	dsahern, mingo, namhyung, wangnan0

Commit-ID:  ed7b630b310775f3b6c0b360ede7a12cd8dff6fe
Gitweb:     http://git.kernel.org/tip/ed7b630b310775f3b6c0b360ede7a12cd8dff6fe
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Fri, 24 Jun 2016 14:40:25 +0200
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 28 Jun 2016 10:54:54 -0300

perf symbols: Use proper dso name for is_regular_file

Marc reported use of uninitialized memory:

> In commit "403567217d3f perf symbols: Do not read symbols/data from
> device files" a check to uninitialzied memory was added. This leads to
> the following valgrind output:
>
>  ==24515== Syscall param stat(file_name) points to uninitialised byte(s)
>  ==24515==    at 0x75B26D5: _xstat (in /lib/x86_64-linux-gnu/libc-2.22.so)
>  ==24515==    by 0x4E548D: stat (stat.h:454)
>  ==24515==    by 0x4E548D: is_regular_file (util.c:687)
>  ==24515==    by 0x4A5BEE: dso__load (symbol.c:1435)
>  ==24515==    by 0x4BB1AE: map__load (map.c:289)
>  ==24515==    by 0x4BB1AE: map__find_symbol (map.c:333)
>  ==24515==    by 0x4835B3: thread__find_addr_location (event.c:1300)
>  ==24515==    by 0x4B5342: add_callchain_ip (machine.c:1652)
>  ==24515==    by 0x4B5342: thread__resolve_callchain_sample (machine.c:1906)
>  ==24515==    by 0x4B9E7D: thread__resolve_callchain (machine.c:1958)
>  ==24515==    by 0x441B3E: process_event (builtin-script.c:795)
>  ==24515==    by 0x441B3E: process_sample_event (builtin-script.c:920)
>  ==24515==    by 0x4BEE29: perf_evlist__deliver_sample (session.c:1192)
>  ==24515==    by 0x4BEE29: machines__deliver_event (session.c:1229)
>  ==24515==    by 0x4BF770: perf_session__deliver_event (session.c:1286)
>  ==24515==    by 0x4BF770: ordered_events__deliver_event (session.c:114)
>  ==24515==    by 0x4C1D17: __ordered_events__flush (ordered-events.c:207)
>  ==24515==    by 0x4C1D17: ordered_events__flush.part.3 (ordered-events.c:274)
>  ==24515==    by 0x4BF44C: perf_session__process_user_event (session.c:1325)
>  ==24515==    by 0x4BF44C: perf_session__process_event (session.c:1451)
>  ==24515==  Address 0x807c6a0 is 0 bytes inside a block of size 4,096 alloc'd
>  ==24515==    at 0x4C29C0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
>  ==24515==    by 0x4A5BCB: dso__load (symbol.c:1421)
>  ==24515==    by 0x4BB1AE: map__load (map.c:289)
>  ==24515==    by 0x4BB1AE: map__find_symbol (map.c:333)
>  ==24515==    by 0x4835B3: thread__find_addr_location (event.c:1300)
>  ==24515==    by 0x4B5342: add_callchain_ip (machine.c:1652)
>  ==24515==    by 0x4B5342: thread__resolve_callchain_sample (machine.c:1906)
>  ==24515==    by 0x4B9E7D: thread__resolve_callchain (machine.c:1958)
>  ==24515==    by 0x441B3E: process_event (builtin-script.c:795)
>  ==24515==    by 0x441B3E: process_sample_event (builtin-script.c:920)
>  ==24515==    by 0x4BEE29: perf_evlist__deliver_sample (session.c:1192)
>  ==24515==    by 0x4BEE29: machines__deliver_event (session.c:1229)
>  ==24515==    by 0x4BF770: perf_session__deliver_event (session.c:1286)
>  ==24515==    by 0x4BF770: ordered_events__deliver_event (session.c:114)
>  ==24515==    by 0x4C1D17: __ordered_events__flush (ordered-events.c:207)
>  ==24515==    by 0x4C1D17: ordered_events__flush.part.3 (ordered-events.c:274)
>  ==24515==    by 0x4BF44C: perf_session__process_user_event (session.c:1325)
>  ==24515==    by 0x4BF44C: perf_session__process_event (session.c:1451)
>  ==24515==    by 0x4C0EAC: __perf_session__process_events (session.c:1804)
>  ==24515==    by 0x4C0EAC: perf_session__process_events (session.c:1858)

The reason was a typo that passed global 'name' variable as the
is_regular_file argument instead dso->long_name.

Reported-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 403567217d3f ("perf symbols: Do not read symbols/data from device files")
Link: http://lkml.kernel.org/r/1466772025-17471-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index b044f1a..37e8d20 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1430,7 +1430,7 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
 	 * Read the build id if possible. This is required for
 	 * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
 	 */
-	if (is_regular_file(name) &&
+	if (is_regular_file(dso->long_name) &&
 	    filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0)
 		dso__set_build_id(dso, build_id);
 

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

end of thread, other threads:[~2016-06-29  9:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-24 12:40 [PATCH 1/2] perf data convert: Include config.h header Jiri Olsa
2016-06-24 12:40 ` [PATCH 2/2] perf tools: Use proper dso name for is_regular_file Jiri Olsa
2016-06-29  9:44   ` [tip:perf/core] perf symbols: " tip-bot for Jiri Olsa
2016-06-25  1:29 ` [PATCH 1/2] perf data convert: Include config.h header Wangnan (F)
2016-06-26 17:06   ` Arnaldo Carvalho de Melo
2016-06-29  9:42 ` [tip:perf/core] " tip-bot for Jiri Olsa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.