diff mbox series

[v3,4/7] create-diff-object: Add support for applied/reverted marker

Message ID 20191126122511.7409-5-wipawel@amazon.de (mailing list archive)
State New, archived
Headers show
Series livepatch-build-tools: new features and fixes | expand

Commit Message

Wieczorkiewicz, Pawel Nov. 26, 2019, 12:25 p.m. UTC
With version 2 of a payload structure additional field is supported
to track whether given function has been applied or reverted.
There also comes additional 8-byte alignment padding to reserve
place for future flags and options.

The new fields are zero-out upon .livepatch.funcs section creation.

Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 common.h             | 2 ++
 create-diff-object.c | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/common.h b/common.h
index 300e508..9f9cb7b 100644
--- a/common.h
+++ b/common.h
@@ -124,6 +124,8 @@  struct livepatch_patch_func {
 	uint32_t old_size;
 	uint8_t version;
 	unsigned char pad[31];
+	uint8_t applied;
+	uint8_t _pad[7];
 };
 
 struct special_section {
diff --git a/create-diff-object.c b/create-diff-object.c
index fed47cd..e886d4c 100644
--- a/create-diff-object.c
+++ b/create-diff-object.c
@@ -2013,8 +2013,10 @@  static void livepatch_create_patches_sections(struct kpatch_elf *kelf,
 			funcs[index].old_size = result.size;
 			funcs[index].new_addr = 0;
 			funcs[index].new_size = sym->sym.st_size;
-			funcs[index].version = 1;
+			funcs[index].version = 2;
 			memset(funcs[index].pad, 0, sizeof funcs[index].pad);
+			funcs[index].applied = 0;
+			memset(funcs[index]._pad, 0, sizeof funcs[index]._pad);
 
 			/*
 			 * Add a relocation that will populate