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

[Xen-changelog] [xen master] xsplice: Prevent duplicate payloads from being loaded.



commit a946b8de1490d23502f762fcccd34e13135cf10e
Author:     Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
AuthorDate: Wed Apr 6 15:15:01 2016 -0400
Commit:     Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
CommitDate: Fri Apr 29 03:59:33 2016 -0400

    xsplice: Prevent duplicate payloads from being loaded.
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/common/xsplice.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/xen/common/xsplice.c b/xen/common/xsplice.c
index 4b73b97..1b67d39 100644
--- a/xen/common/xsplice.c
+++ b/xen/common/xsplice.c
@@ -518,6 +518,8 @@ static int prepare_payload(struct payload *payload,
     sec = xsplice_elf_sec_by_name(elf, ELF_BUILD_ID_NOTE);
     if ( sec )
     {
+        const struct payload *data;
+
         n = sec->load_addr;
 
         if ( sec->sec->sh_size <= sizeof(*n) )
@@ -529,6 +531,20 @@ static int prepare_payload(struct payload *payload,
 
         if ( !payload->id.len || !payload->id.p )
             return -EINVAL;
+
+        /* Make sure it is not a duplicate. */
+        list_for_each_entry ( data, &payload_list, list )
+        {
+            /* No way _this_ payload is on the list. */
+            ASSERT(data != payload);
+            if ( data->id.len == payload->id.len &&
+                 !memcmp(data->id.p, payload->id.p, data->id.len) )
+            {
+                dprintk(XENLOG_DEBUG, XSPLICE "%s: Already loaded as %s!\n",
+                        elf->name, data->name);
+                return -EEXIST;
+            }
+        }
     }
 
     sec = xsplice_elf_sec_by_name(elf, ELF_XSPLICE_DEPENDS);
--
generated by git-patchbot for /home/xen/git/xen.git#master

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

 


Rackspace

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