Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2993074AbbEEOJh (ORCPT ); Tue, 5 May 2015 10:09:37 -0400 Received: from mail9.hitachi.co.jp ([133.145.228.44]:56063 "EHLO mail9.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2993059AbbEEOJa (ORCPT ); Tue, 5 May 2015 10:09:30 -0400 Message-ID: <5548CF11.9000400@hitachi.com> Date: Tue, 05 May 2015 23:09:21 +0900 From: Masami Hiramatsu Organization: Hitachi, Ltd., Japan User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Wang Nan , ast@plumgrid.com, davem@davemloft.net, acme@kernel.org, mingo@redhat.com, a.p.zijlstra@chello.nl, jolsa@kernel.org CC: lizefan@kernel.org, linux-kernel@vger.kernel.org, pi3orama@163.com, hekuang@huawei.com Subject: Re: [RFC PATCH 01/22] perf: probe: avoid segfault if passed with ''. References: <1430391165-30267-1-git-send-email-wangnan0@huawei.com> <1430391165-30267-2-git-send-email-wangnan0@huawei.com> In-Reply-To: <1430391165-30267-2-git-send-email-wangnan0@huawei.com> Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1776 Lines: 61 On 2015/04/30 19:52, Wang Nan wrote: > Since parse_perf_probe_point() deals with a user passed argument, we > should not assume it to be a valid string. > > Without this patch, if pass '' to perf probe, a segfault raises: > > $ perf probe -a '' > Segmentation fault > > This patch checks argument of parse_perf_probe_point() before > string processing. > > After this patch: > > $ perf probe -a '' > > usage: perf probe [] 'PROBEDEF' ['PROBEDEF' ...] > or: perf probe [] --add 'PROBEDEF' [--add 'PROBEDEF' ...] > ... This looks OK to me. Acked-by: Masami Hiramatsu Could you split this as an independent bugfix with my ack? Thank you, > > Signed-off-by: Wang Nan > --- > tools/perf/util/probe-event.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c > index d8bb616..d05b77c 100644 > --- a/tools/perf/util/probe-event.c > +++ b/tools/perf/util/probe-event.c > @@ -1084,6 +1084,8 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev) > * > * TODO:Group name support > */ > + if (!arg) > + return -EINVAL; > > ptr = strpbrk(arg, ";=@+%"); > if (ptr && *ptr == '=') { /* Event name */ > -- Masami HIRAMATSU Linux Technology Research Center, System Productivity Research Dept. Center for Technology Innovation - Systems Engineering Hitachi, Ltd., Research & Development Group E-mail: masami.hiramatsu.pt@hitachi.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/