Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753799AbbLOEDi (ORCPT ); Mon, 14 Dec 2015 23:03:38 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:64764 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753057AbbLOEDg (ORCPT ); Mon, 14 Dec 2015 23:03:36 -0500 Message-ID: <566F910A.9010901@huawei.com> Date: Tue, 15 Dec 2015 12:03:22 +0800 From: "Wangnan (F)" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Arnaldo Carvalho de Melo , Ingo Molnar CC: , Namhyung Kim , "Jiri Olsa" , Adrian Hunter , David Ahern , Peter Zijlstra , "Arnaldo Carvalho de Melo" Subject: Re: [PATCH 05/16] perf test: Fix hist testcases when kptr_restrict is on References: <1450115081-22962-1-git-send-email-acme@kernel.org> <1450115081-22962-6-git-send-email-acme@kernel.org> In-Reply-To: <1450115081-22962-6-git-send-email-acme@kernel.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.111.66.109] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A0B0204.566F9114.00FE,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 67385049e3c0d51c5ddecec97f9e45eb Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1936 Lines: 52 Hi, On 2015/12/15 1:44, Arnaldo Carvalho de Melo wrote: > From: Namhyung Kim > > 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 > Cc: Jiri Olsa > Cc: Adrian Hunter > Cc: David Ahern > Cc: Peter Zijlstra > Link: http://lkml.kernel.org/r/1450062673-22312-1-git-send-email-namhyung@kernel.org > Signed-off-by: Arnaldo Carvalho de Melo > --- > tools/perf/tests/hists_common.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) I have a similar patch on this problem at [1][2]. This patch applied solves only half of the problem I seen. Although double free is gone, in case when kptr_restrict is enabled a normal user still gets incorrect result. For example: $ ./perf test -v 'filtering hist entries' 25: Test filtering hist entries : --- start --- test child forked, pid 4186 Cannot create kernel maps test child finished with 0 ---- end ---- Test filtering hist entries: Ok The test body doesn't get called at all. I think in this case we'd better return 'Skip'. I'd like to send another for it. [1] http://lkml.kernel.org/g/1450089563-122430-2-git-send-email-wangnan0@huawei.com [2] http://lkml.kernel.org/g/1449726768-79624-1-git-send-email-wangnan0@huawei.com -- 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/