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

[xen staging-4.20] x86emul: also clip repetition count for STOS



commit 23a02992edb88e200fb0e722be6229729309c1d5
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Apr 29 11:45:28 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Apr 29 11:45:28 2025 +0200

    x86emul: also clip repetition count for STOS
    
    Like MOVS, INS, and OUTS, STOS also has a special purpose hook, where
    the hook function may legitimately have the same expectation as to the
    request not straddling address space start/end.
    
    Fixes: 5dfe4aa4eeb6 ("x86_emulate: Do not request emulation of REP 
instructions beyond the")
    Reported-by: Fabian Specht <f.specht@xxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: 8c5636b6c87777e6c2e4ffae28bffe1cfc189bfd
    master date: 2025-04-22 11:24:20 +0200
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c 
b/xen/arch/x86/x86_emulate/x86_emulate.c
index 535d803588..e8cba5a27f 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2221,7 +2221,7 @@ x86_emulate(
 
         dst.bytes = src.bytes;
         dst.mem.seg = x86_seg_es;
-        dst.mem.off = truncate_ea(_regs.r(di));
+        dst.mem.off = truncate_ea_and_reps(_regs.r(di), nr_reps, dst.bytes);
         if ( (nr_reps == 1) || !ops->rep_stos ||
              ((rc = ops->rep_stos(&src.val,
                                   dst.mem.seg, dst.mem.off, dst.bytes,
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20



 


Rackspace

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