]> xenbits.xensource.com Git - xen.git/commit
gnttab: fix unmap pin accounting race
authorJan Beulich <jbeulich@suse.com>
Tue, 20 Jun 2017 14:14:34 +0000 (16:14 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 20 Jun 2017 14:14:34 +0000 (16:14 +0200)
commit0d6d54542fc3475546f2340bc6178b6915c4fe6c
tree17ec1c8b7ca35459f32d34b7a49ed6e55e3ab2ab
parent15f428ae7a4b7c21e6b9d466c21fdb57ea823b62
gnttab: fix unmap pin accounting race

Once all {writable} mappings of a grant entry have been unmapped, the
hypervisor informs the guest that the grant entry has been released by
clearing the _GTF_{reading,writing} usage flags in the guest's grant
table as appropriate.

Unfortunately, at the moment, the code that updates the accounting
happens in a different critical section than the one which updates the
usage flags; this means that under the right circumstances, there may be
a window in time after the hypervisor reported the grant as being free
during which the grant referee still had access to the page.

Move the grant accounting code into the same critical section as the
reporting code to make sure this kind of race can't happen.

This is part of XSA-218.

Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
master commit: 9a0bd460cfc28564d39fa23541bb872b13e7f7ea
master date: 2017-06-20 14:32:03 +0200
xen/common/grant_table.c