linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: PanBian <bianpan2016@163.com>
To: Carlos Maiolino <cmaiolino@redhat.com>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>,
	linux-xfs@vger.kernel.org, Brian Foster <bfoster@redhat.com>,
	Dave Chinner <dchinner@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: libxfs: move xfs_perag_put late
Date: Mon, 26 Nov 2018 18:36:19 +0800	[thread overview]
Message-ID: <20181126103619.GA95394@bp> (raw)
In-Reply-To: <20181126093139.cgojlmtubzuzdb23@hades.usersys.redhat.com>

On Mon, Nov 26, 2018 at 10:31:39AM +0100, Carlos Maiolino wrote:
> On Sat, Nov 24, 2018 at 05:44:20PM +0800, Pan Bian wrote:
> > The function xfs_alloc_get_freelist calls xfs_perag_put to drop the
> > reference. In this case, pag may be released. However,
> > pag->pagf_btreeblks is read and write after the put operation. This may
> > result in a use-after-free bug. This patch moves the put operation late.
> > 
> 
> The patch looks reasonable, can you detail more how did you find it? Via code
> inspection of you hit this user-after-free in some way?

I wrote a tool to check such bugs statically. It first scans the source code 
to extract paired alloc/free functions. Equipped with such functions, it
performs an intra-procedural data flow analysis to detect mismatched
alloc/free bugs and use-after-free bugs.

Best regards,
Pan Bian

  reply	other threads:[~2018-11-26 21:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-24  9:44 [PATCH] xfs: libxfs: move xfs_perag_put late Pan Bian
2018-11-26  9:31 ` Carlos Maiolino
2018-11-26 10:36   ` PanBian [this message]
2018-11-26 14:17     ` Brian Foster
2018-11-27  0:27       ` PanBian

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=20181126103619.GA95394@bp \
    --to=bianpan2016@163.com \
    --cc=bfoster@redhat.com \
    --cc=cmaiolino@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=dchinner@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).