[lkml]   [2012]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectoopsable race in xen-gntdev (unsafe vma access)

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)
if (map->vma->vm_start >= end)
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...


 \ /
  Last update: 2012-12-15 19:41    [W:0.084 / U:4.756 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site