When there is no changed function in the generated payload, do not
create an empty .livepatch.funcs section. Hypervisor code considers
such payloads as broken and rejects to load them.

Such payloads without any changed functions may appear when only
hooks are specified.

Signed-off-by: Pawel Wieczorkiewicz <wipa...@amazon.de>
Reviewed-by: Martin Mazein <amaz...@amazon.de>
Reviewed-by: Martin Pohlack <mpohl...@amazon.de>
---
 create-diff-object.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/create-diff-object.c b/create-diff-object.c
index a90cf37..4e0f3be 100644
--- a/create-diff-object.c
+++ b/create-diff-object.c
@@ -1843,6 +1843,11 @@ static void livepatch_create_patches_sections(struct 
kpatch_elf *kelf,
                if (sym->type == STT_FUNC && sym->status == CHANGED)
                        nr++;
 
+       if (nr == 0) {
+               log_debug("No changed functions found. Skipping 
.livepatch.funcs section creation\n");
+               return;
+       }
+
        /* create text/rela section pair */
        sec = create_section_pair(kelf, ".livepatch.funcs", sizeof(*funcs), nr);
        relasec = sec->rela;
-- 
2.16.5




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to