[gnome-boxes/gnome-3-18] installer-media: Limit RAM allocation



commit 157ae16f43ccf0ac6cfea9f2fc9d01162caeff14
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Sep 30 17:32:57 2015 +0100

    installer-media: Limit RAM allocation
    
    Ensure we don't allocate too much RAM to guests. There was a case
    reported of Boxes allocating more than 4G RAM to a 32-bit box and Qemu
    crashing as result.

 src/installer-media.vala |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 2eba022..b31de44 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -79,6 +79,9 @@ private class Boxes.InstallerMedia : GLib.Object {
         // FIXME: these values could be made editable somehow
         var architecture = this.architecture ?? "i686";
         resources = media_manager.os_db.get_resources_for_os (os, architecture);
+        resources.ram = (architecture == "i686" || architecture == "i386") ?
+                        resources.ram.clamp (Osinfo.MEBIBYTES, uint32.MAX) :
+                        resources.ram.clamp (Osinfo.MEBIBYTES, int64.MAX);
     }
 
     public virtual void set_direct_boot_params (DomainOs os) {}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]