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


Groups > linux.kernel > #1271871 > unrolled thread

[PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame

Started byMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
First post2015-11-18 07:50 +0100
Last post2015-11-23 17:20 +0100
Articles 6 — 6 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-11-18 07:50 +0100
    Re: [PATCH perf/core 01/13] perf probe: Fix to free temporal  Dwarf_Frame Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-18 23:40 +0100
      Re: [PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame Namhyung Kim <namhyung@gmail.com> - 2015-11-19 00:40 +0100
        RE: [PATCH perf/core 01/13] perf probe: Fix to free temporal  Dwarf_Frame 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-11-19 04:20 +0100
          Re: [PATCH perf/core 01/13] perf probe: Fix to free temporal  Dwarf_Frame Namhyung Kim <namhyung@kernel.org> - 2015-11-20 02:50 +0100
    [tip:perf/core] perf probe: Fix to free temporal Dwarf_Frame tip-bot for Masami Hiramatsu <tipbot@zytor.com> - 2015-11-23 17:20 +0100

#1271871 — [PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame

FromMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Date2015-11-18 07:50 +0100
Subject[PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame
Message-ID<qw4J4-7HS-15@gated-at.bofh.it>
Since dwarf_cfi_addrframe returns malloc'd Dwarf_Frame
object, it has to be freed after used.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
---
 tools/perf/util/probe-finder.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 63993d7..4d7d4f4 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -683,21 +683,24 @@ static int call_probe_finder(Dwarf_Die *sc_die, struct probe_finder *pf)
 	ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
 	if (ret <= 0 || nops == 0) {
 		pf->fb_ops = NULL;
+		ret = 0;
 #if _ELFUTILS_PREREQ(0, 142)
 	} else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa &&
 		   pf->cfi != NULL) {
-		Dwarf_Frame *frame;
+		Dwarf_Frame *frame = NULL;
 		if (dwarf_cfi_addrframe(pf->cfi, pf->addr, &frame) != 0 ||
 		    dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) {
 			pr_warning("Failed to get call frame on 0x%jx\n",
 				   (uintmax_t)pf->addr);
-			return -ENOENT;
+			ret = -ENOENT;
 		}
+		free(frame);
 #endif
 	}
 
 	/* Call finder's callback handler */
-	ret = pf->callback(sc_die, pf);
+	if (ret >= 0)
+		ret = pf->callback(sc_die, pf);
 
 	/* *pf->fb_ops will be cached in libdw. Don't free it. */
 	pf->fb_ops = NULL;

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


#1272637 — Re: [PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-11-18 23:40 +0100
SubjectRe: [PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame
Message-ID<qwjyq-RO-13@gated-at.bofh.it>
In reply to#1271871
Em Wed, Nov 18, 2015 at 03:40:12PM +0900, Masami Hiramatsu escreveu:
> Since dwarf_cfi_addrframe returns malloc'd Dwarf_Frame
> object, it has to be freed after used.

Applied to perf/urgent
 
> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> ---
>  tools/perf/util/probe-finder.c |    9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index 63993d7..4d7d4f4 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -683,21 +683,24 @@ static int call_probe_finder(Dwarf_Die *sc_die, struct probe_finder *pf)
>  	ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
>  	if (ret <= 0 || nops == 0) {
>  		pf->fb_ops = NULL;
> +		ret = 0;
>  #if _ELFUTILS_PREREQ(0, 142)
>  	} else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa &&
>  		   pf->cfi != NULL) {
> -		Dwarf_Frame *frame;
> +		Dwarf_Frame *frame = NULL;
>  		if (dwarf_cfi_addrframe(pf->cfi, pf->addr, &frame) != 0 ||
>  		    dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) {
>  			pr_warning("Failed to get call frame on 0x%jx\n",
>  				   (uintmax_t)pf->addr);
> -			return -ENOENT;
> +			ret = -ENOENT;
>  		}
> +		free(frame);
>  #endif
>  	}
>  
>  	/* Call finder's callback handler */
> -	ret = pf->callback(sc_die, pf);
> +	if (ret >= 0)
> +		ret = pf->callback(sc_die, pf);
>  
>  	/* *pf->fb_ops will be cached in libdw. Don't free it. */
>  	pf->fb_ops = NULL;
--
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]


#1272686

FromNamhyung Kim <namhyung@gmail.com>
Date2015-11-19 00:40 +0100
Message-ID<qwkut-1tE-11@gated-at.bofh.it>
In reply to#1272637
On November 19, 2015 7:36:39 AM GMT+09:00, Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>Em Wed, Nov 18, 2015 at 03:40:12PM +0900, Masami Hiramatsu escreveu:
>> Since dwarf_cfi_addrframe returns malloc'd Dwarf_Frame
>> object, it has to be freed after used.
>
>Applied to perf/urgent
> 
>> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
>> ---
>>  tools/perf/util/probe-finder.c |    9 ++++++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>> 
>> diff --git a/tools/perf/util/probe-finder.c
>b/tools/perf/util/probe-finder.c
>> index 63993d7..4d7d4f4 100644
>> --- a/tools/perf/util/probe-finder.c
>> +++ b/tools/perf/util/probe-finder.c
>> @@ -683,21 +683,24 @@ static int call_probe_finder(Dwarf_Die *sc_die,
>struct probe_finder *pf)
>>  	ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops,
>&nops, 1);
>>  	if (ret <= 0 || nops == 0) {
>>  		pf->fb_ops = NULL;
>> +		ret = 0;
>>  #if _ELFUTILS_PREREQ(0, 142)
>>  	} else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa
>&&
>>  		   pf->cfi != NULL) {
>> -		Dwarf_Frame *frame;
>> +		Dwarf_Frame *frame = NULL;
>>  		if (dwarf_cfi_addrframe(pf->cfi, pf->addr, &frame) != 0 ||
>>  		    dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) {

What if dwarf_cfi_addrframe() succeeded but
dwarf_frame_cfa() failed?  It seems that the frame
still can be leaked..

Thanks
Namhyung


>>  			pr_warning("Failed to get call frame on 0x%jx\n",
>>  				   (uintmax_t)pf->addr);
>> -			return -ENOENT;
>> +			ret = -ENOENT;
>>  		}
>> +		free(frame);
>>  #endif
>>  	}
>>  
>>  	/* Call finder's callback handler */
>> -	ret = pf->callback(sc_die, pf);
>> +	if (ret >= 0)
>> +		ret = pf->callback(sc_die, pf);
>>  
>>  	/* *pf->fb_ops will be cached in libdw. Don't free it. */
>>  	pf->fb_ops = NULL;

Hi Arnaldo and Masami,
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
--
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]


#1272778 — RE: [PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame

From平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com>
Date2015-11-19 04:20 +0100
SubjectRE: [PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame
Message-ID<qwnVo-3Op-9@gated-at.bofh.it>
In reply to#1272686
RnJvbTogTmFtaHl1bmcgS2ltIFttYWlsdG86bmFtaHl1bmdAZ21haWwuY29tXQ0KPk9uIE5vdmVt
YmVyIDE5LCAyMDE1IDc6MzY6MzkgQU0gR01UKzA5OjAwLCBBcm5hbGRvIENhcnZhbGhvIGRlIE1l
bG8gPGFjbWVAa2VybmVsLm9yZz4gd3JvdGU6DQo+PkVtIFdlZCwgTm92IDE4LCAyMDE1IGF0IDAz
OjQwOjEyUE0gKzA5MDAsIE1hc2FtaSBIaXJhbWF0c3UgZXNjcmV2ZXU6DQo+Pj4gU2luY2UgZHdh
cmZfY2ZpX2FkZHJmcmFtZSByZXR1cm5zIG1hbGxvYydkIER3YXJmX0ZyYW1lDQo+Pj4gb2JqZWN0
LCBpdCBoYXMgdG8gYmUgZnJlZWQgYWZ0ZXIgdXNlZC4NCj4+DQo+PkFwcGxpZWQgdG8gcGVyZi91
cmdlbnQNCj4+DQo+Pj4gU2lnbmVkLW9mZi1ieTogTWFzYW1pIEhpcmFtYXRzdSA8bWFzYW1pLmhp
cmFtYXRzdS5wdEBoaXRhY2hpLmNvbT4NCj4+PiAtLS0NCj4+PiAgdG9vbHMvcGVyZ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gKHJl
dCA+PSAwKQ0KPj4+ICsJCXJldCA9IHBmLT5jYWxsYmFjayhzY19kaWUsIHBmKTsNCj4+Pg0KPj4+
ICAJLyogKnBmLT5mYl9vcHMgd2lsbCBiZSBjYWNoZWQgaW4gbGliZHcuIERvbid0IGZyZWUgaXQu
ICovDQo+Pj4gIAlwZi0+ZmJfb3BzID0gTlVMTDsNCj4NCj5IaSBBcm5hbGRvIGFuZCBNYXNhbWks
DQo+LS0NCj5TZW50IGZyb20gbXkgQW5kcm9pZCBkZXZpY2Ugd2l0aCBLLTkgTWFpbC4gUGxlYXNl
IGV4Y3VzZSBteSBicmV2aXR5Lg0K
--
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]


#1273667 — Re: [PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame

FromNamhyung Kim <namhyung@kernel.org>
Date2015-11-20 02:50 +0100
SubjectRe: [PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame
Message-ID<qwIZQ-vP-9@gated-at.bofh.it>
In reply to#1272778
Hi Masami,

On Thu, Nov 19, 2015 at 03:12:37AM +0000, 平松雅巳 / HIRAMATU,MASAMI wrote:
> From: Namhyung Kim [mailto:namhyung@gmail.com]
> >On November 19, 2015 7:36:39 AM GMT+09:00, Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> >>Em Wed, Nov 18, 2015 at 03:40:12PM +0900, Masami Hiramatsu escreveu:
> >>> Since dwarf_cfi_addrframe returns malloc'd Dwarf_Frame
> >>> object, it has to be freed after used.
> >>
> >>Applied to perf/urgent
> >>
> >>> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> >>> ---
> >>>  tools/perf/util/probe-finder.c |    9 ++++++---
> >>>  1 file changed, 6 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/tools/perf/util/probe-finder.c
> >>b/tools/perf/util/probe-finder.c
> >>> index 63993d7..4d7d4f4 100644
> >>> --- a/tools/perf/util/probe-finder.c
> >>> +++ b/tools/perf/util/probe-finder.c
> >>> @@ -683,21 +683,24 @@ static int call_probe_finder(Dwarf_Die *sc_die,
> >>struct probe_finder *pf)
> >>>  	ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops,
> >>&nops, 1);
> >>>  	if (ret <= 0 || nops == 0) {
> >>>  		pf->fb_ops = NULL;
> >>> +		ret = 0;
> >>>  #if _ELFUTILS_PREREQ(0, 142)
> >>>  	} else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa
> >>&&
> >>>  		   pf->cfi != NULL) {
> >>> -		Dwarf_Frame *frame;
> >>> +		Dwarf_Frame *frame = NULL;
> >>>  		if (dwarf_cfi_addrframe(pf->cfi, pf->addr, &frame) != 0 ||
> >>>  		    dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) {
> >
> >What if dwarf_cfi_addrframe() succeeded but
> >dwarf_frame_cfa() failed?  It seems that the frame
> >still can be leaked..
> 
> No, it is also caught by free(). Please see below,
> >
> >>>  			pr_warning("Failed to get call frame on 0x%jx\n",
> >>>  				   (uintmax_t)pf->addr);
> >>> -			return -ENOENT;
> >>> +			ret = -ENOENT;
> 
> I've replaced "return -ENOENT" with "ret = -ENOENT", so this fall down

Ah, missed that.  Thank you.
Namhyung


> 
> >>>  		}
> >>> +		free(frame);
> 
> and free the frame :) (and if frame == NULL, it is just ignored)
> 
> Thank you!
> 
> 
> >>>  #endif
> >>>  	}
> >>>
> >>>  	/* Call finder's callback handler */
> >>> -	ret = pf->callback(sc_die, pf);
> >>> +	if (ret >= 0)
> >>> +		ret = pf->callback(sc_die, pf);
> >>>
> >>>  	/* *pf->fb_ops will be cached in libdw. Don't free it. */
> >>>  	pf->fb_ops = NULL;
> >
> >Hi Arnaldo and Masami,
> >--
> >Sent from my Android device with K-9 Mail. Please excuse my brevity.
--
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]


#1275545 — [tip:perf/core] perf probe: Fix to free temporal Dwarf_Frame

Fromtip-bot for Masami Hiramatsu <tipbot@zytor.com>
Date2015-11-23 17:20 +0100
Subject[tip:perf/core] perf probe: Fix to free temporal Dwarf_Frame
Message-ID<qy20q-4cV-41@gated-at.bofh.it>
In reply to#1271871
Commit-ID:  05c8d802fa52ef17dbcce21c38b72b4a313eb036
Gitweb:     http://git.kernel.org/tip/05c8d802fa52ef17dbcce21c38b72b4a313eb036
Author:     Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Wed, 18 Nov 2015 15:40:12 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 19 Nov 2015 13:19:17 -0300

perf probe: Fix to free temporal Dwarf_Frame

Since dwarf_cfi_addrframe returns malloc'd Dwarf_Frame object, it has to
be freed after it is used.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20151118064011.30709.65674.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-finder.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 05012bb..1cab05a 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -683,21 +683,24 @@ static int call_probe_finder(Dwarf_Die *sc_die, struct probe_finder *pf)
 	ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
 	if (ret <= 0 || nops == 0) {
 		pf->fb_ops = NULL;
+		ret = 0;
 #if _ELFUTILS_PREREQ(0, 142)
 	} else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa &&
 		   pf->cfi != NULL) {
-		Dwarf_Frame *frame;
+		Dwarf_Frame *frame = NULL;
 		if (dwarf_cfi_addrframe(pf->cfi, pf->addr, &frame) != 0 ||
 		    dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) {
 			pr_warning("Failed to get call frame on 0x%jx\n",
 				   (uintmax_t)pf->addr);
-			return -ENOENT;
+			ret = -ENOENT;
 		}
+		free(frame);
 #endif
 	}
 
 	/* Call finder's callback handler */
-	ret = pf->callback(sc_die, pf);
+	if (ret >= 0)
+		ret = pf->callback(sc_die, pf);
 
 	/* *pf->fb_ops will be cached in libdw. Don't free it. */
 	pf->fb_ops = NULL;
--
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