[PATCH 0/3] perf tool: Fix multiple memory leakages

Zhongqiu Han posted 3 patches 1 year, 2 months ago
There is a newer version of this series
tools/perf/util/bpf-event.c | 10 ++++++++--
tools/perf/util/env.c       | 12 ++++++++----
tools/perf/util/env.h       |  4 ++--
tools/perf/util/header.c    |  8 ++++++--
4 files changed, 24 insertions(+), 10 deletions(-)
[PATCH 0/3] perf tool: Fix multiple memory leakages
Posted by Zhongqiu Han 1 year, 2 months ago
Fix memory leakages when btf_node or bpf_prog_info_node is duplicated
during insertion into perf_env.

Signed-off-by: Zhongqiu Han <quic_zhonhan@quicinc.com>
---
Zhongqiu Han (3):
  perf header: Fix one memory leakage in process_bpf_btf()
  perf header: Fix one memory leakage in process_bpf_prog_info()
  perf bpf: Fix two memory leakages when calling
    perf_env__insert_bpf_prog_info()

 tools/perf/util/bpf-event.c | 10 ++++++++--
 tools/perf/util/env.c       | 12 ++++++++----
 tools/perf/util/env.h       |  4 ++--
 tools/perf/util/header.c    |  8 ++++++--
 4 files changed, 24 insertions(+), 10 deletions(-)


base-commit: f486c8aa16b8172f63bddc70116a0c897a7f3f02
-- 
2.25.1
Re: [PATCH 0/3] perf tool: Fix multiple memory leakages
Posted by Namhyung Kim 1 year, 2 months ago
On Thu, Nov 28, 2024 at 08:54:29PM +0800, Zhongqiu Han wrote:
> Fix memory leakages when btf_node or bpf_prog_info_node is duplicated
> during insertion into perf_env.
> 
> Signed-off-by: Zhongqiu Han <quic_zhonhan@quicinc.com>
> ---
> Zhongqiu Han (3):
>   perf header: Fix one memory leakage in process_bpf_btf()
>   perf header: Fix one memory leakage in process_bpf_prog_info()
>   perf bpf: Fix two memory leakages when calling
>     perf_env__insert_bpf_prog_info()

Although I have a nitpick in the patch 3, it looks good otherwise.

Reviewed-by: Namhyung Kim <namhyung@kernel.org>

And I don't think the Fixes tags are correct, but it won't apply before
the change it points to.  So for practical reason, I'm ok with that.

Thanks,
Namhyung

> 
>  tools/perf/util/bpf-event.c | 10 ++++++++--
>  tools/perf/util/env.c       | 12 ++++++++----
>  tools/perf/util/env.h       |  4 ++--
>  tools/perf/util/header.c    |  8 ++++++--
>  4 files changed, 24 insertions(+), 10 deletions(-)
> 
> 
> base-commit: f486c8aa16b8172f63bddc70116a0c897a7f3f02
> -- 
> 2.25.1
>
Re: [PATCH 0/3] perf tool: Fix multiple memory leakages
Posted by Zhongqiu Han 1 year, 2 months ago
On 12/3/2024 6:04 AM, Namhyung Kim wrote:
> On Thu, Nov 28, 2024 at 08:54:29PM +0800, Zhongqiu Han wrote:
>> Fix memory leakages when btf_node or bpf_prog_info_node is duplicated
>> during insertion into perf_env.
>>
>> Signed-off-by: Zhongqiu Han <quic_zhonhan@quicinc.com>
>> ---
>> Zhongqiu Han (3):
>>    perf header: Fix one memory leakage in process_bpf_btf()
>>    perf header: Fix one memory leakage in process_bpf_prog_info()
>>    perf bpf: Fix two memory leakages when calling
>>      perf_env__insert_bpf_prog_info()
> 
> Although I have a nitpick in the patch 3, it looks good otherwise.
> 
> Reviewed-by: Namhyung Kim <namhyung@kernel.org>
> 
Hi Namhyung,
Thanks for your review~
I will arise the V2 to optimize patch 3.

> And I don't think the Fixes tags are correct, but it won't apply before
> the change it points to.  So for practical reason, I'm ok with that.
> 
> Thanks,
> Namhyung
> 

I will fix the Fixes tag as follows on V2:

[PATCH 1/3] perf header: Fix one memory leakage in process_bpf_btf()
Fixes: a70a1123174a ("perf bpf: Save BTF information as headers to
perf.data")

[PATCH 2/3] perf header: Fix one memory leakage in
process_bpf_prog_info()
Fixes: 606f972b1361 ("perf bpf: Save bpf_prog_info information as
headers to perf.data")


[PATCH 3/3] perf bpf: Fix two memory leakages when calling
perf_env__insert_bpf_prog_info()
Fixes: e4378f0cb90b ("perf bpf: Save bpf_prog_info in a rbtree in
perf_env")
Fixes: d56354dc4909 ("perf tools: Save bpf_prog_info and BTF of new BPF
programs")


>>
>>   tools/perf/util/bpf-event.c | 10 ++++++++--
>>   tools/perf/util/env.c       | 12 ++++++++----
>>   tools/perf/util/env.h       |  4 ++--
>>   tools/perf/util/header.c    |  8 ++++++--
>>   4 files changed, 24 insertions(+), 10 deletions(-)
>>
>>
>> base-commit: f486c8aa16b8172f63bddc70116a0c897a7f3f02
>> -- 
>> 2.25.1
>>


-- 
Thx and BRs,
Zhongqiu Han