Skip to content

Commit

Permalink
perf test: Fix hist testcases when kptr_restrict is on
Browse files Browse the repository at this point in the history
Currently if kptr_restrict is enabled, all hist tests failed with
segfaults.  This is because machine__create_kernel_maps() in
setup_fake_machine() failed in that situation, and it called
machine__delete() on the error path.  But outer callers again called
machines__exit() causing double free for the host machine.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1450062673-22312-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Dec 14, 2015
1 parent bd0f889 commit 71d6de6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tools/perf/tests/hists_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ struct machine *setup_fake_machine(struct machines *machines)
}

if (machine__create_kernel_maps(machine)) {
pr_debug("Not enough memory for machine setup\n");
goto out;
pr_debug("Cannot create kernel maps\n");
return NULL;
}

for (i = 0; i < ARRAY_SIZE(fake_threads); i++) {
Expand Down Expand Up @@ -155,7 +155,6 @@ struct machine *setup_fake_machine(struct machines *machines)
out:
pr_debug("Not enough memory for machine setup\n");
machine__delete_threads(machine);
machine__delete(machine);
return NULL;
}

Expand Down

0 comments on commit 71d6de6

Please sign in to comment.