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

[xen master] x86/emul: Fix misaligned IO breakpoint behaviour in PV guests



commit 08aacc392d86d4c7dbebdb5e664060ae2af72057
Author:     Matthew Barnes <matthew.barnes@xxxxxxxxx>
AuthorDate: Thu Aug 8 13:27:50 2024 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Aug 8 13:27:50 2024 +0200

    x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
    
    When hardware breakpoints are configured on misaligned IO ports, the
    hardware will mask the addresses based on the breakpoint width during
    comparison.
    
    For PV guests, misaligned IO breakpoints do not behave the same way, and
    therefore yield different results.
    
    This patch tweaks the emulation of IO breakpoints for PV guests such
    that they reproduce the same behaviour as hardware.
    
    Fixes: bec9e3205018 ("x86: emulate I/O port access breakpoints")
    Signed-off-by: Matthew Barnes <matthew.barnes@xxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/pv/emul-priv-op.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index f101510a1b..aa11ecadaa 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -346,6 +346,8 @@ static unsigned int check_guest_io_breakpoint(struct vcpu 
*v,
         case DR_LEN_8: width = 8; break;
         }
 
+        start &= ~(width - 1UL);
+
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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