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


Groups > linux.kernel > #1226058 > unrolled thread

[PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when removing uprobe events

Started byMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
First post2015-09-16 15:00 +0200
Last post2015-09-18 23:30 +0200
Articles 6 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when  removing uprobe events Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-09-16 15:00 +0200
    RE: [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when  removing uprobe events 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-18 03:40 +0200
      Re: [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when  removing uprobe events Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-18 16:30 +0200
        Re: [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when  removing uprobe events Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-18 16:30 +0200
          Re: [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when  removing uprobe events Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-18 16:40 +0200
    Re: [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when  removing uprobe events Paul Clarke <pc@us.ibm.com> - 2015-09-18 23:30 +0200

#1226058 — [PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when removing uprobe events

FromMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Date2015-09-16 15:00 +0200
Subject[PATCH perf/core ] [BUGFIX] perf probe: Fix a segfault when removing uprobe events
Message-ID<q9ktA-4U2-5@gated-at.bofh.it>
Fix a segfault bug and a small mistake in perf probe -d.

Since the "ulist" in perf_del_probe_events is never initialized,
strlist__add(ulist, *) always causes a segfault when removing
uprobe events by perf probe -d.

Also, the "str" local variable is never released if fail to
allocate the "klist". This fixes it too.

This has been introduced by the commit e607f1426b58 ("perf probe:
Print deleted events in cmd_probe()").

Reported-by: Milian Wolff <milian.wolff@kdab.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
---
 tools/perf/builtin-probe.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 94385ee..f7882ae 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -380,8 +380,11 @@ static int perf_del_probe_events(struct strfilter *filter)
 		goto out;
 
 	klist = strlist__new(NULL, NULL);
-	if (!klist)
-		return -ENOMEM;
+	ulist = strlist__new(NULL, NULL);
+	if (!klist || !ulist) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
 	ret = probe_file__get_events(kfd, filter, klist);
 	if (ret == 0) {


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


#1227520

From平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com>
Date2015-09-18 03:40 +0200
Message-ID<q9SOB-4Jc-1@gated-at.bofh.it>
In reply to#1226058
SGkgQXJuYWxkbywNCg0KQ291bGQgeW91IHB1bGwgdGhpcyBidWdmaXggYXMgYW4gdXJnZW50IHBh
dGNoLCBzaW5jZSB0aGlzIGZpeGVzIGEgY3JpdGljYWwNCnByb2JsZW0/DQoNClRoYW5rcywNCg0K
RnJvbTogTWFzYW1pIEhpcmFtYXRzdSBbbWFpbHRvOm1hc2FtaS5oaXJhbWF0c3UucHRAaGl0YWNo
aS5jb21dDQo+DQo+Rml4IGEgc2VnZmF1bHQgYnVnIGFuZCBhIHNtYWxsIG1pc3Rha2UgaW4gcGVy
ZiBwcm9iZSAtZC4NCj4NCj5TaW5jZSB0aGUgInVsaXN0IiBpbiB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KzM4MCwxMSBAQCBzdGF0aWMgaW50IHBlcmZfZGVsX3Byb2JlX2V2ZW50
cyhzdHJ1Y3Qgc3RyZmlsdGVyICpmaWx0ZXIpDQo+IAkJZ290byBvdXQ7DQo+DQo+IAlrbGlzdCA9
IHN0cmxpc3RfX25ldyhOVUxMLCBOVUxMKTsNCj4tCWlmICgha2xpc3QpDQo+LQkJcmV0dXJuIC1F
Tk9NRU07DQo+Kwl1bGlzdCA9IHN0cmxpc3RfX25ldyhOVUxMLCBOVUxMKTsNCj4rCWlmICgha2xp
c3QgfHwgIXVsaXN0KSB7DQo+KwkJcmV0ID0gLUVOT01FTTsNCj4rCQlnb3RvIG91dDsNCj4rCX0N
Cj4NCj4gCXJldCA9IHByb2JlX2ZpbGVfX2dldF9ldmVudHMoa2ZkLCBmaWx0ZXIsIGtsaXN0KTsN
Cj4gCWlmIChyZXQgPT0gMCkgew0KPg0KDQo=
--
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]


#1227909

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-18 16:30 +0200
Message-ID<qa4PL-5bi-5@gated-at.bofh.it>
In reply to#1227520
Em Fri, Sep 18, 2015 at 01:39:13AM +0000, 平松雅巳 / HIRAMATU,MASAMI escreveu:
> Hi Arnaldo,
> 
> Could you pull this bugfix as an urgent patch, since this fixes a critical
> problem?

Sure, thanks for the reminder.

- Arnaldo
 
> Thanks,
> 
> From: Masami Hiramatsu [mailto:masami.hiramatsu.pt@hitachi.com]
> >
> >Fix a segfault bug and a small mistake in perf probe -d.
> >
> >Since the "ulist" in perf_del_probe_events is never initialized,
> >strlist__add(ulist, *) always causes a segfault when removing
> >uprobe events by perf probe -d.
> >
> >Also, the "str" local variable is never released if fail to
> >allocate the "klist". This fixes it too.
> >
> >This has been introduced by the commit e607f1426b58 ("perf probe:
> >Print deleted events in cmd_probe()").
> >
> >Reported-by: Milian Wolff <milian.wolff@kdab.com>
> >Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> >---
> > tools/perf/builtin-probe.c |    7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> >diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
> >index 94385ee..f7882ae 100644
> >--- a/tools/perf/builtin-probe.c
> >+++ b/tools/perf/builtin-probe.c
> >@@ -380,8 +380,11 @@ static int perf_del_probe_events(struct strfilter *filter)
> > 		goto out;
> >
> > 	klist = strlist__new(NULL, NULL);
> >-	if (!klist)
> >-		return -ENOMEM;
> >+	ulist = strlist__new(NULL, NULL);
> >+	if (!klist || !ulist) {
> >+		ret = -ENOMEM;
> >+		goto out;
> >+	}
> >
> > 	ret = probe_file__get_events(kfd, filter, klist);
> > 	if (ret == 0) {
> >
> 
--
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]


#1227915

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-18 16:30 +0200
Message-ID<qa4PM-5bi-19@gated-at.bofh.it>
In reply to#1227909
Em Fri, Sep 18, 2015 at 11:26:22AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Sep 18, 2015 at 01:39:13AM +0000, 平松雅巳 / HIRAMATU,MASAMI escreveu:
> > Hi Arnaldo,
> > 
> > Could you pull this bugfix as an urgent patch, since this fixes a critical
> > problem?
> 
> Sure, thanks for the reminder.

But it is not applying, checking:


[acme@zoo linux]$ patch -p1 < /wb/1.patch 
patching file tools/perf/builtin-probe.c
Hunk #1 FAILED at 380.
1 out of 1 hunk FAILED -- saving rejects to file tools/perf/builtin-probe.c.rej
[acme@zoo linux]$ 


- Arnaldo

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


#1227922

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-18 16:40 +0200
Message-ID<qa4Zs-5mB-11@gated-at.bofh.it>
In reply to#1227915
Em Fri, Sep 18, 2015 at 11:28:30AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Sep 18, 2015 at 11:26:22AM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Fri, Sep 18, 2015 at 01:39:13AM +0000, 平松雅巳 / HIRAMATU,MASAMI escreveu:
> > > Could you pull this bugfix as an urgent patch, since this fixes a critical
> > > problem?

> > Sure, thanks for the reminder.
 
> But it is not applying, checking:
 
> [acme@zoo linux]$ patch -p1 < /wb/1.patch 
> patching file tools/perf/builtin-probe.c
> Hunk #1 FAILED at 380.
> 1 out of 1 hunk FAILED -- saving rejects to file tools/perf/builtin-probe.c.rej
> [acme@zoo linux]$ 

The way you reported made me somehow think this was for perf/urgent, but
the function it patches is not even there, ok, applying to perf/core.

Applied.

- Arnaldo
--
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]


#1228281

FromPaul Clarke <pc@us.ibm.com>
Date2015-09-18 23:30 +0200
Message-ID<qaboe-67e-9@gated-at.bofh.it>
In reply to#1226058
On 09/16/2015 07:52 AM, Masami Hiramatsu wrote:
> Fix a segfault bug and a small mistake in perf probe -d.
>
> Since the "ulist" in perf_del_probe_events is never initialized,
> strlist__add(ulist, *) always causes a segfault when removing
> uprobe events by perf probe -d.
>
> Also, the "str" local variable is never released if fail to
> allocate the "klist". This fixes it too.
>
> This has been introduced by the commit e607f1426b58 ("perf probe:
> Print deleted events in cmd_probe()").
>
> Reported-by: Milian Wolff <milian.wolff@kdab.com>
> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> ---
>   tools/perf/builtin-probe.c |    7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
> index 94385ee..f7882ae 100644
> --- a/tools/perf/builtin-probe.c
> +++ b/tools/perf/builtin-probe.c
> @@ -380,8 +380,11 @@ static int perf_del_probe_events(struct strfilter *filter)
>   		goto out;
>
>   	klist = strlist__new(NULL, NULL);
> -	if (!klist)
> -		return -ENOMEM;
> +	ulist = strlist__new(NULL, NULL);
> +	if (!klist || !ulist) {
> +		ret = -ENOMEM;
> +		goto out;
> +	}

Newbie here, but if one of "strlist__new()" calls succeeds, don't you 
need a corresponding strlist__delete() ?

PC

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