From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Riccardo Mancini <rickyman7@gmail.com>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
linux-perf-users <linux-perf-users@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH] perf env: fix memory leak: free bpf_prog_info_linear
Date: Fri, 4 Jun 2021 10:09:01 -0300 [thread overview]
Message-ID: <YLol7QC7xFSEsw8x@kernel.org> (raw)
In-Reply-To: <CAP-5=fW5btkb9izxcUy+XgAQPCTRZAUMa4uQMUR_+N_d=17Mfg@mail.gmail.com>
Em Thu, Jun 03, 2021 at 09:15:32PM -0700, Ian Rogers escreveu:
> On Wed, Jun 2, 2021 at 3:41 PM Riccardo Mancini <rickyman7@gmail.com> wrote:
> >
> > ASan reported a memory leak caused by info_linear not being
> > deallocated. The info_linear was allocated during
> > perf_event__synthesize_one_bpf_prog.
> > This patch adds the corresponding free() when bpf_prog_info_node
> > is freed in perf_env__purge_bpf.
> >
> > $ sudo ./perf record -- sleep 5
> > [ perf record: Woken up 1 times to write data ]
> > [ perf record: Captured and wrote 0.025 MB perf.data (8 samples) ]
> >
> > =================================================================
> > ==297735==ERROR: LeakSanitizer: detected memory leaks
> >
> > Direct leak of 7688 byte(s) in 19 object(s) allocated from:
> > #0 0x4f420f in malloc (/home/user/linux/tools/perf/perf+0x4f420f)
> > #1 0xc06a74 in bpf_program__get_prog_info_linear /home/user/linux/tools/lib/bpf/libbpf.c:11113:16
> > #2 0xb426fe in perf_event__synthesize_one_bpf_prog /home/user/linux/tools/perf/util/bpf-event.c:191:16
> > #3 0xb42008 in perf_event__synthesize_bpf_events /home/user/linux/tools/perf/util/bpf-event.c:410:9
> > #4 0x594596 in record__synthesize /home/user/linux/tools/perf/builtin-record.c:1490:8
> > #5 0x58c9ac in __cmd_record /home/user/linux/tools/perf/builtin-record.c:1798:8
> > #6 0x58990b in cmd_record /home/user/linux/tools/perf/builtin-record.c:2901:8
> > #7 0x7b2a20 in run_builtin /home/user/linux/tools/perf/perf.c:313:11
> > #8 0x7b12ff in handle_internal_command /home/user/linux/tools/perf/perf.c:365:8
> > #9 0x7b2583 in run_argv /home/user/linux/tools/perf/perf.c:409:2
> > #10 0x7b0d79 in main /home/user/linux/tools/perf/perf.c:539:3
> > #11 0x7fa357ef6b74 in __libc_start_main /usr/src/debug/glibc-2.33-8.fc34.x86_64/csu/../csu/libc-start.c:332:16
> >
> > Signed-off-by: Riccardo Mancini <rickyman7@gmail.com>
>
> Acked-by: Ian Rogers <irogers@google.com>
Thanks, applied.
- Arnaldo
prev parent reply other threads:[~2021-06-04 13:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 22:40 [PATCH] perf env: fix memory leak: free bpf_prog_info_linear Riccardo Mancini
2021-06-04 4:15 ` Ian Rogers
2021-06-04 13:09 ` Arnaldo Carvalho de Melo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YLol7QC7xFSEsw8x@kernel.org \
--to=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=irogers@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@redhat.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rickyman7@gmail.com \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.