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>
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;