From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932177AbbLNJsM (ORCPT ); Mon, 14 Dec 2015 04:48:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50897 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932105AbbLNJsL (ORCPT ); Mon, 14 Dec 2015 04:48:11 -0500 Date: Mon, 14 Dec 2015 10:48:07 +0100 From: Jiri Olsa To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Ingo Molnar , Peter Zijlstra , LKML , David Ahern , Adrian Hunter Subject: Re: [PATCH] perf test: Fix hist testcases when kptr_restrict is on Message-ID: <20151214094807.GA27640@krava.brq.redhat.com> References: <1450062673-22312-1-git-send-email-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450062673-22312-1-git-send-email-namhyung@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 thanks, jirka > > Signed-off-by: Namhyung Kim > --- > 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 >