|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/PV: restrict permitted instructions during memory write emulation
commit ff913f68c9e1153b33d25ede18891a8199ae82bb
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Jan 19 10:38:08 2017 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jan 19 10:38:08 2017 +0100
x86/PV: restrict permitted instructions during memory write emulation
All three code paths mean to only emulate memory writes. Refuse
emulation of any other instructions there.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
xen/arch/x86/mm.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index a5521f1..f35e311 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5340,11 +5340,19 @@ static int ptwr_emulated_cmpxchg(
container_of(ctxt, struct ptwr_emulate_ctxt, ctxt));
}
+static int pv_emul_is_mem_write(const struct x86_emulate_state *state,
+ struct x86_emulate_ctxt *ctxt)
+{
+ return x86_insn_is_mem_write(state, ctxt) ? X86EMUL_OKAY
+ : X86EMUL_UNHANDLEABLE;
+}
+
static const struct x86_emulate_ops ptwr_emulate_ops = {
.read = ptwr_emulated_read,
.insn_fetch = ptwr_emulated_read,
.write = ptwr_emulated_write,
.cmpxchg = ptwr_emulated_cmpxchg,
+ .validate = pv_emul_is_mem_write,
.cpuid = pv_emul_cpuid,
};
@@ -5463,6 +5471,7 @@ static const struct x86_emulate_ops mmio_ro_emulate_ops =
{
.read = x86emul_unhandleable_rw,
.insn_fetch = ptwr_emulated_read,
.write = mmio_ro_emulated_write,
+ .validate = pv_emul_is_mem_write,
.cpuid = pv_emul_cpuid,
};
@@ -5501,6 +5510,7 @@ static const struct x86_emulate_ops mmcfg_intercept_ops =
{
.read = x86emul_unhandleable_rw,
.insn_fetch = ptwr_emulated_read,
.write = mmcfg_intercept_write,
+ .validate = pv_emul_is_mem_write,
.cpuid = pv_emul_cpuid,
};
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |