]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
livepatch: Expand check for safe_for_reapply if livepatch has only .rodata.
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 2 Aug 2017 00:29:01 +0000 (00:29 +0000)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 5 Oct 2017 14:29:12 +0000 (10:29 -0400)
If the livepatch has only .rodata sections then it is OK to also
apply/revert/apply the livepatch without having to worry about the
unforseen consequences.

See commit 98b728a7b235c67e210f67f789db5d9eb38ca00c
"livepatch: Disallow applying after an revert" for details.

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

index 039382934d497dceb8b4ce8953348eba9c079bc1..b9376c94e918b7ba12c59693399a24e0b3cdf8aa 100644 (file)
@@ -417,9 +417,12 @@ static int move_payload(struct payload *payload, struct livepatch_elf *elf)
         }
     }
 
-    /* Only one RW section with non-zero size: .livepatch.funcs */
-    if ( rw_buf_cnt == 1 &&
-         !strcmp(elf->sec[rw_buf_sec].name, ELF_LIVEPATCH_FUNC) )
+    /*
+     * Only one RW section with non-zero size: .livepatch.funcs,
+     * or only RO sections.
+     */
+    if ( !rw_buf_cnt || (rw_buf_cnt == 1 &&
+         !strcmp(elf->sec[rw_buf_sec].name, ELF_LIVEPATCH_FUNC)) )
         payload->safe_to_reapply = true;
  out:
     xfree(offset);