x86/alt: Adjust _alternative_instructions() to not create shadow stacks
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 1 May 2020 17:10:00 +0000 (18:10 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 29 May 2020 22:09:46 +0000 (23:09 +0100)
commit97c7e7994fe217656c0af00696c3e6dd5582cdef
tree64fdc8f46cc277881830fdb5e8eb1d9137d47590
parent209fb9919b5085f97c7fcf339fa8535e025e8d78
x86/alt: Adjust _alternative_instructions() to not create shadow stacks

The current alternatives algorithm clears CR0.WP and writes into .text.  This
has a side effect of the mappings becoming shadow stacks once CET is active.

Adjust _alternative_instructions() to clean up after itself.  This involves
extending the set of bits modify_xen_mappings() to include Dirty (and Accessed
for good measure).

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/alternative.c
xen/arch/x86/mm.c