public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, namhyung@kernel.org, hpa@zytor.com,
	a.p.zijlstra@chello.nl, adrian.hunter@intel.com,
	mingo@kernel.org, jolsa@kernel.org, dsahern@gmail.com,
	tglx@linutronix.de, acme@redhat.com
Subject: [tip:perf/core] perf test: Fix hist testcases when kptr_restrict is on
Date: Fri, 18 Dec 2015 00:47:13 -0800	[thread overview]
Message-ID: <tip-71d6de64feddd4b455555326fba2111b3006d9e0@git.kernel.org> (raw)
In-Reply-To: <1450062673-22312-1-git-send-email-namhyung@kernel.org>

Commit-ID:  71d6de64feddd4b455555326fba2111b3006d9e0
Gitweb:     http://git.kernel.org/tip/71d6de64feddd4b455555326fba2111b3006d9e0
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Mon, 14 Dec 2015 12:11:13 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 14 Dec 2015 12:15:07 -0300

perf test: Fix hist testcases when kptr_restrict is on

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>
---
 tools/perf/tests/hists_common.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/perf/tests/hists_common.c b/tools/perf/tests/hists_common.c
index 46f453b..bcfd081 100644
--- a/tools/perf/tests/hists_common.c
+++ b/tools/perf/tests/hists_common.c
@@ -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++) {
@@ -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;
 }
 

      parent reply	other threads:[~2015-12-18  8:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-14  3:11 [PATCH] perf test: Fix hist testcases when kptr_restrict is on Namhyung Kim
2015-12-14  9:48 ` Jiri Olsa
2015-12-14 15:15   ` Arnaldo Carvalho de Melo
2015-12-18  8:47 ` tip-bot for Namhyung Kim [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-71d6de64feddd4b455555326fba2111b3006d9e0@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox