qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [Qemu-devel] [RFC][PATCH] x86: CS limit checks
Date: Thu, 17 Jul 2008 14:37:13 +0100	[thread overview]
Message-ID: <200807171437.13717.paul@codesourcery.com> (raw)
In-Reply-To: <487F45AB.6070906@siemens.com>

On Thursday 17 July 2008, Jan Kiszka wrote:
> Paul Brook wrote:
> > On Thursday 17 July 2008, Jan Kiszka wrote:
> >> +    if (s->pc < s->cs_base || s->pc - s->cs_base > s->cs_limit) {
> >> +        /* At least some of the opcode fetches violate the CS limit.
> >> +           Overwrite the generated code with a GPF raising one. */
> >> +        gen_opc_ptr = gen_opc_start;
> >> +        gen_opparam_ptr = gen_opparam_start;
> >> +        gen_exception(s, EXCP0D_GPF, pc_start - s->cs_base);
> >> +    }
> >
> > I'm fairly sure this is wrong. The TB may fault before it gets to the end
> > of the segment. Likewise if the instruction spanning the limit happens to
> > be an illegal op you will generate the wrong kind of exception.
>
> What a pity, it looked so easy. OK, will think about those aspects
> again. BTW, what happens when the translator hits an unresolvable
> address and faults?

Looks like that's also broken.  In practice I guess a page fault occuring 
early is usually less harmful than a GPF.

Paul

  reply	other threads:[~2008-07-17 13:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-17 11:57 [Qemu-devel] [RFC][PATCH] x86: CS limit checks Jan Kiszka
2008-07-17 12:17 ` Paul Brook
2008-07-17 13:14   ` Jan Kiszka
2008-07-17 13:37     ` Paul Brook [this message]
2008-07-17 16:10       ` Jan Kiszka
2008-07-17 17:45         ` Paul Brook
2008-07-17 19:24           ` Fabrice Bellard
2008-07-17 21:30             ` [Qemu-devel] " Jan Kiszka
2008-07-17 14:06 ` [Qemu-devel] " Fabrice Bellard
2008-07-17 16:30   ` [Qemu-devel] " Jan Kiszka
2008-07-17 19:29     ` Fabrice Bellard
2008-07-17 21:25     ` Jan Kiszka

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=200807171437.13717.paul@codesourcery.com \
    --to=paul@codesourcery.com \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).