livepatch: Deal with payloads without any .text
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 11 Aug 2016 01:04:43 +0000 (21:04 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 8 Sep 2016 01:10:40 +0000 (21:10 -0400)
It is possible. Especially if the only thing they do is
NOP functions - in which case there is only .livepatch.funcs
sections.

Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
xen/common/livepatch.c

index 5da28a36f3a40c39f064b61bee74786aee94a0d9..c9dd51a6ea07cc6938c5b5f7be7f20c7960700f5 100644 (file)
@@ -386,16 +386,17 @@ static int move_payload(struct payload *payload, struct livepatch_elf *elf)
 
 static int secure_payload(struct payload *payload, struct livepatch_elf *elf)
 {
-    int rc;
+    int rc = 0;
     unsigned int text_pages, rw_pages, ro_pages;
 
     text_pages = PFN_UP(payload->text_size);
-    ASSERT(text_pages);
-
-    rc = arch_livepatch_secure(payload->text_addr, text_pages, LIVEPATCH_VA_RX);
-    if ( rc )
-        return rc;
 
+    if ( text_pages )
+    {
+        rc = arch_livepatch_secure(payload->text_addr, text_pages, LIVEPATCH_VA_RX);
+        if ( rc )
+            return rc;
+    }
     rw_pages = PFN_UP(payload->rw_size);
     if ( rw_pages )
     {