qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Andrew Oates <andrew@andrewoates.com>
Cc: rth@twiddle.net, ehabkost@redhat.com, qemu-devel@nongnu.org,
	Andrew Oates <aoates@google.com>
Subject: Re: [Qemu-devel] [PATCH] target-i386: fix segment limit check in ljmp
Date: Mon, 20 Aug 2018 12:06:13 +0200	[thread overview]
Message-ID: <f3c28dc7-a16e-1451-5bb6-090c6e13cf84@redhat.com> (raw)
In-Reply-To: <CAAVLcG6m_x2p4r9dqD6B2qG-Z_G_iTh5rAubS44PRM2-Mqnpkw@mail.gmail.com>

On 17/08/2018 20:04, Andrew Oates wrote:
>>> [1] this is an invalid configuration (in protected mode the L bit is
>>> reserved and should be set to zero), but qemu doesn't enforce that.
>
> Is there a central place to do that sort of validation?  We could do it
> in load_segment_ra, but that doesn't feel quite right.  Otherwise it's
> whack-a-mole to check validity at every place a code segment is
> referenced---but maybe that's ok, there probably aren't too many of them.
> 
> WDYT?

To find them you have to look for the calls to cpu_x86_load_seg_cache.

However, the L bit is simply ignored in the descriptor cache outside
64-bit mode (at least that's what you can guess from the Intel manual's
26.3 CHECKING AND LOADING GUEST STATE, which is as close as you can get
to an official explanation of the descriptor cache), so you'd have to
take that into account too and do the check in the callers of
cpu_x86_load_seg_cache.

And in fact, the wording is a bit wishy-washy in both the Intel and AMD
manuals, for example AMD says of bit 21 that

	Generally, software should clear all reserved bits to 0, so they
	can be defined in future revisions to the AMD64 architecture.

so I am not 100% sure that the processor will actually raise an
exception if L is 1.

Thanks,

Paolo

  reply	other threads:[~2018-08-20 10:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-16  1:19 [Qemu-devel] [PATCH] target-i386: fix segment limit check in ljmp andrew
2018-08-17 17:38 ` Paolo Bonzini
2018-08-17 18:04   ` Andrew Oates
2018-08-20 10:06     ` Paolo Bonzini [this message]
2018-08-20 11:32       ` Andrew Oates
2018-08-20 11:55         ` Paolo Bonzini

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=f3c28dc7-a16e-1451-5bb6-090c6e13cf84@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=andrew@andrewoates.com \
    --cc=aoates@google.com \
    --cc=ehabkost@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).