public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Du, Changbin" <changbin.du@intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	changbin.du@intel.com, Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] perf: fix double free at function perf_hpp__reset_output_field
Date: Wed, 5 Apr 2017 10:44:22 +0800	[thread overview]
Message-ID: <20170405024422.GA4361@intel.com> (raw)
In-Reply-To: <20170404155103.GF12903@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1829 bytes --]

On Tue, Apr 04, 2017 at 12:51:03PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Apr 05, 2017 at 12:34:59AM +0900, Namhyung Kim escreveu:
> > Hi Arnaldo,
> > 
> > On Wed, Apr 5, 2017 at 12:19 AM, Arnaldo Carvalho de Melo
> > <acme@kernel.org> wrote:
> > > Em Mon, Mar 27, 2017 at 02:22:55PM +0800, changbin.du@intel.com escreveu:
> > >> From: Changbin Du <changbin.du@intel.com>
> > >>
> > >> Some perf_hpp_fmt both registered at field and sort list. For such
> > >> instance, we only can free it when removed from the both lists. This
> > >> function currently only used by self-test code, but still should fix
> > >> it.
> > >
> > > Looks sane, applying,
> > >
> > > Jiri, Namhyung, please holler (or ack) if needed,
> > 
> > Did you actually see the double free problem?  AFAICS the old code
> 
> I assumed that he had seen it, in some self-test code, Changbin, can you
> please show command output or further describe when this patch would be
> necessary?
> 
Arnaldo, I did observe this issue but not in self-test code. The self-test code
uses that function but does not have a case that a fmt linked to two both list. 
I found this issue when I try to add 'dynamic sort' feature to perf, which
I use this function to reset out fields.

Anyway, it is clear that this is a real bug, a potential issue need to fix.

> - Arnaldo
> 
> > removed a fmt from both list before free it.  In the first loop, fmt that
> > was linked to both output list and sort list will be remove.  And the
> > second loop frees fmt that was linked only to the sort list (IOW, it
> > frees fmt that was not freed in the first loop).
> >
This is right. It is to handle the fmts that linked to both two lists.

> > Thanks,
> > Namhyung
> > 
> > 
> > >
> > > - Arnaldo
> > >

-- 
Thanks,
Changbin Du

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2017-04-05  2:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-15  2:16 [PATCH] perf: double free at function perf_hpp__reset_output_field changbin.du
2017-03-27  6:22 ` [PATCH v2] perf: fix " changbin.du
2017-04-04 15:19   ` Arnaldo Carvalho de Melo
2017-04-04 15:34     ` Namhyung Kim
2017-04-04 15:51       ` Arnaldo Carvalho de Melo
2017-04-05  2:44         ` Du, Changbin [this message]
2017-04-09 17:05           ` Jiri Olsa
2017-04-10  2:13             ` Du, Changbin
2017-04-10  8:39     ` Jiri Olsa
2017-04-10 10:21       ` Du, Changbin
2017-04-10 11:33         ` Jiri Olsa
2017-04-11  3:06           ` Du, Changbin
2017-04-11  7:35             ` Jiri Olsa
2017-04-11  8:25               ` Du, Changbin
2017-04-11 10:05                 ` Jiri Olsa
2017-04-11 10:13                   ` Du, Changbin
2017-04-11 10:32                     ` Jiri Olsa
2017-04-12  1:48                       ` Du, Changbin
2017-05-31  7:05                         ` Du, Changbin
2017-05-31  7:19                           ` Jiri Olsa

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=20170405024422.GA4361@intel.com \
    --to=changbin.du@intel.com \
    --cc=acme@kernel.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox