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

Re: [Xen-devel] [PATCH] x86emul: correct behavior for single iteration REP INS/OUTS



On Wed, Feb 01, 2017 at 03:59:16AM -0700, Jan Beulich wrote:
> The initial operation done on these paths may raise an exception (for
> ->read_io() that's possible only on the PV path, when the I/O port
> access check has been deferred). We have to suppress put_rep_prefix()
> updating rCX in that case. From an abstract perspective this also
> applies to RETRY being returned.
> 
> Reported-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>
Tested-by: Wei Liu <wei.liu2@xxxxxxxxxx>

> 
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -3116,7 +3116,7 @@ x86_emulate(
>          if ( nr_reps == 1 && ops->read_io && ops->write )
>          {
>              rc = ops->read_io(port, dst.bytes, &dst.val, ctxt);
> -            if ( rc == X86EMUL_OKAY )
> +            if ( rc != X86EMUL_UNHANDLEABLE )
>                  nr_reps = 0;
>          }
>          if ( (nr_reps > 1 || rc == X86EMUL_UNHANDLEABLE) && ops->rep_ins )
> @@ -3157,7 +3157,7 @@ x86_emulate(
>          {
>              rc = read_ulong(ea.mem.seg, ea.mem.off, &dst.val, dst.bytes,
>                              ctxt, ops);
> -            if ( rc == X86EMUL_OKAY )
> +            if ( rc != X86EMUL_UNHANDLEABLE )
>                  nr_reps = 0;
>          }
>          if ( (nr_reps > 1 || rc == X86EMUL_UNHANDLEABLE) && ops->rep_outs )
> 
> 
> 

> x86emul: correct behavior for single iteration REP INS/OUTS
> 
> The initial operation done on these paths may raise an exception (for
> ->read_io() that's possible only on the PV path, when the I/O port
> access check has been deferred). We have to suppress put_rep_prefix()
> updating rCX in that case. From an abstract perspective this also
> applies to RETRY being returned.
> 
> Reported-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -3116,7 +3116,7 @@ x86_emulate(
>          if ( nr_reps == 1 && ops->read_io && ops->write )
>          {
>              rc = ops->read_io(port, dst.bytes, &dst.val, ctxt);
> -            if ( rc == X86EMUL_OKAY )
> +            if ( rc != X86EMUL_UNHANDLEABLE )
>                  nr_reps = 0;
>          }
>          if ( (nr_reps > 1 || rc == X86EMUL_UNHANDLEABLE) && ops->rep_ins )
> @@ -3157,7 +3157,7 @@ x86_emulate(
>          {
>              rc = read_ulong(ea.mem.seg, ea.mem.off, &dst.val, dst.bytes,
>                              ctxt, ops);
> -            if ( rc == X86EMUL_OKAY )
> +            if ( rc != X86EMUL_UNHANDLEABLE )
>                  nr_reps = 0;
>          }
>          if ( (nr_reps > 1 || rc == X86EMUL_UNHANDLEABLE) && ops->rep_outs )


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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