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


Groups > linux.kernel > #1290808 > unrolled thread

[PATCH] perf test: Fix hist testcases when kptr_restrict is on

Started byNamhyung Kim <namhyung@kernel.org>
First post2015-12-14 04:20 +0100
Last post2015-12-18 09:50 +0100
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] perf test: Fix hist testcases when kptr_restrict is on Namhyung Kim <namhyung@kernel.org> - 2015-12-14 04:20 +0100
    Re: [PATCH] perf test: Fix hist testcases when kptr_restrict is on Jiri Olsa <jolsa@redhat.com> - 2015-12-14 10:50 +0100
      Re: [PATCH] perf test: Fix hist testcases when kptr_restrict is on Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-12-14 16:20 +0100
    [tip:perf/core] perf test:   Fix hist testcases when kptr_restrict is on tip-bot for Namhyung Kim <tipbot@zytor.com> - 2015-12-18 09:50 +0100

#1290808 — [PATCH] perf test: Fix hist testcases when kptr_restrict is on

FromNamhyung Kim <namhyung@kernel.org>
Date2015-12-14 04:20 +0100
Subject[PATCH] perf test: Fix hist testcases when kptr_restrict is on
Message-ID<qFrQ5-sK-7@gated-at.bofh.it>
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

--
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/

[toc] | [next] | [standalone]


#1291014

FromJiri Olsa <jolsa@redhat.com>
Date2015-12-14 10:50 +0100
Message-ID<qFxVx-4it-29@gated-at.bofh.it>
In reply to#1290808
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
> 
--
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/

[toc] | [prev] | [next] | [standalone]


#1291269

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-12-14 16:20 +0100
Message-ID<qFD4T-7Rv-37@gated-at.bofh.it>
In reply to#1291014
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
> > 
--
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/

[toc] | [prev] | [next] | [standalone]


#1294512 — [tip:perf/core] perf test: Fix hist testcases when kptr_restrict is on

Fromtip-bot for Namhyung Kim <tipbot@zytor.com>
Date2015-12-18 09:50 +0100
Subject[tip:perf/core] perf test: Fix hist testcases when kptr_restrict is on
Message-ID<qGYTE-3jm-23@gated-at.bofh.it>
In reply to#1290808
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;
 }
 
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web