diff mbox series

[11/20] create-diff-object: Do not create empty .livepatch.funcs section

Message ID 20190821082056.91090-12-wipawel@amazon.de (mailing list archive)
State Superseded
Headers show
Series livepatch-build-tools: new features and fixes | expand

Commit Message

Wieczorkiewicz, Pawel Aug. 21, 2019, 8:20 a.m. UTC
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 | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Ross Lagerwall Aug. 22, 2019, 1:17 p.m. UTC | #1
On 8/21/19 9:20 AM, Pawel Wieczorkiewicz wrote:
> 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 | 5 +++++
>   1 file changed, 5 insertions(+)
> 

Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>

Thanks
diff mbox series

Patch

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;