From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/2] libxfs: zero the struct xfs_mount when unmounting the filesystem
Date: Tue, 25 Feb 2020 07:08:15 -0800 [thread overview]
Message-ID: <20200225150815.GB6748@magnolia> (raw)
In-Reply-To: <4dfc826f-5f46-1dd7-3232-a35bd7b16573@sandeen.net>
On Mon, Feb 24, 2020 at 09:57:03PM -0800, Eric Sandeen wrote:
> On 2/24/20 4:11 PM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Since libxfs doesn't allocate the struct xfs_mount *, we can't just free
> > it during unmount. Zero its contents to prevent any use-after-free.
>
> seems fine but makes me wonder what prompted it. Did we have a use
> after free?
No, just Brian musing about the possibility of it, so I said I'd zero
it out to make a UAF more obvious.
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Thanks for the review.
--D
>
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > libxfs/init.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> >
> > diff --git a/libxfs/init.c b/libxfs/init.c
> > index d4804ead..197690df 100644
> > --- a/libxfs/init.c
> > +++ b/libxfs/init.c
> > @@ -904,6 +904,7 @@ libxfs_umount(
> > if (mp->m_logdev_targp != mp->m_ddev_targp)
> > kmem_free(mp->m_logdev_targp);
> > kmem_free(mp->m_ddev_targp);
> > + memset(mp, 0, sizeof(struct xfs_mount));
> >
> > return error;
> > }
> >
next prev parent reply other threads:[~2020-02-25 15:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 0:11 [PATCH 0/2] libxfs: minor cleanups of destructors Darrick J. Wong
2020-02-25 0:11 ` [PATCH 1/2] libxfs: zero the struct xfs_mount when unmounting the filesystem Darrick J. Wong
2020-02-25 5:57 ` Eric Sandeen
2020-02-25 15:08 ` Darrick J. Wong [this message]
2020-02-25 15:13 ` Brian Foster
2020-02-25 17:40 ` Christoph Hellwig
2020-02-25 18:28 ` Darrick J. Wong
2020-02-25 18:48 ` Eric Sandeen
2020-02-25 0:11 ` [PATCH 2/2] libxfs: clean up libxfs_destroy Darrick J. Wong
2020-02-25 6:00 ` Eric Sandeen
2020-02-25 15:13 ` Brian Foster
2020-02-25 17:41 ` Christoph Hellwig
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=20200225150815.GB6748@magnolia \
--to=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
--cc=sandeen@sandeen.net \
/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