All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf test: Fix hist testcases when kptr_restrict is on
@ 2015-12-14  3:11 Namhyung Kim
  2015-12-14  9:48 ` Jiri Olsa
  2015-12-18  8:47 ` [tip:perf/core] " tip-bot for Namhyung Kim
  0 siblings, 2 replies; 4+ messages in thread
From: Namhyung Kim @ 2015-12-14  3:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, David Ahern,
	Adrian Hunter

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>
---
 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 46f453b1de60..bcfd081ee1d2 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;
 }
 
-- 
2.6.4


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

* Re: [PATCH] perf test: Fix hist testcases when kptr_restrict is on
  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:perf/core] " tip-bot for Namhyung Kim
  1 sibling, 1 reply; 4+ messages in thread
From: Jiri Olsa @ 2015-12-14  9:48 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, LKML,
	David Ahern, Adrian Hunter

On Mon, Dec 14, 2015 at 12:11:13PM +0900, Namhyung Kim wrote:
> 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.

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

> 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  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 46f453b1de60..bcfd081ee1d2 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;
>  }
>  
> -- 
> 2.6.4
> 

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

* Re: [PATCH] perf test: Fix hist testcases when kptr_restrict is on
  2015-12-14  9:48 ` Jiri Olsa
@ 2015-12-14 15:15   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-12-14 15:15 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Namhyung Kim, Ingo Molnar, Peter Zijlstra, LKML, David Ahern,
	Adrian Hunter

Em Mon, Dec 14, 2015 at 10:48:07AM +0100, Jiri Olsa escreveu:
> On Mon, Dec 14, 2015 at 12:11:13PM +0900, Namhyung Kim wrote:
> > 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.
> 
> Acked-by: Jiri Olsa <jolsa@kernel.org>

Thanks, applied.
 
> thanks,
> jirka
> 
> > 
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> >  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 46f453b1de60..bcfd081ee1d2 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;
> >  }
> >  
> > -- 
> > 2.6.4
> > 

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

* [tip:perf/core] perf test: Fix hist testcases when kptr_restrict is on
  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-18  8:47 ` tip-bot for Namhyung Kim
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Namhyung Kim @ 2015-12-18  8:47 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, namhyung, hpa, a.p.zijlstra, adrian.hunter, mingo,
	jolsa, dsahern, tglx, acme

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;
 }
 

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

end of thread, other threads:[~2015-12-18  8:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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:perf/core] " tip-bot for Namhyung Kim

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.