All of lore.kernel.org
 help / color / mirror / Atom feed
From: Razvan Cojocaru <rcojocaru@bitdefender.com>
To: Jan Beulich <JBeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Cc: stefano.stabellini@eu.citrix.com, ian.jackson@eu.citrix.com,
	ian.campbell@citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH] tools/tests: Add EIP check to test_x86_emulator.c
Date: Thu, 07 Aug 2014 11:35:18 +0300	[thread overview]
Message-ID: <53E33A46.5080302@bitdefender.com> (raw)
In-Reply-To: <53E355B7020000780002A09F@mail.emea.novell.com>

On 08/07/2014 11:32 AM, Jan Beulich wrote:
>>>> On 07.08.14 at 10:18, <andrew.cooper3@citrix.com> wrote:
>> On 07/08/2014 09:16, Razvan Cojocaru wrote:
>>> The test now also checks that EIP was modified after emulating
>>> instructions after (and including) the "movq %mm3,(%ecx)..."
>>> code block.
>>>
>>> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
>>
>> These checks do check that the instruction pointer has changed, which
>> catches your problem, but doesn't check that it has changed correctly. 
>> You need to work out exactly how long the instruction is a verify that
>> eip points to first byte of the next instruction.
> 
> And apart from that this should be done for all tests, not just the
> MMX/SSE/AVX ones.

The other tests already do this, but there it's simpler to check. For
example:

218     printf("%-40s", "Testing addl %%ecx,%%eax...");
219     instr[0] = 0x01; instr[1] = 0xc8;
220     regs.eflags = 0x200;
221     regs.eip    = (unsigned long)&instr[0];
222     regs.ecx    = 0x12345678;
223     regs.eax    = 0x7FFFFFFF;
224     rc = x86_emulate(&ctxt, &emulops);
225     if ( (rc != X86EMUL_OKAY) ||
226          (regs.ecx != 0x12345678) ||
227          (regs.eax != 0x92345677) ||
228          (regs.eflags != 0xa94) ||
229          (regs.eip != (unsigned long)&instr[2]) )
230         goto fail;
231     printf("okay\n");


Thanks,
Razvan Cojocaru

  reply	other threads:[~2014-08-07  8:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-07  8:16 [PATCH] tools/tests: Add EIP check to test_x86_emulator.c Razvan Cojocaru
2014-08-07  8:18 ` Andrew Cooper
2014-08-07  8:32   ` Jan Beulich
2014-08-07  8:35     ` Razvan Cojocaru [this message]
2014-08-07  8:45       ` Jan Beulich
2014-08-07  8:53         ` Razvan Cojocaru
2014-08-07  9:17   ` Razvan Cojocaru
2014-08-07  9:35     ` Andrew Cooper
2014-08-07  8:23 ` Jürgen Groß
2014-08-07  8:27   ` Razvan Cojocaru

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=53E33A46.5080302@bitdefender.com \
    --to=rcojocaru@bitdefender.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --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.