x86: don't wrongly trigger linear page table assertion
authorJan Beulich <jbeulich@suse.com>
Thu, 16 Nov 2017 09:37:29 +0000 (10:37 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 16 Nov 2017 09:37:29 +0000 (10:37 +0100)
commit2c458dfcb59f3d9d8a35fc5ffbf780b6ed7a26a6
tree577d681b77e51e083d70630945b73eb7eedc1bf9
parentca4b2e52a894845f26fc5b784f465e31c4cef90b
x86: don't wrongly trigger linear page table assertion

_put_page_type() may do multiple iterations until its cmpxchg()
succeeds. It invokes set_tlbflush_timestamp() on the first
iteration, however. Code inside the function takes care of this, but
- the assertion in _put_final_page_type() would trigger on the second
  iteration if time stamps in a debug build are permitted to be
  sufficiently much wider than the default 6 bits (see WRAP_MASK in
  flushtlb.c),
- it returning -EINTR (for a continuation to be scheduled) would leave
  the page inconsistent state (until the re-invocation completes).
Make the set_tlbflush_timestamp() invocation conditional, bypassing it
(for now) only in the case we really can't tolerate the stamp to be
stored.

This is part of XSA-240.

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