From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Don Slutz <dslutz@verizon.com>, xen-devel@lists.xen.org
Cc: Kevin Tian <kevin.tian@intel.com>, Keir Fraser <keir@xen.org>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Jun Nakajima <jun.nakajima@intel.com>,
Eddie Dong <eddie.dong@intel.com>,
Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
Jan Beulich <jbeulich@suse.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: Re: [PATCH v9 01/13] hvm: Move MAX_INST_LEN into x86_emulate.h
Date: Tue, 17 Feb 2015 09:52:58 +0000 [thread overview]
Message-ID: <54E30F7A.7050607@citrix.com> (raw)
In-Reply-To: <1424127915-27004-2-git-send-email-dslutz@verizon.com>
On 16/02/15 23:05, Don Slutz wrote:
> Change some hard coded 15 into MAX_INST_LEN
>
> Signed-off-by: Don Slutz <dslutz@verizon.com>
One formatting suggestion.
> ---
> xen/arch/x86/hvm/svm/emulate.c | 2 --
> xen/arch/x86/hvm/svm/svm.c | 4 ++--
> xen/arch/x86/hvm/vmx/vmx.c | 2 +-
> xen/arch/x86/x86_emulate/x86_emulate.c | 4 ++--
> xen/arch/x86/x86_emulate/x86_emulate.h | 2 ++
> 5 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/svm/emulate.c b/xen/arch/x86/hvm/svm/emulate.c
> index 37a1ece..6f5c8d3 100644
> --- a/xen/arch/x86/hvm/svm/emulate.c
> +++ b/xen/arch/x86/hvm/svm/emulate.c
> @@ -27,8 +27,6 @@
> #include <asm/hvm/svm/vmcb.h>
> #include <asm/hvm/svm/emulate.h>
>
> -#define MAX_INST_LEN 15
> -
> static unsigned int is_prefix(u8 opc)
> {
> switch ( opc )
> diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
> index a7655bd..4b7b818 100644
> --- a/xen/arch/x86/hvm/svm/svm.c
> +++ b/xen/arch/x86/hvm/svm/svm.c
> @@ -106,7 +106,7 @@ void __update_guest_eip(struct cpu_user_regs *regs, unsigned int inst_len)
> if ( unlikely(inst_len == 0) )
> return;
>
> - if ( unlikely(inst_len > 15) )
> + if ( unlikely(inst_len > MAX_INST_LEN) )
> {
> gdprintk(XENLOG_ERR, "Bad instruction length %u\n", inst_len);
> svm_crash_or_fault(curr);
> @@ -859,7 +859,7 @@ static unsigned int svm_get_insn_bytes(struct vcpu *v, uint8_t *buf)
> if ( len != 0 )
> {
> /* Latch and clear the cached instruction. */
> - memcpy(buf, vmcb->guest_ins, 15);
> + memcpy(buf, vmcb->guest_ins, MAX_INST_LEN);
> v->arch.hvm_svm.cached_insn_len = 0;
> }
>
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index 357ef6c..e1c55ce 100644
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -1854,7 +1854,7 @@ static int get_instruction_length(void)
> unsigned long len;
>
> __vmread(VM_EXIT_INSTRUCTION_LEN, &len); /* Safe: callers audited */
> - BUG_ON((len < 1) || (len > 15));
> + BUG_ON((len < 1) || (len > MAX_INST_LEN));
> return len;
> }
>
> diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
> index f13f07d..42e2588 100644
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -579,8 +579,8 @@ do{ asm volatile ( \
> ({ unsigned long _x = 0, _eip = _regs.eip; \
> if ( !mode_64bit() ) _eip = (uint32_t)_eip; /* ignore upper dword */ \
> _regs.eip += (_size); /* real hardware doesn't truncate */ \
> - generate_exception_if((uint8_t)(_regs.eip - ctxt->regs->eip) > 15, \
> - EXC_GP, 0); \
> + generate_exception_if((uint8_t)(_regs.eip - ctxt->regs->eip) > \
> + MAX_INST_LEN, EXC_GP, 0); \
This would probably be better with the uint8_t cast on starting on the
next line, which would avoid the need to put a linebreak in the middle
of the comparison.
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
> rc = ops->insn_fetch(x86_seg_cs, _eip, &_x, (_size), ctxt); \
> if ( rc ) goto done; \
> _x; \
> diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
> index bdce861..593b31e 100644
> --- a/xen/arch/x86/x86_emulate/x86_emulate.h
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.h
> @@ -24,6 +24,8 @@
> #ifndef __X86_EMULATE_H__
> #define __X86_EMULATE_H__
>
> +#define MAX_INST_LEN 15
> +
> struct x86_emulate_ctxt;
>
> /* Comprehensive enumeration of x86 segment registers. */
next prev parent reply other threads:[~2015-02-17 9:52 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-16 23:05 [PATCH v9 00/13] Xen VMware tools support Don Slutz
2015-02-16 23:05 ` [PATCH v9 01/13] hvm: Move MAX_INST_LEN into x86_emulate.h Don Slutz
2015-02-17 9:52 ` Andrew Cooper [this message]
2015-02-17 21:31 ` Don Slutz
2015-03-03 14:02 ` George Dunlap
2015-03-03 14:08 ` Andrew Cooper
2015-03-03 14:09 ` George Dunlap
2015-02-16 23:05 ` [PATCH v9 02/13] xen: Add support for VMware cpuid leaves Don Slutz
2015-02-17 10:02 ` Andrew Cooper
2015-02-17 15:57 ` Jan Beulich
2015-02-17 15:59 ` Andrew Cooper
2015-02-16 23:05 ` [PATCH v9 03/13] tools: Add vmware_hwver support Don Slutz
2015-03-03 14:14 ` Ian Campbell
2015-02-16 23:05 ` [PATCH v9 04/13] vmware: Add VMware provided include file Don Slutz
2015-02-17 10:03 ` Andrew Cooper
2015-02-16 23:05 ` [PATCH v9 05/13] xen: Add vmware_port support Don Slutz
2015-02-17 10:30 ` Andrew Cooper
2015-02-18 2:18 ` Don Slutz
2015-02-23 15:05 ` Jan Beulich
2015-02-23 16:03 ` Don Slutz
2015-02-23 16:28 ` Jan Beulich
2015-02-16 23:05 ` [PATCH v9 06/13] xen: Add ring 3 " Don Slutz
2015-02-17 14:38 ` Andrew Cooper
2015-02-18 17:03 ` Don Slutz
2015-02-18 18:19 ` Andrew Cooper
2015-02-21 13:36 ` Don Slutz
2015-02-21 15:40 ` Andrew Cooper
2015-02-21 16:06 ` Don Slutz
2015-02-23 15:12 ` Jan Beulich
2015-02-23 17:11 ` Don Slutz
2015-02-24 8:34 ` Jan Beulich
2015-02-24 17:14 ` Don Slutz
2015-02-25 8:39 ` Jan Beulich
2015-02-16 23:05 ` [PATCH v9 07/13] tools: Add " Don Slutz
2015-03-03 14:23 ` Ian Campbell
2015-05-14 23:10 ` Don Slutz
2015-02-16 23:05 ` [PATCH v9 08/13] Add IOREQ_TYPE_VMWARE_PORT Don Slutz
2015-02-17 10:08 ` Paul Durrant
2015-02-18 2:44 ` Don Slutz
2015-02-24 15:34 ` Jan Beulich
2015-02-25 20:20 ` Don Slutz
2015-02-26 8:07 ` Jan Beulich
2015-02-26 11:49 ` Paul Durrant
2015-02-26 14:55 ` Don Slutz
2015-02-26 15:00 ` Paul Durrant
2015-02-26 15:10 ` Jan Beulich
2015-02-26 19:52 ` Don Slutz
2015-02-27 7:48 ` Jan Beulich
2015-03-03 14:25 ` Ian Campbell
2015-02-16 23:05 ` [PATCH v9 09/13] Add xentrace to vmware_port Don Slutz
2015-02-17 13:45 ` Andrew Cooper
2015-02-17 18:22 ` Don Slutz
2015-02-23 16:57 ` Jan Beulich
2015-02-23 19:13 ` Don Slutz
2015-02-24 7:19 ` Jan Beulich
2015-03-03 14:27 ` Ian Campbell
2015-02-16 23:05 ` [PATCH v9 10/13] test_x86_emulator.c: Add typedef for boot_t Don Slutz
2015-02-17 14:44 ` Andrew Cooper
2015-02-17 22:46 ` Don Slutz
2015-02-16 23:05 ` [PATCH v9 11/13] test_x86_emulator.c: Add emacs block Don Slutz
2015-02-17 14:52 ` Andrew Cooper
2015-03-03 14:28 ` Ian Campbell
2015-03-03 14:31 ` Andrew Cooper
2015-02-16 23:05 ` [PATCH v9 12/13] test_x86_emulator.c: Add tests for #GP usage Don Slutz
2015-02-24 15:38 ` Jan Beulich
2015-02-24 18:29 ` Don Slutz
2015-02-25 8:30 ` Jan Beulich
2015-02-25 13:27 ` Don Slutz
2015-02-16 23:05 ` [OPTIONAL][PATCH v9 13/13] Add xen-hvm-param Don Slutz
2015-02-17 14:11 ` Andrew Cooper
2015-02-18 2:51 ` Don Slutz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54E30F7A.7050607@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Aravind.Gopalakrishnan@amd.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=dslutz@verizon.com \
--cc=eddie.dong@intel.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=jun.nakajima@intel.com \
--cc=keir@xen.org \
--cc=kevin.tian@intel.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.