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-changelog

[Xen-changelog] [xen-unstable] x86: If e820 map overflows, leak memory i

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: If e820 map overflows, leak memory in a safe manner.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 01 Oct 2007 03:10:10 -0700
Delivery-date: Mon, 01 Oct 2007 03:11:01 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1190908252 -3600
# Node ID 9c567284436e367c5ffbcd697a94ec36c3dbe27b
# Parent  04cc0e22a20a0bdf6ceefb016185175ee094ed30
x86: If e820 map overflows, leak memory in a safe manner.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/e820.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff -r 04cc0e22a20a -r 9c567284436e xen/arch/x86/e820.c
--- a/xen/arch/x86/e820.c       Thu Sep 27 16:36:23 2007 +0100
+++ b/xen/arch/x86/e820.c       Thu Sep 27 16:50:52 2007 +0100
@@ -416,11 +416,9 @@ int __init reserve_e820_ram(struct e820m
         /* Truncate end. */
         e820->map[i].size -= e - s;
     }
-    else
+    else if ( e820->nr_map < ARRAY_SIZE(e820->map) )
     {
         /* Split in two. */
-        if ( e820->nr_map >= ARRAY_SIZE(e820->map) )
-            return 0;
         memmove(&e820->map[i+1], &e820->map[i],
                 (e820->nr_map-i) * sizeof(e820->map[0]));
         e820->nr_map++;
@@ -429,6 +427,21 @@ int __init reserve_e820_ram(struct e820m
         e820->map[i].addr = e;
         e820->map[i].size = re - e;
     }
+    else
+    {
+        /* e820map is at maximum size. We have to leak some space. */
+        if ( (s - rs) > (re - e) )
+        {
+            printk("e820 overflow: leaking RAM %"PRIx64"-%"PRIx64"\n", e, re);
+            e820->map[i].size = s - rs;
+        }
+        else
+        {
+            printk("e820 overflow: leaking RAM %"PRIx64"-%"PRIx64"\n", rs, s);
+            e820->map[i].addr = e;
+            e820->map[i].size = re - e;
+        }
+    }
 
     return 1;
 }

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86: If e820 map overflows, leak memory in a safe manner., Xen patchbot-unstable <=