]> xenbits.xensource.com Git - livepatch-build-tools.git/commitdiff
create-diff-object: Do not create empty .livepatch.funcs section
authorPawel Wieczorkiewicz <wipawel@amazon.de>
Wed, 21 Aug 2019 08:20:47 +0000 (08:20 +0000)
committerRoss Lagerwall <ross.lagerwall@citrix.com>
Thu, 22 Aug 2019 14:29:32 +0000 (15:29 +0100)
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>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
create-diff-object.c

index a90cf376ab10faa33ec83dfccb414b963282b650..4e0f3bee7c679c9c4c1b4ddf165226a989edbb65 100644 (file)
@@ -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;