]> xenbits.xensource.com Git - xen.git/commit
x86/mm: Add debug code to detect illegal page_lock and put_page_type ordering
authorGeorge Dunlap <george.dunlap@citrix.com>
Wed, 24 Jan 2018 11:56:31 +0000 (11:56 +0000)
committerGeorge Dunlap <george.dunlap@citrix.com>
Wed, 7 Feb 2018 12:04:42 +0000 (12:04 +0000)
commitcf4b30dca0ad73e87802df83c5297abee9960c22
tree91bdbc330d10bfd219154c0d5880e262f6597d60
parentdf1e4c6e7f8892e950433ff33c215df0cd7b30f7
x86/mm: Add debug code to detect illegal page_lock and put_page_type ordering

The fix for XSA-242 depends on the same cpu never calling
_put_page_type() while holding a page_lock() for that page; doing so
may cause a deadlock under the right conditions.

Furthermore, even before that, there was never any discipline for the
order in which page locks are grabbed; if there are any paths that
grab the locks for two different pages at once, we risk creating the
conditions for a deadlock to occur.

These are believed to be safe, because it is believed that:
1. No hypervisor paths ever lock two pages at once, and
2. We never call _put_page_type() on a page while holding its page lock.

Add a check to debug builds to catch any violations of these
assumpitons.

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/mm.c