xen/arm: Simplify alternative patching of non-writable region
authorJulien Grall <julien.grall@arm.com>
Tue, 12 Jun 2018 11:36:37 +0000 (12:36 +0100)
committerJulien Grall <julien.grall@arm.com>
Fri, 22 Jun 2018 01:59:42 +0000 (02:59 +0100)
commit7c98c24e9ba76df3b9f531353d99e5c1bfa8b9a9
treee27d1f01df16001b4b6becd3f3b43c20a410c802
parenta7898e4c593f83cc5db419d99bdecc0b220bf4e3
xen/arm: Simplify alternative patching of non-writable region

During the MMU setup process, Xen will set SCTLR_EL2.WNX
(Write-Non-eXecutable) bit. Because of that, the alternative code need
to re-mapped the region in a difference place in order to modify the
text section.

At the moment, the function patching the code is only aware of the
re-mapped region. This requires the caller to mess with Xen internal in
order to have function such as is_active_kernel_text() working.

All the interactions with Xen internal can be removed by specifying the
offset between the region patch and the writable region for updating the
instruction

This simplification will also make it easier to integrate dynamic patching
in a follow-up patch. Indeed, the callback address should be in
an original region and not re-mapped only which is writeable non-executable.

This is part of XSA-263.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/alternative.c