* [PATCH] perf: symbols: dso__load(): remove check of file on uninitialized memory @ 2016-06-23 14:20 Marc Kleine-Budde 2016-06-24 6:43 ` Jiri Olsa 0 siblings, 1 reply; 7+ messages in thread From: Marc Kleine-Budde @ 2016-06-23 14:20 UTC (permalink / raw) To: Peter Zijlstra, Ingo Molnar; +Cc: linux-kernel, Jiri Olsa, Marc Kleine-Budde 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) This patch fixes the problem by removing the check. Fixes: 403567217d3f perf symbols: Do not read symbols/data from device files Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- tools/perf/util/symbol.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 8a747dc6cf86..b4070daeb17f 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -1432,8 +1432,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) && - filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) + if (filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) dso__set_build_id(dso, build_id); /* -- 2.8.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] perf: symbols: dso__load(): remove check of file on uninitialized memory 2016-06-23 14:20 [PATCH] perf: symbols: dso__load(): remove check of file on uninitialized memory Marc Kleine-Budde @ 2016-06-24 6:43 ` Jiri Olsa 2016-06-24 7:54 ` Marc Kleine-Budde 0 siblings, 1 reply; 7+ messages in thread From: Jiri Olsa @ 2016-06-24 6:43 UTC (permalink / raw) To: Marc Kleine-Budde; +Cc: Peter Zijlstra, Ingo Molnar, linux-kernel, Jiri Olsa On Thu, Jun 23, 2016 at 04:20:21PM +0200, Marc Kleine-Budde wrote: > 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) > > This patch fixes the problem by removing the check. > > Fixes: 403567217d3f perf symbols: Do not read symbols/data from device files > Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> > --- > tools/perf/util/symbol.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c > index 8a747dc6cf86..b4070daeb17f 100644 > --- a/tools/perf/util/symbol.c > +++ b/tools/perf/util/symbol.c > @@ -1432,8 +1432,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) && > - filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) > + if (filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) > dso__set_build_id(dso, build_id); ouch copy&paste error.. we better fix it properly, could you please check attached patch? thanks, jirka --- diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index b044f1a32d16..37e8d20ae03e 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] 7+ messages in thread
* Re: [PATCH] perf: symbols: dso__load(): remove check of file on uninitialized memory 2016-06-24 6:43 ` Jiri Olsa @ 2016-06-24 7:54 ` Marc Kleine-Budde 2016-06-24 11:51 ` Jiri Olsa 0 siblings, 1 reply; 7+ messages in thread From: Marc Kleine-Budde @ 2016-06-24 7:54 UTC (permalink / raw) To: Jiri Olsa; +Cc: Peter Zijlstra, Ingo Molnar, linux-kernel, Jiri Olsa [-- Attachment #1.1: Type: text/plain, Size: 5712 bytes --] On 06/24/2016 08:43 AM, Jiri Olsa wrote: > On Thu, Jun 23, 2016 at 04:20:21PM +0200, Marc Kleine-Budde wrote: >> 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) >> >> This patch fixes the problem by removing the check. >> >> Fixes: 403567217d3f perf symbols: Do not read symbols/data from device files >> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> >> --- >> tools/perf/util/symbol.c | 3 +-- >> 1 file changed, 1 insertion(+), 2 deletions(-) >> >> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c >> index 8a747dc6cf86..b4070daeb17f 100644 >> --- a/tools/perf/util/symbol.c >> +++ b/tools/perf/util/symbol.c >> @@ -1432,8 +1432,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) && >> - filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) >> + if (filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) >> dso__set_build_id(dso, build_id); > > ouch copy&paste error.. we better fix it properly, > could you please check attached patch? The use of uninitialized memory is gone, but the "--symfs" option is ignored: > stat("/lib/libpthread-2.20.so", 0x7ffe440c1270) = -1 ENOENT (No such file or directory) You'll look for the dso in the root file system not in the sysroot. > stat("./root//lib/libpthread-2.20.so", {st_mode=S_IFREG|0755, st_size=68048, ...}) = 0 > open("./root//lib/libpthread-2.20.so", O_RDONLY) = 4 > stat("./root//lib/libpthread-2.20.so", {st_mode=S_IFREG|0755, st_size=68048, ...}) = 0 > open("./root//lib/libpthread-2.20.so", O_RDONLY) = 4 > stat("./root//usr/lib/debug/lib/libpthread-2.20.so.debug", 0x7ffe440c1270) = -1 ENOENT (No such file or directory) > stat("./root//usr/lib/debug/lib/libpthread-2.20.so", 0x7ffe440c1270) = -1 ENOENT (No such file or directory) > stat("./root//lib/libpthread-2.20.so", {st_mode=S_IFREG|0755, st_size=68048, ...}) = 0 > open("./root//lib/libpthread-2.20.so", O_RDONLY) = 5 > stat("./root//lib/.debug/libpthread-2.20.so", {st_mode=S_IFREG|0644, st_size=266508, ...}) = 0 > open("./root//lib/.debug/libpthread-2.20.so", O_RDONLY) = 5 Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 455 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] perf: symbols: dso__load(): remove check of file on uninitialized memory 2016-06-24 7:54 ` Marc Kleine-Budde @ 2016-06-24 11:51 ` Jiri Olsa 2016-06-24 11:56 ` Marc Kleine-Budde 0 siblings, 1 reply; 7+ messages in thread From: Jiri Olsa @ 2016-06-24 11:51 UTC (permalink / raw) To: Marc Kleine-Budde; +Cc: Peter Zijlstra, Ingo Molnar, linux-kernel, Jiri Olsa On Fri, Jun 24, 2016 at 09:54:22AM +0200, Marc Kleine-Budde wrote: > On 06/24/2016 08:43 AM, Jiri Olsa wrote: > > On Thu, Jun 23, 2016 at 04:20:21PM +0200, Marc Kleine-Budde wrote: > >> 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) > >> > >> This patch fixes the problem by removing the check. > >> > >> Fixes: 403567217d3f perf symbols: Do not read symbols/data from device files > >> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> > >> --- > >> tools/perf/util/symbol.c | 3 +-- > >> 1 file changed, 1 insertion(+), 2 deletions(-) > >> > >> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c > >> index 8a747dc6cf86..b4070daeb17f 100644 > >> --- a/tools/perf/util/symbol.c > >> +++ b/tools/perf/util/symbol.c > >> @@ -1432,8 +1432,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) && > >> - filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) > >> + if (filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) > >> dso__set_build_id(dso, build_id); > > > > ouch copy&paste error.. we better fix it properly, > > could you please check attached patch? > > The use of uninitialized memory is gone, but the "--symfs" option is > ignored: > > > stat("/lib/libpthread-2.20.so", 0x7ffe440c1270) = -1 ENOENT (No such file or directory) > > You'll look for the dso in the root file system not in the sysroot. that seems like unrelated to the 'use of uninitialized memory' issue, right? I can't see how the patch I sent could do that.. thanks, jirka ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] perf: symbols: dso__load(): remove check of file on uninitialized memory 2016-06-24 11:51 ` Jiri Olsa @ 2016-06-24 11:56 ` Marc Kleine-Budde 2016-07-21 7:21 ` Marc Kleine-Budde 0 siblings, 1 reply; 7+ messages in thread From: Marc Kleine-Budde @ 2016-06-24 11:56 UTC (permalink / raw) To: Jiri Olsa; +Cc: Peter Zijlstra, Ingo Molnar, linux-kernel, Jiri Olsa [-- Attachment #1.1: Type: text/plain, Size: 5403 bytes --] On 06/24/2016 01:51 PM, Jiri Olsa wrote: > On Fri, Jun 24, 2016 at 09:54:22AM +0200, Marc Kleine-Budde wrote: >> On 06/24/2016 08:43 AM, Jiri Olsa wrote: >>> On Thu, Jun 23, 2016 at 04:20:21PM +0200, Marc Kleine-Budde wrote: >>>> 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) >>>> >>>> This patch fixes the problem by removing the check. >>>> >>>> Fixes: 403567217d3f perf symbols: Do not read symbols/data from device files >>>> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> >>>> --- >>>> tools/perf/util/symbol.c | 3 +-- >>>> 1 file changed, 1 insertion(+), 2 deletions(-) >>>> >>>> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c >>>> index 8a747dc6cf86..b4070daeb17f 100644 >>>> --- a/tools/perf/util/symbol.c >>>> +++ b/tools/perf/util/symbol.c >>>> @@ -1432,8 +1432,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) && >>>> - filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) >>>> + if (filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) >>>> dso__set_build_id(dso, build_id); >>> >>> ouch copy&paste error.. we better fix it properly, >>> could you please check attached patch? >> >> The use of uninitialized memory is gone, but the "--symfs" option is >> ignored: >> >>> stat("/lib/libpthread-2.20.so", 0x7ffe440c1270) = -1 ENOENT (No such file or directory) >> >> You'll look for the dso in the root file system not in the sysroot. > > that seems like unrelated to the 'use of uninitialized memory' issue, right? > I can't see how the patch I sent could do that.. Right. That's a different issue. You can add my: Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> thanks, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 455 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] perf: symbols: dso__load(): remove check of file on uninitialized memory 2016-06-24 11:56 ` Marc Kleine-Budde @ 2016-07-21 7:21 ` Marc Kleine-Budde 2016-07-21 7:54 ` Jiri Olsa 0 siblings, 1 reply; 7+ messages in thread From: Marc Kleine-Budde @ 2016-07-21 7:21 UTC (permalink / raw) To: Jiri Olsa Cc: Peter Zijlstra, Ingo Molnar, linux-kernel, Jiri Olsa, Uwe Kleine-Koenig [-- Attachment #1.1: Type: text/plain, Size: 5621 bytes --] On 06/24/2016 01:56 PM, Marc Kleine-Budde wrote: > On 06/24/2016 01:51 PM, Jiri Olsa wrote: >> On Fri, Jun 24, 2016 at 09:54:22AM +0200, Marc Kleine-Budde wrote: >>> On 06/24/2016 08:43 AM, Jiri Olsa wrote: >>>> On Thu, Jun 23, 2016 at 04:20:21PM +0200, Marc Kleine-Budde wrote: >>>>> 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) >>>>> >>>>> This patch fixes the problem by removing the check. >>>>> >>>>> Fixes: 403567217d3f perf symbols: Do not read symbols/data from device files >>>>> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> >>>>> --- >>>>> tools/perf/util/symbol.c | 3 +-- >>>>> 1 file changed, 1 insertion(+), 2 deletions(-) >>>>> >>>>> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c >>>>> index 8a747dc6cf86..b4070daeb17f 100644 >>>>> --- a/tools/perf/util/symbol.c >>>>> +++ b/tools/perf/util/symbol.c >>>>> @@ -1432,8 +1432,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) && >>>>> - filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) >>>>> + if (filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) >>>>> dso__set_build_id(dso, build_id); >>>> >>>> ouch copy&paste error.. we better fix it properly, >>>> could you please check attached patch? >>> >>> The use of uninitialized memory is gone, but the "--symfs" option is >>> ignored: >>> >>>> stat("/lib/libpthread-2.20.so", 0x7ffe440c1270) = -1 ENOENT (No such file or directory) >>> >>> You'll look for the dso in the root file system not in the sysroot. >> >> that seems like unrelated to the 'use of uninitialized memory' issue, right? >> I can't see how the patch I sent could do that.. > > Right. That's a different issue. You can add my: > > Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> I don't see this patch on mainline nor on linux-next, or am I missing something? Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 455 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] perf: symbols: dso__load(): remove check of file on uninitialized memory 2016-07-21 7:21 ` Marc Kleine-Budde @ 2016-07-21 7:54 ` Jiri Olsa 0 siblings, 0 replies; 7+ messages in thread From: Jiri Olsa @ 2016-07-21 7:54 UTC (permalink / raw) To: Marc Kleine-Budde Cc: Peter Zijlstra, Ingo Molnar, linux-kernel, Jiri Olsa, Uwe Kleine-Koenig On Thu, Jul 21, 2016 at 09:21:00AM +0200, Marc Kleine-Budde wrote: SNIP > >>>>> This patch fixes the problem by removing the check. > >>>>> > >>>>> Fixes: 403567217d3f perf symbols: Do not read symbols/data from device files > >>>>> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> > >>>>> --- > >>>>> tools/perf/util/symbol.c | 3 +-- > >>>>> 1 file changed, 1 insertion(+), 2 deletions(-) > >>>>> > >>>>> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c > >>>>> index 8a747dc6cf86..b4070daeb17f 100644 > >>>>> --- a/tools/perf/util/symbol.c > >>>>> +++ b/tools/perf/util/symbol.c > >>>>> @@ -1432,8 +1432,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) && > >>>>> - filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) > >>>>> + if (filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0) > >>>>> dso__set_build_id(dso, build_id); > >>>> > >>>> ouch copy&paste error.. we better fix it properly, > >>>> could you please check attached patch? > >>> > >>> The use of uninitialized memory is gone, but the "--symfs" option is > >>> ignored: > >>> > >>>> stat("/lib/libpthread-2.20.so", 0x7ffe440c1270) = -1 ENOENT (No such file or directory) > >>> > >>> You'll look for the dso in the root file system not in the sysroot. > >> > >> that seems like unrelated to the 'use of uninitialized memory' issue, right? > >> I can't see how the patch I sent could do that.. > > > > Right. That's a different issue. You can add my: > > > > Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> > > I don't see this patch on mainline nor on linux-next, or am I missing > something? sorry for delay, forgot about this one... I asked Arnaldo to take this version instead: http://marc.info/?l=linux-kernel&m=146908497508581&w=2 thanks, jirka ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-07-21 7:55 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-06-23 14:20 [PATCH] perf: symbols: dso__load(): remove check of file on uninitialized memory Marc Kleine-Budde 2016-06-24 6:43 ` Jiri Olsa 2016-06-24 7:54 ` Marc Kleine-Budde 2016-06-24 11:51 ` Jiri Olsa 2016-06-24 11:56 ` Marc Kleine-Budde 2016-07-21 7:21 ` Marc Kleine-Budde 2016-07-21 7:54 ` Jiri Olsa
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).