All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Christian Brauner <brauner@kernel.org>,
	James Clark <james.clark@arm.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Tim Chen <tim.c.chen@linux.intel.com>,
	Athira Rajeev <atrajeev@linux.vnet.ibm.com>,
	Yicong Yang <yangyicong@hisilicon.com>,
	Kajol Jain <kjain@linux.ibm.com>,
	Disha Goel <disgoel@linux.ibm.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	Song Liu <songliubraving@fb.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [PATCH v1 1/4] perf record: Delete session after stopping sideband thread
Date: Wed, 20 Mar 2024 11:49:55 -0300	[thread overview]
Message-ID: <Zfr3kxwkpVbuwR8O@x1> (raw)
In-Reply-To: <CAP-5=fW_B-HOU0moGXjesjNaz2FR8emSB1LsadXOh5O71CrWWQ@mail.gmail.com>

On Tue, Mar 19, 2024 at 09:42:26PM -0700, Ian Rogers wrote:
> On Thu, Feb 29, 2024 at 11:50 PM Ian Rogers <irogers@google.com> wrote:
> >
> > On Thu, Feb 29, 2024 at 11:47 PM Ian Rogers <irogers@google.com> wrote:
> > >
> > > The session has a header in it which contains a perf env with
> > > bpf_progs. The bpf_progs are accessed by the sideband thread and so
> > > the sideband thread must be stopped before the session is deleted, to
> > > avoid a use after free.  This error was detected by AddressSanitizer
> > > in the following:
> > >
> > > ```
> > > ==2054673==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d000161e00 at pc 0x55769289de54 bp 0x7f9df36d4ab0 sp 0x7f9df36d4aa8
> > > READ of size 8 at 0x61d000161e00 thread T1
> > >     #0 0x55769289de53 in __perf_env__insert_bpf_prog_info util/env.c:42
> > >     #1 0x55769289dbb1 in perf_env__insert_bpf_prog_info util/env.c:29
> > >     #2 0x557692bbae29 in perf_env__add_bpf_info util/bpf-event.c:483
> > >     #3 0x557692bbb01a in bpf_event__sb_cb util/bpf-event.c:512
> > >     #4 0x5576928b75f4 in perf_evlist__poll_thread util/sideband_evlist.c:68
> > >     #5 0x7f9df96a63eb in start_thread nptl/pthread_create.c:444
> > >     #6 0x7f9df9726a4b in clone3 ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
> > >
> > > 0x61d000161e00 is located 384 bytes inside of 2136-byte region [0x61d000161c80,0x61d0001624d8)
> > > freed by thread T0 here:
> > >     #0 0x7f9dfa6d7288 in __interceptor_free libsanitizer/asan/asan_malloc_linux.cpp:52
> > >     #1 0x557692978d50 in perf_session__delete util/session.c:319
> > >     #2 0x557692673959 in __cmd_record tools/perf/builtin-record.c:2884
> > >     #3 0x55769267a9f0 in cmd_record tools/perf/builtin-record.c:4259
> > >     #4 0x55769286710c in run_builtin tools/perf/perf.c:349
> > >     #5 0x557692867678 in handle_internal_command tools/perf/perf.c:402
> > >     #6 0x557692867a40 in run_argv tools/perf/perf.c:446
> > >     #7 0x557692867fae in main tools/perf/perf.c:562
> > >     #8 0x7f9df96456c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
> > > ```
> > >
> > > Fixes: 657ee5531903 ("perf evlist: Introduce side band thread")
> > > Signed-off-by: Ian Rogers <irogers@google.com>
> >
> > Note, after this series I'm seeing parallel perf testing being as
> > reliable as serial but parallel testing is nearly 3 times faster. I
> > think after these changes land we can make parallel execution the
> > default.
> 
> Ping.

Thanks, applied to perf-tools-next,

- Arnaldo

      reply	other threads:[~2024-03-20 14:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01  7:46 [PATCH v1 1/4] perf record: Delete session after stopping sideband thread Ian Rogers
2024-03-01  7:46 ` [PATCH v1 2/4] perf test: stat output per thread of just the parent process Ian Rogers
2024-03-01  7:46 ` [PATCH v1 3/4] perf test: Use a single fd for the child process out/err Ian Rogers
2024-03-01  7:46 ` [PATCH v1 4/4] perf test: Read child test 10 times a second rather than 1 Ian Rogers
2024-03-01  7:50 ` [PATCH v1 1/4] perf record: Delete session after stopping sideband thread Ian Rogers
2024-03-20  4:42   ` Ian Rogers
2024-03-20 14:49     ` 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=Zfr3kxwkpVbuwR8O@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=atrajeev@linux.vnet.ibm.com \
    --cc=bpf@vger.kernel.org \
    --cc=brauner@kernel.org \
    --cc=disgoel@linux.ibm.com \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=kjain@linux.ibm.com \
    --cc=kprateek.nayak@amd.com \
    --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=peterz@infradead.org \
    --cc=songliubraving@fb.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=yangyicong@hisilicon.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.