public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* oopsable race in xen-gntdev (unsafe vma access)
@ 2012-12-15 18:12 Al Viro
  2012-12-21 20:18 ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 7+ messages in thread
From: Al Viro @ 2012-12-15 18:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Konrad Rzeszutek Wilk

	1) find_vma() is *not* safe without ->mmap_sem and its result may
very well be freed just as it's returned to caller.  IOW,
gntdev_ioctl_get_offset_for_vaddr() is racy and may end up with
dereferencing freed memory.

	2) gntdev_vma_close() is putting NULL into map->vma with only
->mmap_sem held by caller.  Things like
                if (!map->vma)
                        continue;
                if (map->vma->vm_start >= end)
                        continue;
                if (map->vma->vm_end <= start)
done with just priv->lock held are racy.

	I'm not familiar with the code, but it looks like we need to
protect gntdev_vma_close() guts with the same spinlock and probably
hold ->mmap_sem shared around the "find_vma()+get to map->{index,count}"
in the ioctl.  Or replace the logics in ioctl with search through the
list of grant_map under the same spinlock...

	Comments?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-01-11 17:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-15 18:12 oopsable race in xen-gntdev (unsafe vma access) Al Viro
2012-12-21 20:18 ` Konrad Rzeszutek Wilk
2013-01-02 22:57   ` oopsable race in xen-gntdev [PATCH 0/3] Daniel De Graaf
2013-01-02 22:57     ` [PATCH 1/3] xen/gntdev: fix unsafe vma access Daniel De Graaf
2013-01-02 22:57     ` [PATCH 2/3] xen/gntdev: correctly unmap unlinked maps in mmu notifier Daniel De Graaf
2013-01-02 22:57     ` [PATCH 3/3] xen/gntdev: remove erronous use of copy_to_user Daniel De Graaf
2013-01-11 17:40     ` oopsable race in xen-gntdev [PATCH 0/3] Konrad Rzeszutek Wilk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox