[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2 16/17] arm64: if trapping a write-to-read-only GICv3 access inject Undef exception in guest



This patch is a port to xen from linux commit:
7b1dba1f7325629427c0e5bdf014159b229d16c8
KVM: arm64: Log an error if trapping a write-to-read-only GICv3 access

A write-to-read-only GICv3 access should UNDEF at EL1. But since
we're in complete paranoia-land with broken CPUs, let's assume the
worse and gracefully handle the case.

Signed-off-by: Manish Jaggi <manish.jaggi@xxxxxxxxxx>
---
 xen/arch/arm/arm64/vgic-v3-sr.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/arm64/vgic-v3-sr.c b/xen/arch/arm/arm64/vgic-v3-sr.c
index 201194c713..14276a4c92 100644
--- a/xen/arch/arm/arm64/vgic-v3-sr.c
+++ b/xen/arch/arm/arm64/vgic-v3-sr.c
@@ -480,7 +480,10 @@ spurious:
 
 static void vreg_emulate_iar(struct cpu_user_regs *regs, const union hsr hsr)
 {
-    vgic_v3_read_iar(regs, hsr);
+    if ( unlikely(!hsr.sysreg.read) )
+        inject_undef_exception(regs, hsr);
+    else
+        vgic_v3_read_iar(regs, hsr);
 }
 
 static int vgic_v3_find_active_lr(int intid, uint64_t *lr_val)
@@ -698,7 +701,10 @@ spurious:
 static void vreg_emulate_hppir1(struct cpu_user_regs *regs,
                                 const union hsr hsr)
 {
-    vgic_v3_read_hppir1(regs, hsr);
+    if ( unlikely(!hsr.sysreg.read) )
+        inject_undef_exception(regs, hsr);
+    else
+        vgic_v3_read_hppir1(regs, hsr);
 }
 
 static void vgic_v3_read_bpr0(struct cpu_user_regs *regs, int regidx)
-- 
2.14.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.