Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1286987

[PATCH perf/core 21/22] perf: Fix machine.vmlinux_maps to make sure to clear the old one

From Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Newsgroups linux.kernel
Subject [PATCH perf/core 21/22] perf: Fix machine.vmlinux_maps to make sure to clear the old one
Date 2015-12-09 03:20 +0100
Message-ID <qDCwi-25G-13@gated-at.bofh.it> (permalink)
References <qDCwi-25G-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Fix machine.vmlinux_maps to make sure to clear the old one
if it is renewal. This can leak the previous maps on the
vmlinux_maps because those are just overwritten.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
---
 tools/perf/util/machine.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index bfc289c..3172aa5 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -44,6 +44,8 @@ int machine__init(struct machine *machine, const char *root_dir, pid_t pid)
 	machine->comm_exec = false;
 	machine->kernel_start = 0;
 
+	memset(machine->vmlinux_maps, 0, sizeof(struct map *) * MAP__NR_TYPES);
+
 	machine->root_dir = strdup(root_dir);
 	if (machine->root_dir == NULL)
 		return -ENOMEM;
@@ -770,6 +772,9 @@ int __machine__create_kernel_maps(struct machine *machine, struct dso *kernel)
 	enum map_type type;
 	u64 start = machine__get_running_kernel_start(machine, NULL);
 
+	/* In case of renewal the kernel map, destroy previous one */
+	machine__destroy_kernel_maps(machine);
+
 	for (type = 0; type < MAP__NR_TYPES; ++type) {
 		struct kmap *kmap;
 		struct map *map;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH perf/core 21/22] perf: Fix machine.vmlinux_maps to make sure  to clear the old one Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-12-09 03:20 +0100
  Re: [PATCH perf/core 21/22] perf: Fix machine.vmlinux_maps to make  sure to clear the old one Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-09 16:30 +0100
    Re: [PATCH perf/core 21/22] perf: Fix machine.vmlinux_maps to make  sure to clear the old one "Wangnan (F)" <wangnan0@huawei.com> - 2015-12-10 04:00 +0100
  [tip:perf/core] perf machine:   Fix machine.vmlinux_maps to make sure to clear the old one tip-bot for Masami Hiramatsu <tipbot@zytor.com> - 2015-12-10 09:20 +0100

csiph-web