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

[Xen-devel] [PATCH v3 18/23] xsplice: Prevent duplicate payloads to be loaded.



From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>

Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 xen/common/xsplice.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/xen/common/xsplice.c b/xen/common/xsplice.c
index 8c5557e..3f1da13 100644
--- a/xen/common/xsplice.c
+++ b/xen/common/xsplice.c
@@ -728,6 +728,23 @@ static int find_special_sections(struct payload *payload,
         if ( xen_build_id_check(&payload->id.p, &payload->id.len, n) )
             return -EINVAL;
     }
+    /* Make sure it is not a duplicate. */
+    if ( payload->id.len )
+    {
+        struct payload *data;
+
+        spin_lock(&payload_lock);
+        list_for_each_entry ( data, &payload_list, list )
+        {
+            if ( data != payload && data->id.len &&
+                 !memcmp(data->id.p, payload->id.p, data->id.len) )
+            {
+                spin_unlock(&payload_lock);
+                return -EEXIST;
+            }
+        }
+        spin_unlock(&payload_lock);
+    }
 
     sec = xsplice_elf_sec_by_name(elf, ".xsplice.depends");
     {
-- 
2.1.0


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.