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

Re: [Xen-devel] [PATCH] x86/HVM: fix boundary check in hvmemul_insn_fetch() (again)


  • To: 'Jan Beulich' <JBeulich@xxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Paul Durrant <Paul.Durrant@xxxxxxxxxx>
  • Date: Thu, 10 Aug 2017 08:35:16 +0000
  • Accept-language: en-GB, en-US
  • Cc: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Delivery-date: Thu, 10 Aug 2017 08:35:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>
  • Thread-index: AQHTEapKUCGzIc2DkkiDJEVyITpCDKJ9Q3VQ
  • Thread-topic: [PATCH] x86/HVM: fix boundary check in hvmemul_insn_fetch() (again)

> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@xxxxxxxx]
> Sent: 10 August 2017 08:28
> To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
> Cc: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>; Paul Durrant
> <Paul.Durrant@xxxxxxxxxx>
> Subject: [PATCH] x86/HVM: fix boundary check in hvmemul_insn_fetch()
> (again)
> 
> Commit 5a992b670b ("x86/hvm: Fix boundary check in
> hvmemul_insn_fetch()") went a little too far in its correction to
> commit 0943a03037 ("x86/hvm: Fixes to hvmemul_insn_fetch()"): Keep the
> start offset check, but restore the original end offset one.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> --- a/xen/arch/x86/hvm/emulate.c
> +++ b/xen/arch/x86/hvm/emulate.c
> @@ -959,7 +959,7 @@ int hvmemul_insn_fetch(
>               * which means something went wrong with instruction decoding...
>               */
>              if ( insn_off >= sizeof(hvmemul_ctxt->insn_buf) ||
> -                 (insn_off + bytes) >= sizeof(hvmemul_ctxt->insn_buf) )
> +                 insn_off + bytes > sizeof(hvmemul_ctxt->insn_buf) )

I thought it was generally good style to have brackets in clauses such as this. 
Anyway...

Reviewed-by: Paul Durrant <paul.durrant@xxxxxxxxxx>

>              {
>                  ASSERT_UNREACHABLE();
>                  return X86EMUL_UNHANDLEABLE;
> 
> 


_______________________________________________
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®.