dri-devel Archive on lore.kernel.org
 help / color / Atom feed
From: butt3rflyh4ck <butterflyhuangxx@gmail.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Rob Clark <robdclark@chromium.org>,
	security@kernel.org, Dave Airlie <airlied@linux.ie>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"Wilson, Chris" <chris@chris-wilson.co.uk>,
	Sean Paul <seanpaul@chromium.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Sam Ravnborg <sam@ravnborg.org>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Emil Velikov <emil.velikov@collabora.com>
Subject: Re: KASAN: use-after-free Read in drm_gem_object_release
Date: Tue, 14 Jul 2020 00:47:15 +0800
Message-ID: <CAFcO6XMeSL-DfxZPxFiYDD27tvN1Eq79v=-RNV-zaJwhrgzZ3Q@mail.gmail.com> (raw)
In-Reply-To: <CAKMK7uE1idHW4msihsBSbo8aWf602gqT-Z_BCR-gSJCRfugu=w@mail.gmail.com>


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

 Ok, firstly, thank Dan Carpenter for pointing out my spelling error
and I upload a PoC and compile it to a binary, hope that helpful for
you to test it.

regards,
butt3rflyh4ck

On Tue, Jul 14, 2020 at 12:12 AM Daniel Vetter <daniel@ffwll.ch> wrote:
>
> Adding Thomas, who's the main author for vram helpers.
> -Daniel
>
> On Fri, Jul 10, 2020 at 1:53 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> >
> > On Fri, Jul 10, 2020 at 04:24:03PM +0800, butt3rflyh4ck wrote:
> > > I report a bug (in linux-5.8.0-rc4) found by syzkaller.
> > >
> > > kernel config: https://github.com/butterflyhack/syzkaller-fuzz/blob/master/v5.8.0-rc4.config
> > >
> > > I test the reproducer and crash too.
> > >
> > > In the drm_em_vram_t() function,  ttm_bo_init() function call
> >          ^^^^^^^^^^^^^
> > This a typo.  The function name is drm_gem_vram_init().
> >
> > > ttm_bo_init_reserved(),
> > > the ttm_bo_init_reserved() function  call ttm_bo_put(), it will free
> > > gbo->bo that is struct ttm_buffer_object.
> > >
> > > then, goto the err_drm_gem_object_release lable,
> > > drm_gem_object_release() function will free gbo->bo.base, so cause use
> > > after free.
> > >
> >
> > There is a third free in drm_gem_vram_create().  This is a triple free
> > bug.  The correct place to free this is in drm_gem_vram_create() because
> > that's where it was allocated.
> >
> > This code is quite subtle so I'm not going to attempt to fix it because
> > I can't test it.
> >
> > regards,
> > dan carpenter
> >
>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

[-- Attachment #2: uaf-drm_gem_object_release --]
[-- Type: application/octet-stream, Size: 871704 bytes --]

[-- Attachment #3: uaf-drm_gem_object_release.c --]
[-- Type: application/octet-stream, Size: 4647 bytes --]

[-- Attachment #4: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply index

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10  8:24 butt3rflyh4ck
2020-07-10 10:39 ` Greg KH
2020-07-10 11:52 ` Dan Carpenter
2020-07-10 14:01   ` butt3rflyh4ck
2020-07-10 14:03   ` butt3rflyh4ck
2020-07-13 16:12   ` Daniel Vetter
2020-07-13 16:47     ` butt3rflyh4ck [this message]
2020-07-14  7:41 ` Thomas Zimmermann
2020-07-14  8:46   ` Thomas Zimmermann
     [not found] <00000000000053fea105791276d8@google.com>
2018-10-29 11:51 ` Dmitry Vyukov

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='CAFcO6XMeSL-DfxZPxFiYDD27tvN1Eq79v=-RNV-zaJwhrgzZ3Q@mail.gmail.com' \
    --to=butterflyhuangxx@gmail.com \
    --cc=airlied@linux.ie \
    --cc=chris@chris-wilson.co.uk \
    --cc=dan.carpenter@oracle.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.velikov@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=robdclark@chromium.org \
    --cc=sam@ravnborg.org \
    --cc=seanpaul@chromium.org \
    --cc=security@kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=tzimmermann@suse.de \
    /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

dri-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dri-devel/0 dri-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dri-devel dri-devel/ https://lore.kernel.org/dri-devel \
		dri-devel@lists.freedesktop.org
	public-inbox-index dri-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.dri-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git