From: Al Viro <viro@ZenIV.linux.org.uk>
To: Inki Dae <inki.dae@samsung.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [RFC] deadlock in "drm/exynos: fix wrong pointer access at vm close"
Date: Thu, 26 Sep 2013 04:26:25 +0100 [thread overview]
Message-ID: <20130926032625.GH13318@ZenIV.linux.org.uk> (raw)
In-Reply-To: <012b01ceb8e0$44abfbf0$ce03f3d0$%dae@samsung.com>
On Tue, Sep 24, 2013 at 01:41:00PM +0900, Inki Dae wrote:
> I can't see to hold ->mmap_sem when it calls find_vma() anywhere else.
Er... What, in your opinion, would protect the result of find_vma(), if
not that? E.g. if another thread does munmap() on that area... vma isn't
refcounted; there are only two things that can prevent its freeing -
mmap_sem being held and the lack of anybody else seeing the address of
mm_struct it belongs to (basically, when we are killing mm_struct off
or when we are populating a fresh mm_struct; in the latter case the
parent is locked, but the child doesn't need to).
Look at page fault handlers - they grab mmap_sem (shared) before looking for
vma. And anything modifying the list of vmas (vm_mmap(), etc.) grabs it
exclusive...
> > to caller) and clones it manually, regardless of whether that vma allows
> > to clone itself or not. Quite a few drivers rely on that not happening...
> >
>
> I think that has no any problem because exynos_gem_get_vma() takes a
> reference to vma, and also v4l2 side is using same way. I and v4l2 guys
> might be missing something what you are concerning. So Could you give us
> more comments?
vb2_get_vma()/vb2_put_userptr() is also buggy. At the very least, it
should refuse to handle ones with VM_DONTCOPY in flags. Again, there
are drivers that seriously rely on VM_DONTCOPY being honoured.
BTW, what do you expect exynos_gem_get_pages_from_userptr() to do if
the area has been unmapped in the meanwhile? Or, for that matter,
if that has been followed by mmap() of something with VM_IO on the
same range of addresses... ->open() does *NOT* prevent any of that.
next prev parent reply other threads:[~2013-09-26 3:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-22 21:29 [RFC] deadlock in "drm/exynos: fix wrong pointer access at vm close" Al Viro
2013-09-23 7:49 ` Inki Dae
2013-09-23 13:07 ` Al Viro
2013-09-24 4:41 ` Inki Dae
2013-09-26 3:26 ` Al Viro [this message]
2013-09-28 17:17 ` Inki Dae
2013-09-25 4:34 ` Inki Dae
2013-09-26 3:28 ` Al Viro
2013-09-28 17:47 ` Inki Dae
2013-09-28 17:50 ` Inki Dae
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=20130926032625.GH13318@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.