From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
keir@xen.org, David Binderman <dcb314@hotmail.com>,
Tim Deegan <tim@xen.org>
Subject: Re: [PATCH v4 1/2] x86/hvm: fix segment validation
Date: Fri, 22 Nov 2013 14:25:21 +0000 [thread overview]
Message-ID: <528F6951.9080700@citrix.com> (raw)
In-Reply-To: <528F764C0200007800105E41@nat28.tlf.novell.com>
On 22/11/13 14:20, Jan Beulich wrote:
> Also Coverity CID 1055180.
>
> Reported-by: David Binderman <dcb314@hotmail.com>
> Signed-off-by: Tim Deegan <tim@xen.org>
>
> Use _SEGMENT_* instead of plain numbers and adjust a comment.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -2280,7 +2280,7 @@ static int hvm_load_segment_selector(
> if ( !(desc.b & (1u<<11)) )
> goto unmap_and_fail;
> /* Non-conforming segment: check DPL against RPL. */
> - if ( ((desc.b & (6u<<9)) != 6) && (dpl != rpl) )
> + if ( !(desc.b & _SEGMENT_EC) && (dpl != rpl) )
> goto unmap_and_fail;
> break;
> case x86_seg_ss:
> @@ -2299,8 +2299,13 @@ static int hvm_load_segment_selector(
> /* Readable code or data segment? */
> if ( (desc.b & (5u<<9)) == (4u<<9) )
> goto unmap_and_fail;
> - /* Non-conforming segment: check DPL against RPL and CPL. */
> - if ( ((desc.b & (6u<<9)) != 6) && ((dpl < cpl) || (dpl < rpl)) )
> + /*
> + * Data or non-conforming code segment:
> + * check DPL against RPL and CPL.
> + */
> + if ( ((desc.b & (_SEGMENT_EC|_SEGMENT_CODE)) !=
> + (_SEGMENT_EC|_SEGMENT_CODE))
> + && ((dpl < cpl) || (dpl < rpl)) )
> goto unmap_and_fail;
> break;
> }
>
>
>
next prev parent reply other threads:[~2013-11-22 14:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-21 11:45 xen-4.3.1:hvm.c: 2 * possible bad if tests ? David Binderman
2013-11-21 11:54 ` Andrew Cooper
2013-11-21 15:03 ` [PATCH] " Tim Deegan
2013-11-21 15:07 ` Andrew Cooper
2013-11-21 15:13 ` Tim Deegan
2013-11-21 15:19 ` Keir Fraser
2013-11-21 15:32 ` Tim Deegan
2013-11-21 18:56 ` Andrew Cooper
2013-11-22 11:50 ` Jan Beulich
2013-11-22 11:54 ` Tim Deegan
2013-11-22 14:20 ` [PATCH v4 1/2] x86/hvm: fix segment validation Jan Beulich
2013-11-22 14:25 ` Andrew Cooper [this message]
2013-11-22 14:21 ` [PATCH v4 2/2] x86/hvm: clean up " Jan Beulich
2013-11-22 14:27 ` Andrew Cooper
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=528F6951.9080700@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=dcb314@hotmail.com \
--cc=keir@xen.org \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.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.