From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932072AbcFWN2w (ORCPT ); Thu, 23 Jun 2016 09:28:52 -0400 Received: from mail.kernel.org ([198.145.29.136]:50976 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751265AbcFWN2s (ORCPT ); Thu, 23 Jun 2016 09:28:48 -0400 Date: Thu, 23 Jun 2016 10:28:42 -0300 From: Arnaldo Carvalho de Melo To: Arnaldo Carvalho de Melo Cc: "Wangnan (F)" , He Kuang , peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, jolsa@redhat.com, jpoimboe@redhat.com, ak@linux.intel.com, eranian@google.com, namhyung@kernel.org, adrian.hunter@intel.com, sukadev@linux.vnet.ibm.com, masami.hiramatsu.pt@hitachi.com, tumanova@linux.vnet.ibm.com, kan.liang@intel.com, penberg@kernel.org, dsahern@gmail.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/5] perf tools: Fix NULL pointer deference when vdso not found Message-ID: <20160623132842.GM4213@kernel.org> References: <1466578626-92406-1-git-send-email-hekuang@huawei.com> <1466578626-92406-6-git-send-email-hekuang@huawei.com> <576B433F.4080202@huawei.com> <20160623120704.GL4213@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160623120704.GL4213@kernel.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.6.1 (2016-04-27) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Jun 23, 2016 at 09:07:04AM -0300, Arnaldo Carvalho de Melo escreveu: > Em Thu, Jun 23, 2016 at 10:02:39AM +0800, Wangnan (F) escreveu: > > Hi, > > > > This patch fixes a real crash problem when we do 'perf report' > > on an arm64 platform with arm32 program. > > It is introduced by commit f9b2bdf228 ("perf tools: Find vdso > > with the consider of cross-platform"). From dmesg report, perf > > crashes in dso__type() because dso is NULL. > > Ok, I removed f9b2bdf228 because of this crash, Ingo reported it, now > that I see this new patch and checked that the crash was introduced by > f9b2bdf228 I'll just combine those two and test again using a 32-bit > hackbench on top of f9b2bdf228, to reproduce the crash, then on top of > both patches combined. Tested, reproduced, ammended, fixed, applied, thanks! - Arnaldo > - Arnaldo > > > Still don't know why on x86 it never crash, but it is obviously > > that we need to check the return vaule from __dso__find(): it can > > be NULL. > > > > So please consider pulling. > > > > Thank you. > > > > On 2016/6/22 14:57, He Kuang wrote: > > > We should check if 'dso' is a null pointer before passing it to the > > > function dso__type(), otherwise a segfault will be raised in > > > dso__data_get_fd(). In function machine__find_vdso(), the return value > > > checking of 'dso' is missed and this patch fixes this issue. > > > > > > Signed-off-by: He Kuang > > > --- > > > tools/perf/util/vdso.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c > > > index 8f81c41..7bdcad4 100644 > > > --- a/tools/perf/util/vdso.c > > > +++ b/tools/perf/util/vdso.c > > > @@ -296,7 +296,7 @@ static struct dso *machine__find_vdso(struct machine *machine, > > > if (!dso) { > > > dso = __dsos__find(&machine->dsos, DSO__NAME_VDSO, > > > true); > > > - if (dso_type != dso__type(dso, machine)) > > > + if (dso && dso_type != dso__type(dso, machine)) > > > dso = NULL; > > > } > > > break; > >