WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] x86: adjust microcode handling interface

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] x86: adjust microcode handling interface
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Wed, 04 Oct 2006 16:18:05 +0100
Delivery-date: Wed, 04 Oct 2006 08:17:01 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Confine the knowledge that the buffer gets accessed without use of
proper guest handle accessors to a single file.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2006-09-21/xen/arch/x86/microcode.c
===================================================================
--- 2006-09-21.orig/xen/arch/x86/microcode.c    2006-08-28 12:24:50.000000000 
+0200
+++ 2006-09-21/xen/arch/x86/microcode.c 2006-09-28 12:24:53.000000000 +0200
@@ -455,7 +455,7 @@ static int do_microcode_update (void)
        return error;
 }
 
-int microcode_update(void *buf, unsigned long len)
+int microcode_update(XEN_GUEST_HANDLE(void) buf, unsigned long len)
 {
        int ret;
 
@@ -464,10 +464,15 @@ int microcode_update(void *buf, unsigned
                return -EINVAL;
        }
 
+       if (len != (typeof(user_buffer_size))len) {
+               printk(KERN_ERR "microcode: too much data\n");
+               return -E2BIG;
+       }
+
        mutex_lock(&microcode_mutex);
 
-       user_buffer = (void __user *) buf;
-       user_buffer_size = (int) len;
+       user_buffer = buf.p;
+       user_buffer_size = len;
 
        ret = do_microcode_update();
 
Index: 2006-09-21/xen/arch/x86/platform_hypercall.c
===================================================================
--- 2006-09-21.orig/xen/arch/x86/platform_hypercall.c   2006-09-28 
12:21:17.000000000 +0200
+++ 2006-09-21/xen/arch/x86/platform_hypercall.c        2006-09-28 
12:22:30.000000000 +0200
@@ -104,8 +104,8 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
 
     case XENPF_microcode_update:
     {
-        extern int microcode_update(void *buf, unsigned long len);
-        ret = microcode_update(op->u.microcode.data.p,
+        extern int microcode_update(XEN_GUEST_HANDLE(void), unsigned long len);
+        ret = microcode_update(op->u.microcode.data,
                                op->u.microcode.length);
     }
     break;


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] x86: adjust microcode handling interface, Jan Beulich <=