]> xenbits.xensource.com Git - xen.git/commit
gnttab: split maptrack lock to make it fulfill its purpose again
authorJan Beulich <jbeulich@suse.com>
Tue, 15 Aug 2017 13:26:08 +0000 (15:26 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 15 Aug 2017 13:26:08 +0000 (15:26 +0200)
commitc362cde2c62b0164dba3f55815da875c0da918cc
tree3f6c99264ef89d8f711a7c5e33d978a59977aab6
parentfece08abf931cccac4434e4efdae0d30873d020b
gnttab: split maptrack lock to make it fulfill its purpose again

The way the lock is currently being used in get_maptrack_handle(), it
protects only the maptrack limit: The function acts on current's list
only, so races on list accesses are impossible even without the lock.

Otoh list access races are possible between __get_maptrack_handle() and
put_maptrack_handle(), due to the invocation of the former for other
than current from steal_maptrack_handle(). Introduce a per-vCPU lock
for list accesses to become race free again. This lock will be
uncontended except when it becomes necessary to take the steal path,
i.e. in the common case there should be no meaningful performance
impact.

When in get_maptrack_handle adds a stolen entry to a fresh, empty,
freelist, we think that there is probably no concurrency.  However,
this is not a fast path and adding the locking there makes the code
clearly correct.

Also, while we are here: the stolen maptrack_entry's tail pointer was
not properly set.  Set it.

This is CVE-2017-12136 / XSA-228.

Reported-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
master commit: 02cbeeb6207508b0f04a2c6181445c8eb3f1e117
master date: 2017-08-15 15:07:25 +0200
docs/misc/grant-tables.txt
xen/common/grant_table.c
xen/include/xen/grant_table.h
xen/include/xen/sched.h