xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86emul: don't allow null selector for LTR
@ 2016-09-22  6:38 Jan Beulich
  2016-09-22 10:09 ` Konrad Rzeszutek Wilk
  2016-09-26 13:51 ` Andrew Cooper
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2016-09-22  6:38 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper

[-- Attachment #1: Type: text/plain, Size: 906 bytes --]

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
This goes on top of
https://lists.xenproject.org/archives/html/xen-devel/2016-09/msg02198.html 

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1207,10 +1207,17 @@ protmode_load_seg(
     /* NULL selector? */
     if ( (sel & 0xfffc) == 0 )
     {
-        if ( (seg == x86_seg_cs) ||
-             ((seg == x86_seg_ss) &&
-              (!mode_64bit() || (cpl == 3) || (cpl != sel))) )
+        switch ( seg )
+        {
+        case x86_seg_ss:
+            if ( mode_64bit() && (cpl != 3) && (cpl == sel) )
+        default:
+                break;
+            /* fall through */
+        case x86_seg_cs:
+        case x86_seg_tr:
             goto raise_exn;
+        }
         memset(sreg, 0, sizeof(*sreg));
         sreg->sel = sel;
         return X86EMUL_OKAY;




[-- Attachment #2: x86emul-TR-null.patch --]
[-- Type: text/plain, Size: 945 bytes --]

x86emul: don't allow null selector for LTR

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
This goes on top of
https://lists.xenproject.org/archives/html/xen-devel/2016-09/msg02198.html

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1207,10 +1207,17 @@ protmode_load_seg(
     /* NULL selector? */
     if ( (sel & 0xfffc) == 0 )
     {
-        if ( (seg == x86_seg_cs) ||
-             ((seg == x86_seg_ss) &&
-              (!mode_64bit() || (cpl == 3) || (cpl != sel))) )
+        switch ( seg )
+        {
+        case x86_seg_ss:
+            if ( mode_64bit() && (cpl != 3) && (cpl == sel) )
+        default:
+                break;
+            /* fall through */
+        case x86_seg_cs:
+        case x86_seg_tr:
             goto raise_exn;
+        }
         memset(sreg, 0, sizeof(*sreg));
         sreg->sel = sel;
         return X86EMUL_OKAY;

[-- Attachment #3: Type: text/plain, Size: 127 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86emul: don't allow null selector for LTR
  2016-09-22  6:38 [PATCH] x86emul: don't allow null selector for LTR Jan Beulich
@ 2016-09-22 10:09 ` Konrad Rzeszutek Wilk
  2016-09-26 13:51 ` Andrew Cooper
  1 sibling, 0 replies; 3+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-09-22 10:09 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Andrew Cooper

On Thu, Sep 22, 2016 at 12:38:22AM -0600, Jan Beulich wrote:
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> This goes on top of
> https://lists.xenproject.org/archives/html/xen-devel/2016-09/msg02198.html 
> 
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -1207,10 +1207,17 @@ protmode_load_seg(
>      /* NULL selector? */
>      if ( (sel & 0xfffc) == 0 )
>      {
> -        if ( (seg == x86_seg_cs) ||
> -             ((seg == x86_seg_ss) &&
> -              (!mode_64bit() || (cpl == 3) || (cpl != sel))) )
> +        switch ( seg )
> +        {
> +        case x86_seg_ss:
> +            if ( mode_64bit() && (cpl != 3) && (cpl == sel) )
> +        default:
> +                break;
> +            /* fall through */
> +        case x86_seg_cs:
> +        case x86_seg_tr:
>              goto raise_exn;
> +        }
>          memset(sreg, 0, sizeof(*sreg));
>          sreg->sel = sel;
>          return X86EMUL_OKAY;
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86emul: don't allow null selector for LTR
  2016-09-22  6:38 [PATCH] x86emul: don't allow null selector for LTR Jan Beulich
  2016-09-22 10:09 ` Konrad Rzeszutek Wilk
@ 2016-09-26 13:51 ` Andrew Cooper
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2016-09-26 13:51 UTC (permalink / raw)
  To: Jan Beulich, xen-devel

On 22/09/16 07:38, Jan Beulich wrote:
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-26 13:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-22  6:38 [PATCH] x86emul: don't allow null selector for LTR Jan Beulich
2016-09-22 10:09 ` Konrad Rzeszutek Wilk
2016-09-26 13:51 ` Andrew Cooper

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).