dri-devel Archive on lore.kernel.org
 help / color / Atom feed
From: butt3rflyh4ck <butterflyhuangxx@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: robdclark@chromium.org, security@kernel.org, airlied@linux.ie,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	syzkaller-bugs@googlegroups.com, dri-devel@lists.freedesktop.org,
	chris@chris-wilson.co.uk, Sean Paul <seanpaul@chromium.org>,
	sam@ravnborg.org, emil.velikov@collabora.com
Subject: Re: KASAN: use-after-free Read in drm_gem_object_release
Date: Fri, 10 Jul 2020 22:03:12 +0800
Message-ID: <CAFcO6XO2wP5duoEiKWR1cgurKygp_--+Lw=df-_tHBy63QU1CA@mail.gmail.com> (raw)
In-Reply-To: <20200710115240.GI2571@kadam>


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

Thank you for pointing out my spelling error. ok, I upload a PoC and
compile it to a binary. you can test it.

regards,
  butt3rflyh4ck.

On Fri, Jul 10, 2020 at 7: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
>

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

[-- Attachment #3: uaf-drm_gem_object_release --]
[-- Type: application/octet-stream, Size: 871704 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

  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 [this message]
2020-07-13 16:12   ` Daniel Vetter
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='CAFcO6XO2wP5duoEiKWR1cgurKygp_--+Lw=df-_tHBy63QU1CA@mail.gmail.com' \
    --to=butterflyhuangxx@gmail.com \
    --cc=airlied@linux.ie \
    --cc=chris@chris-wilson.co.uk \
    --cc=dan.carpenter@oracle.com \
    --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 \
    /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