dri-devel Archive on lore.kernel.org
 help / color / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Thomas Zimmermann <tzimmermann@suse.de>
Cc: Rob Clark <robdclark@chromium.org>,
	security@kernel.org, Dave Airlie <airlied@linux.ie>,
	butt3rflyh4ck <butterflyhuangxx@gmail.com>,
	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>,
	Sam Ravnborg <sam@ravnborg.org>,
	Emil Velikov <emil.velikov@collabora.com>
Subject: Re: KASAN: use-after-free Read in drm_gem_object_release
Date: Mon, 13 Jul 2020 18:12:11 +0200
Message-ID: <CAKMK7uE1idHW4msihsBSbo8aWf602gqT-Z_BCR-gSJCRfugu=w@mail.gmail.com> (raw)
In-Reply-To: <20200710115240.GI2571@kadam>

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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent 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 [this message]
2020-07-13 16:47     ` butt3rflyh4ck
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='CAKMK7uE1idHW4msihsBSbo8aWf602gqT-Z_BCR-gSJCRfugu=w@mail.gmail.com' \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=butterflyhuangxx@gmail.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.velikov@collabora.com \
    --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