]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
x86emul: also clip repetition count for STOS
authorJan Beulich <jbeulich@suse.com>
Tue, 22 Apr 2025 09:24:20 +0000 (11:24 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 22 Apr 2025 09:24:20 +0000 (11:24 +0200)
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@tum.de>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/x86_emulate/x86_emulate.c

index 55d36b9a264759f9a8e38a369fec048c17d372d9..8e14ebb35b0e39f48e5bf89909fe702e5c75f914 100644 (file)
@@ -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,