Hi Andrew,
On 29/01/18 15:38, Andrew Cooper wrote:
On x86, we would like to alter how we patch based on whether there is any
chance of the code being patched being concurrently executed.
prepare_payload() passes false (as the livepatch definitely isn't live at this
point), whereas the boot-time alternatives application passes true.
Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
---
CC: Jan Beulich <jbeul...@suse.com>
CC: Stefano Stabellini <sstabell...@kernel.org>
CC: Julien Grall <julien.gr...@arm.com>
CC: Konrad Rzeszutek Wilk <konrad.w...@oracle.com>
CC: Ross Lagerwall <ross.lagerw...@citrix.com>
---
xen/arch/arm/alternative.c | 10 ++++++----
xen/arch/x86/alternative.c | 5 +++--
xen/common/livepatch.c | 2 +-
xen/include/asm-arm/alternative.h | 6 ++++--
xen/include/asm-x86/alternative.h | 3 ++-
5 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
index 99112e1..078b259 100644
--- a/xen/arch/arm/alternative.c
+++ b/xen/arch/arm/alternative.c
@@ -98,7 +98,8 @@ static u32 get_alt_insn(const struct alt_instr *alt,
* The region patched should be read-write to allow __apply_alternatives
* to replacing the instructions when necessary.
*/
-static void __apply_alternatives(const struct alt_region *region)
+static void __apply_alternatives(const struct alt_region *region,
+ bool live)
{
const struct alt_instr *alt;
const u32 *replptr;
@@ -193,7 +194,7 @@ static int __init __apply_alternatives_multi_stop(void
*unused)
region.begin = (void *)__alt_instructions - (void *)_start + xenmap;
region.end = (void *)__alt_instructions_end - (void *)_start + xenmap;
- __apply_alternatives(®ion);
+ __apply_alternatives(®ion, true);
unregister_virtual_region(&patch_region);
@@ -224,14 +225,15 @@ void __init apply_alternatives_all(void)
}
void apply_alternatives(const struct alt_instr *start,
- const struct alt_instr *end)
+ const struct alt_instr *end,
+ bool live)
This function is not able to deal with "live" code, so I think at least
need an ASSERT(!live) to prevent mis-usage of the code.
With that:
Reviewed-by: Julien Grall <julien.gr...@arm.com>
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel