Re: [PATCH 2/2] xen/gntdev: Fix partial gntdev_mmap() cleanup

From: Ross Lagerwall
Date: Wed Jan 10 2018 - 04:11:59 EST


On 01/10/2018 01:22 AM, Boris Ostrovsky wrote:


On 01/09/2018 07:10 AM, Ross Lagerwall wrote:
When cleaning up after a partially successful gntdev_mmap(), unmap the
successfully mapped grant pages otherwise Xen will kill the domain if
in debug mode (Attempt to implicitly unmap a granted PTE) or Linux will
kill the process and emit "BUG: Bad page map in process" if Xen is in
release mode.

This is only needed when use_ptemod is true because gntdev_put_map()
will unmap grant pages itself when use_ptemod is false.

Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>

although I wonder whether it may be possible to have gntdev_put_map() figure whether to unmap the pages if use_ptemod is set.

It was a while since I wrote this patch, but IIRC when use_ptemod is set, successfully mmapped pages are unmapped via the mmu_notifier release callback. So doing it in gntdev_put_map() isn't possible without further changes.

--
Ross Lagerwall