]> xenbits.xensource.com Git - people/wipawel/livepatch-build-tools/commitdiff
create-diff-object: Do not create empty .livepatch.funcs section
authorPawel Wieczorkiewicz <wipawel@amazon.de>
Sun, 21 Oct 2018 14:42:11 +0000 (14:42 +0000)
committerPawel Wieczorkiewicz <wipawel@amazon.de>
Thu, 8 Aug 2019 08:56:26 +0000 (08:56 +0000)
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 <wipawel@amazon.de>
Reviewed-by: Martin Mazein <amazein@amazon.de>
Reviewed-by: Martin Pohlack <mpohlack@amazon.de>
create-diff-object.c

index 42521757b2a90a58f7e56155b9da7f49b3841182..41adb09b88c920e8608e519de0947a122d28c185 100644 (file)
@@ -1838,6 +1838,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;